summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibVideo/VP9
diff options
context:
space:
mode:
authorZaggy1024 <zaggy1024@gmail.com>2023-04-24 21:13:40 -0500
committerTim Flynn <trflynn89@pm.me>2023-04-25 06:35:13 -0400
commiteba72fa3a7e5d6f94b57ee8b03bf5b4c6b433772 (patch)
tree062c2eec4fb8c88738580aab0e183cb212eca3f2 /Userland/Libraries/LibVideo/VP9
parent8944ca830f02606163fc1afb875f3edf69bc8a66 (diff)
downloadserenity-eba72fa3a7e5d6f94b57ee8b03bf5b4c6b433772.zip
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.
Diffstat (limited to 'Userland/Libraries/LibVideo/VP9')
-rw-r--r--Userland/Libraries/LibVideo/VP9/Parser.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/Userland/Libraries/LibVideo/VP9/Parser.cpp b/Userland/Libraries/LibVideo/VP9/Parser.cpp
index 4e660564ff..f7fca00ad5 100644
--- a/Userland/Libraries/LibVideo/VP9/Parser.cpp
+++ b/Userland/Libraries/LibVideo/VP9/Parser.cpp
@@ -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));