--- libavcodec/utils.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 92ac2f8..8f8369b 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1288,6 +1288,10 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi } else ret = 0; + /* many decoders assign whole AVFrames, thus overwriting extended_data; + * make sure it's set correctly */ + picture->extended_data = picture->data; + return ret; } @@ -1344,6 +1348,7 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, int *got_frame_ptr, AVPacket *avpkt) { + int planar, channels; int ret = 0; *got_frame_ptr = 0; @@ -1366,6 +1371,15 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, frame->format = avctx->sample_fmt; } } + + /* many decoders assign whole AVFrames, thus overwriting extended_data; + * make sure it's set correctly; assume decoders that actually use + * extended_data are doing it correctly */ + planar = av_sample_fmt_is_planar(frame->format); + channels = av_get_channel_layout_nb_channels(frame->channel_layout); + if (!(planar && channels > AV_NUM_DATA_POINTERS)) + frame->extended_data = frame->data; + return ret; } -- 1.7.10.4 _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel