1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:17:35 +00:00

LibVideo/VP9: Wait for workers to finish when there are decoding errors

Previously, the `Parser::decode_tiles()` function wouldn't wait for the
tile-decoding workers to finish before exiting the function, which
could mean that the data the threads are working with could become
invalid if the decoder is deleted after an error is encountered.
This commit is contained in:
Zaggy1024 2023-04-24 21:13:40 -05:00 committed by Tim Flynn
parent 8944ca830f
commit eba72fa3a7

View file

@ -930,10 +930,16 @@ DecoderErrorOr<void> Parser::decode_tiles(FrameContext& frame_context)
}
// Decode the first column in this thread.
TRY(decode_tile_column(tile_workloads[0]));
auto result = decode_tile_column(tile_workloads[0]);
for (auto& worker_thread : m_worker_threads)
TRY(worker_thread->wait_until_task_is_finished());
for (auto& worker_thread : m_worker_threads) {
auto task_result = worker_thread->wait_until_task_is_finished();
if (!result.is_error() && task_result.is_error())
result = move(task_result);
}
if (result.is_error())
return result;
#else
for (auto& column_workloads : tile_workloads)
TRY(decode_tile_column(column_workloads));