Browse Source

Notify viewers when channels close and refresh resumed playback state

master
evgeny 6 days ago
parent
commit
6e596f34a5
  1. 2
      src/stream/stream.c
  2. 5
      tools/chatgui/src/streamplayer_window.cpp
  3. 2
      tools/chatgui/transport/stream_bridge.cpp

2
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;
}
}

5
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<int>(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;
}

2
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<std::mutex> 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);

Loading…
Cancel
Save