[FFmpeg-cvslog] h264: set Picture.owner2 to the current thread

Janne Grunau git at videolan.org
Tue Nov 27 14:41:36 CET 2012


ffmpeg | branch: master | Janne Grunau <janne-libav at jannau.net> | Sun Nov 25 19:42:16 2012 +0100| [d5e83122bdc39b9c0278b9b4f6c49baa99223bd6] | committer: Janne Grunau

h264: set Picture.owner2 to the current thread

This does not seem to have an effect currently. Fate-h264 passes with
THREADS=1..16 and both threading types as before. It fixes however a
segfault during error resilience with my adaptive-frame-mt patchset.
A picture in use during error resilience gets realloced in another
thread in the fuzzed sample sample_varPAR.avi_s226019.

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

 libavcodec/h264.c      |    2 ++
 libavcodec/mpegvideo.c |    3 +--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 8226d74..8b9ac5c 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -2876,10 +2876,12 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
 
     if (h->slice_type_nos != AV_PICTURE_TYPE_I) {
         s->last_picture_ptr = &h->ref_list[0][0];
+        s->last_picture_ptr->owner2 = s;
         ff_copy_picture(&s->last_picture, s->last_picture_ptr);
     }
     if (h->slice_type_nos == AV_PICTURE_TYPE_B) {
         s->next_picture_ptr = &h->ref_list[1][0];
+        s->next_picture_ptr->owner2 = s;
         ff_copy_picture(&s->next_picture, s->next_picture_ptr);
     }
 
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 8a48d99..322ad09 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1459,8 +1459,7 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
     if (s->next_picture_ptr)
         ff_copy_picture(&s->next_picture, s->next_picture_ptr);
 
-    if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_FRAME) &&
-        (s->out_format != FMT_H264 || s->codec_id == AV_CODEC_ID_SVQ3)) {
+    if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_FRAME)) {
         if (s->next_picture_ptr)
             s->next_picture_ptr->owner2 = s;
         if (s->last_picture_ptr)



More information about the ffmpeg-cvslog mailing list