summaryrefslogtreecommitdiff
path: root/libavcodec/pthread_frame.c
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2015-06-30 21:01:29 +0200
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2015-07-01 00:32:21 +0200
commit32a5b631267e1f8bf279e407039b9a99d012d033 (patch)
treec0bc6f5bc44b641cea4e4f34760d8d0d93cba57c /libavcodec/pthread_frame.c
parent04a68f43488c2b6796f1e24c87122f814b785e88 (diff)
pthread_frame: forward error codes when flushing
This is the first part of the fix for ticket #4370. Reviewed-by: Michael Niedermayer <michaelni@gmx.at> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Diffstat (limited to 'libavcodec/pthread_frame.c')
-rw-r--r--libavcodec/pthread_frame.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index a3fd1fff75..d48ee33edf 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -454,6 +454,9 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
*got_picture_ptr = p->got_frame;
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,
* including this one, searching for a frame to return before being
@@ -471,6 +474,14 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
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 (p->result >= 0) ? avpkt->size : p->result;
}