[FFmpeg-cvslog] mpegvideo: Initialize chroma_*_shift and codec_tag even if the size is 0

Martin Storsjö git at videolan.org
Tue Oct 8 02:16:59 CEST 2013


ffmpeg | branch: release/1.1 | Martin Storsjö <martin at martin.st> | Tue Sep 24 12:02:39 2013 +0300| [42c7ed49a9e4cd5fdeb1306e8e09a96a4c7dbbbb] | committer: Martin Storsjö

mpegvideo: Initialize chroma_*_shift and codec_tag even if the size is 0

This fixes breakage in a few fate tests on certain setups
(that for some reason didn't break on OS X) after the previous
commit (8812a8057). Currently, some video streams are initialized
in ff_MPV_common_init with width/height set at 0 and only changed
to a proper video size with ff_MPV_common_frame_size_change later.

The breakage was diagnosed by Anton Khirnov.

Signed-off-by: Martin Storsjö <martin at martin.st>
(cherry picked from commit 5f24fe82e5fcf227abb5ebf62aa9bc246fda8c0d)

Signed-off-by: Martin Storsjö <martin at martin.st>

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

 libavcodec/mpegvideo.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 77e21d2..0274f01 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -914,17 +914,17 @@ av_cold int ff_MPV_common_init(MpegEncContext *s)
     s->flags  = s->avctx->flags;
     s->flags2 = s->avctx->flags2;
 
-    if (s->width && s->height) {
-        /* set chroma shifts */
-        av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt,
-                                         &s->chroma_x_shift,
-                                         &s->chroma_y_shift);
+    /* set chroma shifts */
+    av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt,
+                                     &s->chroma_x_shift,
+                                     &s->chroma_y_shift);
 
-        /* convert fourcc to upper case */
-        s->codec_tag          = avpriv_toupper4(s->avctx->codec_tag);
+    /* convert fourcc to upper case */
+    s->codec_tag          = avpriv_toupper4(s->avctx->codec_tag);
 
-        s->stream_codec_tag   = avpriv_toupper4(s->avctx->stream_codec_tag);
+    s->stream_codec_tag   = avpriv_toupper4(s->avctx->stream_codec_tag);
 
+    if (s->width && s->height) {
         s->avctx->coded_frame = &s->current_picture.f;
 
         if (s->encoding) {



More information about the ffmpeg-cvslog mailing list