libx264: do not set pic quality if no frame is output
authorBaptiste Coudurier <baptiste.coudurier@gmail.com>
Sun, 30 Jan 2011 01:05:42 +0000 (17:05 -0800)
committerReinhard Tartler <siretart@tauware.de>
Sat, 5 Nov 2011 12:18:32 +0000 (13:18 +0100)
Avoids uninitialized reads.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 5caa2de19ece830e32c95731bc92a423d55cff0c)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
libavcodec/libx264.c

index df7b2e8..e247255 100644 (file)
@@ -127,7 +127,8 @@ static int X264_frame(AVCodecContext *ctx, uint8_t *buf,
     }
 
     x4->out_pic.key_frame = pic_out.b_keyframe;
-    x4->out_pic.quality   = (pic_out.i_qpplus1 - 1) * FF_QP2LAMBDA;
+    if (bufsize)
+        x4->out_pic.quality = (pic_out.i_qpplus1 - 1) * FF_QP2LAMBDA;
 
     return bufsize;
 }