diff options
author | Ronald S. Bultje <rsbultje@gmail.com> | 2022-02-17 01:40:37 +0300 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2022-02-17 16:46:19 +0300 |
commit | 2a00fb6d4746a9bd0c15e0dcbcb148ce0b3e681d (patch) | |
tree | 2fe852b7ac6e27a7e12bf55d803fb2dbdf5d4529 /src/lib.c | |
parent | 00d4715ca2a16f41f5cec2118c6333ce99067f07 (diff) |
Forward frame-thread decoding errors back to user thread
Diffstat (limited to 'src/lib.c')
-rw-r--r-- | src/lib.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -377,6 +377,12 @@ static int drain_picture(Dav1dContext *const c, Dav1dPicture *const out) { if (++c->frame_thread.next == c->n_fc) c->frame_thread.next = 0; pthread_mutex_unlock(&c->task_thread.lock); + const int error = f->task_thread.retval; + if (error) { + f->task_thread.retval = 0; + dav1d_thread_picture_unref(out_delayed); + return error; + } if (out_delayed->p.data[0]) { const unsigned progress = atomic_load_explicit(&out_delayed->progress[1], @@ -450,6 +456,12 @@ int dav1d_get_picture(Dav1dContext *const c, Dav1dPicture *const out) validate_input_or_ret(c != NULL, DAV1D_ERR(EINVAL)); validate_input_or_ret(out != NULL, DAV1D_ERR(EINVAL)); + if (c->cached_error) { + const int res = c->cached_error; + c->cached_error = 0; + return res; + } + const int drain = c->drain; c->drain = 1; |