Skip to content
Snippets Groups Projects
Commit 56e7ffc0 authored by Wan-Teh Chang's avatar Wan-Teh Chang Committed by James Almer
Browse files

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.
parent a05a1cfd
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment