[vlc-commits] avcodec: set decoder error only when it's critical

Thomas Guillem git at videolan.org
Thu Sep 15 17:33:13 CEST 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Sep 15 17:29:38 2016 +0200| [e19a43ebb7a775ab9b09a370661e00fe9adf3f38] | committer: Thomas Guillem

avcodec: set decoder error only when it's critical

avcodec decoders can return an error for a frame/pkt, but that doesn't mean you
need to abort.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e19a43ebb7a775ab9b09a370661e00fe9adf3f38
---

 modules/codec/avcodec/video.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 42d9e89..5f50167 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -829,7 +829,11 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
         int ret = avcodec_send_packet(p_context, &pkt);
         if( ret != 0 && ret != AVERROR(EAGAIN) )
         {
-            p_dec->b_error = true;
+            if (ret == AVERROR(ENOMEM) || ret == AVERROR(EINVAL))
+            {
+                msg_Err(p_dec, "avcodec_send_packet critical error");
+                p_dec->b_error = true;
+            }
             av_packet_unref( &pkt );
             break;
         }
@@ -846,7 +850,11 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
         ret = avcodec_receive_frame(p_context, frame);
         if( ret != 0 && ret != AVERROR(EAGAIN) )
         {
-            p_dec->b_error = true;
+            if (ret == AVERROR(ENOMEM) || ret == AVERROR(EINVAL))
+            {
+                msg_Err(p_dec, "avcodec_receive_frame critical error");
+                p_dec->b_error = true;
+            }
             av_frame_free(&frame);
             break;
         }



More information about the vlc-commits mailing list