LibMedia: Only clear decoder thread queues if the demuxer seek moves

Clearing the queue unconditionally here isn't right, since we could end
up with the prior frame to the target in the queue rather than being
decoded by handle_seek().
This commit is contained in:
Zaggy1024 2026-05-23 08:30:30 -05:00 committed by Gregory Bertilson
parent 5d1dfec680
commit 020fe311d8
2 changed files with 8 additions and 4 deletions

View file

@ -407,10 +407,12 @@ DecoderErrorOr<void> DecodedAudioProducer::ThreadData::retrieve_next_block(Audio
void DecodedAudioProducer::ThreadData::resolve_seek(u32 seek_id, bool moved_position)
{
m_queue.clear();
m_last_processed_seek_id = seek_id;
VERIFY(m_current_halting_status != PipelineStatus::HaveData);
m_moved_position_pending = moved_position;
if (moved_position) {
m_moved_position_pending = true;
m_queue.clear();
}
}
bool DecodedAudioProducer::ThreadData::handle_seek()

View file

@ -393,10 +393,12 @@ void DecodedVideoProducer::ThreadData::dispatch_error(DecoderError&& error)
void DecodedVideoProducer::ThreadData::resolve_seek(u32 seek_id, bool moved_position)
{
m_queue.clear();
m_last_processed_seek_id = seek_id;
VERIFY(m_current_halting_status != PipelineStatus::HaveData);
m_moved_position_pending = moved_position;
if (moved_position) {
m_moved_position_pending = true;
m_queue.clear();
}
}
bool DecodedVideoProducer::ThreadData::handle_seek()