Use video playback clocks when the source disables audio
This commit is contained in:
1 parent
0bd046adca
commit
cbe4cb1e33
4 files changed
+44
-9
No files matched your search
@@ -438,7 +438,7 @@ void StreamPlayerWindow::decode() {
|
||||
p.videos.clear(); p.videoBytes = 0; p.started = p.presenting = p.videoReady = false;
|
||||
p.position = p.ready = -1; p.decoderLead = 0; p.framePeriod = 33333;
|
||||
p.lastInputPts = p.lastDecodedPts = p.lastShownPts = -1;
|
||||
p.ended = p.videoEnded = p.audioEnded = p.resync = false;
|
||||
p.ended = p.videoEnded = p.audioEnded = p.activeAudio = p.resync = false;
|
||||
p.audioDacAt = 0; p.audioFrameStart = 0; p.endFrames = UINT64_MAX;
|
||||
p.audioFedAt = 0; p.audioFedPts = -1; observedGaps = p.underruns; p.audioUnderrunning = false;
|
||||
}
|
||||
@@ -450,6 +450,13 @@ void StreamPlayerWindow::decode() {
|
||||
auto observe = [&] {
|
||||
stream_media_status status{};
|
||||
if (!gui_stream_status(p.id, status)) return;
|
||||
if (status.initialized && p.started && p.activeAudio != bool(status.audio_enabled && p.audioAvailable)) {
|
||||
DEBUG_INFO(DEBUG_CATEGORY_STREAM, "desktop playback audio changed id=%llu previous=%d source_enabled=%d output=%d "
|
||||
"position_us=%lld video_us=%lld audio_us=%lld; resync playback clock",
|
||||
(unsigned long long)p.id, p.activeAudio, status.audio_enabled, int(p.audioAvailable.load()),
|
||||
(long long)p.position, (long long)status.video_us, (long long)status.audio_us);
|
||||
reset(true); return;
|
||||
}
|
||||
if (status.initialized && !p.started) {
|
||||
bool audio = status.audio_enabled && p.audioAvailable;
|
||||
auto* sound = audio ? stream_playback_audio_create(status.start_us, 250) : nullptr;
|
||||
@@ -465,7 +472,7 @@ void StreamPlayerWindow::decode() {
|
||||
std::lock_guard<std::mutex> guard(p.lock);
|
||||
p.media = status;
|
||||
if (status.initialized)
|
||||
p.ready = p.activeAudio && !status.audio_ended ? status.audio_us : std::max(status.audio_us, status.video_us);
|
||||
p.ready = !p.activeAudio ? status.video_us : !status.audio_ended ? status.audio_us : std::max(status.audio_us, status.video_us);
|
||||
};
|
||||
if (!gui_stream_open(p.id, p.group, p.source, p.epoch,
|
||||
[](void* arg) { static_cast<Playback*>(arg)->notify(true); }, &p)) fail(text("Could not connect to the stream"));
|
||||
|
||||
Reference in new issue
Block a user