summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authoriive <iive@b3059339-0415-0410-9bf9-f77b7e298cf2>2011-05-01 20:21:00 +0000
committerUoti Urpala <uau@mplayer2.org>2011-06-29 06:30:49 +0300
commit49b31c2b43b9853bc3a347be7d914e27839d1f61 (patch)
tree946442d5461da269900ea7dce6a3afde4ee9632d /libmpcodecs
parent6283d4d6bb65e75041da638cb5532af9581ec1a8 (diff)
downloadmpv-49b31c2b43b9853bc3a347be7d914e27839d1f61.tar.bz2
mpv-49b31c2b43b9853bc3a347be7d914e27839d1f61.tar.xz
vd_ffmpeg.c: fix one case of "-lavdopts vstats" crashing
Fix segfault with -lavdopts vstats and some codecs. The vstats option relies on avctx->coded_frame being filled. Unfortunately not all codecs do that (e.g. VP8) thus causing NULL dereference. FFmpeg code seems to always check if coded_frame != NULL, so we should do the same. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33347 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/vd_ffmpeg.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c
index 5460d20fd1..c8463d5c34 100644
--- a/libmpcodecs/vd_ffmpeg.c
+++ b/libmpcodecs/vd_ffmpeg.c
@@ -389,7 +389,7 @@ static void uninit(sh_video_t *sh){
vd_ffmpeg_ctx *ctx = sh->context;
AVCodecContext *avctx = ctx->avctx;
- if(sh->opts->lavc_param.vstats){
+ if (sh->opts->lavc_param.vstats && avctx->coded_frame) {
int i;
for(i=1; i<32; i++){
mp_msg(MSGT_DECVIDEO, MSGL_INFO, "QP: %d, count: %d\n", i, ctx->qp_stat[i]);
@@ -784,6 +784,9 @@ static struct mp_image *decode(struct sh_video *sh, void *data, int len,
AVFrame *pic= avctx->coded_frame;
double quality=0.0;
+ if (!pic)
+ break;
+
if(!fvstats) {
time_t today2;
struct tm *today;