Skip to content

threading: Ensure passing the correct retval to decode_frame_exit

Victorien Le Couviour--Tuffet requested to merge psilokos/dav1d:fix-419 into master

We must reload error just before calling dav1d_decode_frame_exit, as it may have become stale between the last load and that call. This can result in crashes since we return a seemingly successfully decoded frame, when it's not.

Reloading it within the frame done condition's body ensures a non-stale value, as we use f->task_thread.task_counter == 0 to ensure all other threads and tasks have already completed when entering it. In other words, only the last thread still working on this frame can execute this code, after all other threads have returned to doing something else.

Merge request reports