Add stream camera controls and preserve playback on changes

This commit is contained in:
evgeny committed 2026-10-13 01:00:53 +02:00
1 parent 72bcbd98e8
commit 3a6dacf378
25 files changed
+1042 -280

No files matched your search

@@ -179,6 +179,7 @@ void StreamPlayerWindow::decode() {
bool waitKey = true, opened = false;
int64_t deadline = nowUs() + 10000000, reportAt = nowUs(), expectedAudio = -1;
uint64_t decoded = 0, discarded = 0;
uint32_t videoRevision = 0;
auto reset = [&] {
avcodec_free_context(&decoder);
opus_codec_decoder_destroy(opus); opus = nullptr; expectedAudio = -1; waitKey = true;
@@ -239,6 +240,13 @@ void StreamPlayerWindow::decode() {
} else expectedAudio = static_cast<int64_t>(record.pts) + 20000;
continue;
}
if (videoRevision != record.format.revision) {
DEBUG_INFO(DEBUG_CATEGORY_STREAM, "desktop video revision=%u->%u dimensions=%ux%u rotation=%u; preserve audio",
videoRevision, record.format.revision, record.format.width, record.format.height, record.format.rotation);
avcodec_free_context(&decoder); av_frame_unref(frame); waitKey = true; videoRevision = record.format.revision;
{ std::lock_guard<std::mutex> guard(p.lock); p.videos.clear(); }
deadline = nowUs() + 10000000;
}
if (waitKey && !(record.flags & STREAM_MEDIA_KEY)) continue;
if (!decoder) {
const AVCodec* codec = avcodec_find_decoder(AV_CODEC_ID_H264);