feat(desktop): 支持粘贴配对并修复串流与设备切换
- 支持 Ctrl+V 粘贴配对文本和二维码图片,预览确认后识别校验 - 修复控制发送阻塞、TLS 读写争锁、设备切换沿用旧连接及串流误关窗 - 优化媒体加密上下文、UDP 接收缓冲和异步诊断日志 - 安装器按路径停止主控与信令进程,统一递增版本、打包和清理旧产物 - 发布 0.1.3+4,通过三端编译、20 项 Flutter 测试和 58 项 Rust 单元测试
This commit is contained in:
1 parent
f6b7730684
commit
3cd72d70e1
38 files changed
+1173
-196
No files matched your search
@@ -6,6 +6,9 @@
|
||||
|
||||
#include "generated_plugin_registrant.h"
|
||||
|
||||
#include <pasteboard/pasteboard_plugin.h>
|
||||
|
||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||
PasteboardPluginRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("PasteboardPlugin"));
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
#
|
||||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
pasteboard
|
||||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
|
||||
@@ -907,6 +907,10 @@ class VideoTexturePlugin : public flutter::Plugin {
|
||||
}
|
||||
|
||||
~VideoTexturePlugin() override {
|
||||
stop_.store(true);
|
||||
if (worker_.joinable()) {
|
||||
worker_.join();
|
||||
}
|
||||
// 先摘掉回调,避免析构期间 DestroyWindow 触发 InvokeMethod。
|
||||
video_window_.SetCloseHandler(nullptr);
|
||||
video_window_.SetInputHandler(nullptr);
|
||||
@@ -914,10 +918,6 @@ class VideoTexturePlugin : public flutter::Plugin {
|
||||
video_window_.SetWheelHandler(nullptr);
|
||||
video_window_.SetKeyboardHandler(nullptr);
|
||||
video_window_.Close();
|
||||
stop_.store(true);
|
||||
if (worker_.joinable()) {
|
||||
worker_.join();
|
||||
}
|
||||
if (texture_registrar_ != nullptr && texture_id_ != 0) {
|
||||
texture_registrar_->UnregisterTexture(texture_id_,
|
||||
std::function<void()>());
|
||||
@@ -1028,7 +1028,7 @@ class VideoTexturePlugin : public flutter::Plugin {
|
||||
? decoded - window_start_frame_
|
||||
: 0));
|
||||
map[flutter::EncodableValue("pending")] =
|
||||
flutter::EncodableValue(static_cast<int64_t>(api_.Pending()));
|
||||
flutter::EncodableValue(pending_count_.load());
|
||||
map[flutter::EncodableValue("received")] =
|
||||
flutter::EncodableValue(static_cast<int64_t>(received_));
|
||||
map[flutter::EncodableValue("width")] =
|
||||
@@ -1037,7 +1037,11 @@ class VideoTexturePlugin : public flutter::Plugin {
|
||||
flutter::EncodableValue(static_cast<int64_t>(height));
|
||||
map[flutter::EncodableValue("pts")] =
|
||||
flutter::EncodableValue(static_cast<int64_t>(frames_->pts()));
|
||||
std::string error = api_.error() + decoder_.error();
|
||||
std::string error;
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(diagnostic_mutex_);
|
||||
error = diagnostic_error_;
|
||||
}
|
||||
if (error.empty() && !saw_codec_config_.load() && keyframes_.load() > 0 &&
|
||||
frames_->frames() == 0) {
|
||||
// 关键帧都收到了却始终没有 SPS/PPS,解码器会一直「吃数据不出图」且不报错,
|
||||
@@ -1071,6 +1075,13 @@ class VideoTexturePlugin : public flutter::Plugin {
|
||||
bool has_pending = false;
|
||||
|
||||
while (!stop_.load()) {
|
||||
// API function pointers and decoder strings belong to the worker thread.
|
||||
// Publish a protected snapshot instead of reading them from the UI thread.
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(diagnostic_mutex_);
|
||||
diagnostic_error_ = api_.error() + decoder_.error();
|
||||
}
|
||||
pending_count_.store(static_cast<int64_t>(api_.Pending()));
|
||||
if (!has_pending) {
|
||||
if (!api_.EnsureLoaded()) {
|
||||
Sleep(kRetrySleepMs);
|
||||
@@ -1162,6 +1173,9 @@ class VideoTexturePlugin : public flutter::Plugin {
|
||||
bool closing_from_channel_ = false;
|
||||
RustVideoApi api_;
|
||||
VideoDecoder decoder_;
|
||||
std::mutex diagnostic_mutex_;
|
||||
std::string diagnostic_error_;
|
||||
std::atomic<int64_t> pending_count_{0};
|
||||
std::atomic<bool> stop_{false};
|
||||
std::thread worker_;
|
||||
int64_t texture_id_ = 0;
|
||||
|
||||
@@ -88,7 +88,7 @@ class VideoWindow {
|
||||
void EnsureBackBuffer(HDC reference, int width, int height);
|
||||
void ReleaseBackBuffer();
|
||||
|
||||
HWND hwnd_ = nullptr;
|
||||
std::atomic<HWND> hwnd_{nullptr};
|
||||
std::atomic<bool> open_{false};
|
||||
std::atomic<bool> repaint_pending_{false};
|
||||
FrameProvider provider_;
|
||||
|
||||
Reference in new issue
Block a user