fix(sender): 修复断开后重连一直超时,串流窗口按被控端比例开局

- rust_core: stop 先关闭控制连接再 join 监听线程,保证端口真正释放
- rust_core: start 前回收残留线程,按 AddrInUse 重试绑定,失败不再静默
- rust_core: 监听套接字异常时把 running 置回 false;半开握手读超时缩到 1.2s
- rust_core: 新增 demo_reconnect 回归测试(stop 后立刻 start 仍可接入)
- flutter_sender: connect 检查本机监听结果,失败直接提示端口被占用
- flutter_sender: 断开时一并关闭独立串流窗口,重连不再残留旧帧
- flutter_sender: openWindow 传入被控端分辨率,窗口开局即按竖屏比例居中
This commit is contained in:
tongtong committed 2026-11-27 12:06:57 +08:00
1 parent 77ce882397
commit 32e7ca26d8
7 files changed
+269 -33

No files matched your search

@@ -895,8 +895,30 @@ class VideoTexturePlugin : public flutter::Plugin {
}
if (call.method_name() == "openWindow") {
auto store = frames_;
// Flutter 侧带上被控端屏幕尺寸,窗口首帧之前就能按正确比例开好。
int hint_width = 0;
int hint_height = 0;
if (const auto* arguments =
std::get_if<flutter::EncodableMap>(call.arguments())) {
auto read_int = [arguments](const char* key) -> int {
const auto entry = arguments->find(flutter::EncodableValue(key));
if (entry == arguments->end()) {
return 0;
}
if (const auto* value = std::get_if<int32_t>(&entry->second)) {
return *value;
}
if (const auto* value = std::get_if<int64_t>(&entry->second)) {
return static_cast<int>(*value);
}
return 0;
};
hint_width = read_int("width");
hint_height = read_int("height");
}
const bool opened = video_window_.Open(
[store](int* width, int* height) { return store->Snapshot(width, height); });
[store](int* width, int* height) { return store->Snapshot(width, height); },
hint_width, hint_height);
result->Success(flutter::EncodableValue(opened));
return;
}