Skip to content

Truly independent web browser

LibMedia: Check for exit before waiting in decoders' halting state

Zaggy10242c925bc75de6
diff --git a/Libraries/LibMedia/Producers/DecodedAudioProducer.cpp b/Libraries/LibMedia/Producers/DecodedAudioProducer.cpp
index 0ac718184ad..6eaa28b271b 100644
--- a/Libraries/LibMedia/Producers/DecodedAudioProducer.cpp
+++ b/Libraries/LibMedia/Producers/DecodedAudioProducer.cpp
@@ -727,13 +727,8 @@ void DecodedAudioProducer::ThreadData::push_data_and_decode_a_block()
auto locker = take_lock();
enter_halting_state(status, move(error));
- while (true) {
- if (m_seek_id != m_last_processed_seek_id)
- return;
+ while (m_seek_id == m_last_processed_seek_id && !should_thread_exit_while_locked())
m_wait_condition.wait();
- if (should_thread_exit_while_locked())
- return;
- }
};
// If a prior seek encountered a decoding error, stop here to ensure that the pipeline state stays Error.
diff --git a/Libraries/LibMedia/Producers/DecodedVideoProducer.cpp b/Libraries/LibMedia/Producers/DecodedVideoProducer.cpp
index f8ee7d65d63..c3a16d1b5f3 100644
--- a/Libraries/LibMedia/Producers/DecodedVideoProducer.cpp
+++ b/Libraries/LibMedia/Producers/DecodedVideoProducer.cpp
@@ -856,13 +856,8 @@ void DecodedVideoProducer::ThreadData::push_data_and_decode_some_frames()
auto locker = take_lock();
enter_halting_state(status, move(error));
- while (true) {
- if (m_seek_id != m_last_processed_seek_id)
- return;
+ while (m_seek_id == m_last_processed_seek_id && !should_thread_exit_while_locked())
m_wait_state->condition.wait();
- if (should_thread_exit_while_locked())
- return;
- }
};
// If a prior seek encountered a decoding error, stop here to ensure that the pipeline state stays Error.