From 6e596f34a5b91c37238a7e7550f0c7712b8d02a7 Mon Sep 17 00:00:00 2001 From: evgeny Date: Mon, 12 Oct 2026 22:18:04 +0200 Subject: [PATCH] Notify viewers when channels close and refresh resumed playback state --- src/stream/stream.c | 2 +- tools/chatgui/src/streamplayer_window.cpp | 5 +++-- tools/chatgui/transport/stream_bridge.cpp | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/stream/stream.c b/src/stream/stream.c index d6cd9729..e57f7c30 100644 --- a/src/stream/stream.c +++ b/src/stream/stream.c @@ -479,7 +479,7 @@ void stream_cancel_group(struct UTUN_INSTANCE *inst, uint64_t group_id) { struct stream_session *s = service->sessions; while (s) { struct stream_session *next = s->next; - if (!s->closing && s->descriptor.group_id == group_id) session_close(s, STREAM_CLOSE_GROUP, 1, 0); + if (!s->closing && s->descriptor.group_id == group_id) session_close(s, STREAM_CLOSE_GROUP, 1, 1); s = next; } } diff --git a/tools/chatgui/src/streamplayer_window.cpp b/tools/chatgui/src/streamplayer_window.cpp index fb46ac55..72a45244 100644 --- a/tools/chatgui/src/streamplayer_window.cpp +++ b/tools/chatgui/src/streamplayer_window.cpp @@ -141,8 +141,8 @@ void StreamPlayerWindow::tick() { } if (!image.isNull()) { m_render->setFrame(image); + m_status->setText(text("Live")); if (!p.shown++) { - m_status->setText(text("Live")); DEBUG_INFO(DEBUG_CATEGORY_STREAM, "desktop first frame id=%llu %dx%d", (unsigned long long)p.id, image.width(), image.height()); } emit framePresented(); @@ -275,7 +275,8 @@ void StreamPlayerWindow::decode() { frame->width, frame->height, AV_PIX_FMT_RGB24, SWS_BILINEAR, nullptr, nullptr, nullptr); QImage image(frame->width, frame->height, QImage::Format_RGB888); if (!converter || image.isNull()) { fail(text("Stream decoder allocation failed")); p.running = false; break; } - uint8_t* destination[] = {image.bits(), nullptr, nullptr, nullptr}; int strides[] = {image.bytesPerLine(), 0, 0, 0}; + uint8_t* destination[] = {image.bits(), nullptr, nullptr, nullptr}; + int strides[] = {static_cast(image.bytesPerLine()), 0, 0, 0}; if (sws_scale(converter, frame->data, frame->linesize, 0, frame->height, destination, strides) != frame->height) { fail(text("Stream video conversion failed")); p.running = false; break; } diff --git a/tools/chatgui/transport/stream_bridge.cpp b/tools/chatgui/transport/stream_bridge.cpp index a6208eef..c08f98a8 100644 --- a/tools/chatgui/transport/stream_bridge.cpp +++ b/tools/chatgui/transport/stream_bridge.cpp @@ -155,7 +155,7 @@ bool gui_stream_attach(UTUN_INSTANCE* inst) { void gui_stream_detach(UTUN_INSTANCE* inst) { std::lock_guard guard(bridge.lock); - if (bridge.inst != inst) return; + if (!inst || bridge.inst != inst) return; if (bridge.pending) uasync_cancel_post(inst->ua, bridge.pending); bridge.pending = nullptr; stream_set_event_callback(inst, nullptr, nullptr); if (bridge.viewer.id) closeViewer(StreamRecordKind::Closed, STREAM_CLOSE_SERVICE);