[FFmpeg-cvslog] pthread_frame: forward error codes when flushing
Andreas Cadhalpun
git at videolan.org
Thu Jul 23 02:17:06 CEST 2015
ffmpeg | branch: release/2.6 | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Tue Jun 30 21:01:29 2015 +0200| [a0f50ddcb83117a7202f0e65e0416b4f6e4ef383] | committer: Michael Niedermayer
pthread_frame: forward error codes when flushing
This is the first part of the fix for ticket #4370.
Reviewed-by: Michael Niedermayer <michaelni at gmx.at>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
(cherry picked from commit 32a5b631267e1f8bf279e407039b9a99d012d033)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
(cherry picked from commit acfad331adde5b4ae247bf5748211e8fdb6b4ef5)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a0f50ddcb83117a7202f0e65e0416b4f6e4ef383
---
libavcodec/pthread_frame.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index 41fafce..d07df0d 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -453,6 +453,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
@@ -470,6 +473,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;
}
More information about the ffmpeg-cvslog
mailing list