[FFmpeg-cvslog] rv34: use ff_mpeg_update_thread_context only when decoder is fully initialized

Janne Grunau git at videolan.org
Fri Aug 22 18:57:54 CEST 2014


ffmpeg | branch: master | Janne Grunau <janne-libav at jannau.net> | Thu Aug 21 13:26:33 2014 +0200| [dc4b2e7d33903a6b9380e8a84b22b3a20facbb08] | committer: Janne Grunau

rv34: use ff_mpeg_update_thread_context only when decoder is fully initialized

MpegEncContext based decoders are only fully initialized after the first
ff_thread_get_buffer() call. The RV30/40 decoders may fail before a frame
buffer was requested. ff_mpeg_update_thread_context() fails on half
initialized MpegEncContexts. Since this can only happen before a the
first frame was decoded there is no need to call
ff_mpeg_update_thread_context().

Based on patches by John Stebbins and tested by John Stebbins.

CC: libav-stable at libav.org

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

 libavcodec/rv34.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index 4ed2a33..26ab7e4 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -1555,16 +1555,18 @@ int ff_rv34_decode_update_thread_context(AVCodecContext *dst, const AVCodecConte
             return err;
     }
 
-    if ((err = ff_mpeg_update_thread_context(dst, src)))
-        return err;
-
     r->cur_pts  = r1->cur_pts;
     r->last_pts = r1->last_pts;
     r->next_pts = r1->next_pts;
 
     memset(&r->si, 0, sizeof(r->si));
 
-    return 0;
+    // Do no call ff_mpeg_update_thread_context on a partially initialized
+    // decoder context.
+    if (!s1->linesize)
+        return 0;
+
+    return ff_mpeg_update_thread_context(dst, src);
 }
 
 static int get_slice_offset(AVCodecContext *avctx, const uint8_t *buf, int n)



More information about the ffmpeg-cvslog mailing list