diff options
author | Wan-Teh Chang <wtc@google.com> | 2022-03-10 00:43:25 +0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2022-03-16 21:56:13 +0300 |
commit | 56e7ffc0dbe44970a4d55ec2241824c67add9dd5 (patch) | |
tree | fd95a10a0b722bd60daf5425c386526b17189c52 /src | |
parent | a05a1cfd1f5998c1d7f3ef31f4ae042a4a3cb398 (diff) |
Set f->n_tile_data to 0 in dav1d_decode_frame()
Set f->n_tile_data to 0 after the dav1d_decode_frame_exit() call in
dav1d_decode_frame(). dav1d_decode_frame_exit() unrefs every element in
use in the f->tile array, so it is good to set f->n_tile_data to 0 to
indicate that no elements are in use.
We are already doing this after all other dav1d_decode_frame_exit()
calls.
NOTE: It is tempting to have dav1d_decode_frame_exit() itself set
f->n_tile_data to 0. I did not do that in this merge request, because
the following is a common pattern:
dav1d_decode_frame_exit(f, error);
f->n_tile_data = 0;
pthread_cond_signal(&f->task_thread.cond);
corresponding to the waiting code:
while (f->n_tile_data > 0)
pthread_cond_wait(&f->task_thread.cond,
&c->task_thread.lock);
I wonder if f->n_tile_data is set to 0 outside dav1d_decode_frame_exit()
to make clear the association of f->n_tile_data with the condition
variable f->task_thread.cond.
Diffstat (limited to 'src')
-rw-r--r-- | src/decode.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/decode.c b/src/decode.c index bd13014..13d5706 100644 --- a/src/decode.c +++ b/src/decode.c @@ -3463,6 +3463,7 @@ int dav1d_decode_frame(Dav1dFrameContext *const f) { } } dav1d_decode_frame_exit(f, res); + f->n_tile_data = 0; return res; } |