mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:47: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:
parent
8944ca830f
commit
eba72fa3a7
1 changed files with 9 additions and 3 deletions
|
@ -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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue