Commit 32a5b631 authored by Andreas Cadhalpun's avatar Andreas Cadhalpun

pthread_frame: forward error codes when flushing

This is the first part of the fix for ticket #4370.
Reviewed-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
Signed-off-by: 's avatarAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
parent 04a68f43
...@@ -454,6 +454,9 @@ int ff_thread_decode_frame(AVCodecContext *avctx, ...@@ -454,6 +454,9 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
*got_picture_ptr = p->got_frame; *got_picture_ptr = p->got_frame;
picture->pkt_dts = p->avpkt.dts; picture->pkt_dts = p->avpkt.dts;
if (p->result < 0)
err = p->result;
/* /*
* A later call with avkpt->size == 0 may loop over all threads, * A later call with avkpt->size == 0 may loop over all threads,
* including this one, searching for a frame to return before being * including this one, searching for a frame to return before being
...@@ -471,6 +474,14 @@ int ff_thread_decode_frame(AVCodecContext *avctx, ...@@ -471,6 +474,14 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
fctx->next_finished = finished; fctx->next_finished = finished;
/*
* When no frame was found while flushing, but an error occured in
* any thread, return it instead of 0.
* Otherwise the error can get lost.
*/
if (!avpkt->size && !*got_picture_ptr)
return err;
/* return the size of the consumed packet if no error occurred */ /* return the size of the consumed packet if no error occurred */
return (p->result >= 0) ? avpkt->size : p->result; return (p->result >= 0) ? avpkt->size : p->result;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment