Truly independent web browser
LibMedia: Force a decoder restart when seeking during replacement
Zaggy10243ad64d003fc0
diff --git a/Libraries/LibMedia/Producers/DecodedAudioProducer.cpp b/Libraries/LibMedia/Producers/DecodedAudioProducer.cppindex e925f567809..0ac718184ad 100644--- a/Libraries/LibMedia/Producers/DecodedAudioProducer.cpp+++ b/Libraries/LibMedia/Producers/DecodedAudioProducer.cpp@@ -581,7 +581,12 @@ void DecodedAudioProducer::ThreadData::handle_seek()}m_current_halting_status = PipelineStatus::Pending;- m_frame_awaiting_decoder_replacement.clear();+ // A seek makes the drain pointless, and the demuxer has already given us the frame and its configuration, so+ // start over with a new decoder and have the demuxer provide the configuration again.+ if (m_frame_awaiting_decoder_replacement.has_value()) {+ m_frame_awaiting_decoder_replacement.clear();+ m_decoder.clear();+ }m_decoder_is_draining_before_unavailable_data = false;}diff --git a/Libraries/LibMedia/Producers/DecodedVideoProducer.cpp b/Libraries/LibMedia/Producers/DecodedVideoProducer.cppindex 71c958c48a5..f8ee7d65d63 100644--- a/Libraries/LibMedia/Producers/DecodedVideoProducer.cpp+++ b/Libraries/LibMedia/Producers/DecodedVideoProducer.cpp@@ -645,7 +645,12 @@ void DecodedVideoProducer::ThreadData::handle_seek()}m_current_halting_status = PipelineStatus::Pending;- m_frame_awaiting_decoder_replacement.clear();+ // A seek makes the drain pointless, and the demuxer has already given us the frame and its configuration, so+ // start over with a new decoder and have the demuxer provide the configuration again.+ if (m_frame_awaiting_decoder_replacement.has_value()) {+ m_frame_awaiting_decoder_replacement.clear();+ m_decoder.clear();+ }m_decoder_is_draining_before_unavailable_data = false;if (m_decoder != nullptr)m_decoder_that_failed_due_to_missing_features = {};