summaryrefslogtreecommitdiffstats
path: root/libavcodec/svq3.c
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2011-05-13 10:24:31 +0300
committerRonald S. Bultje <rsbultje@gmail.com>2011-05-21 07:40:56 -0400
commitcdca7c378ed46cf67a7583a102ba1b2b91d00b9c (patch)
tree1affd4ecda4473309622625094fc6a278ae3fa5e /libavcodec/svq3.c
parent21bbca5b4422ddd10363bf1d8494564c54639b39 (diff)
downloadffmpeg-streaming-cdca7c378ed46cf67a7583a102ba1b2b91d00b9c.zip
ffmpeg-streaming-cdca7c378ed46cf67a7583a102ba1b2b91d00b9c.tar.gz
svq3: Do initialization after parsing the extradata
If done before, some parameters aren't known yet. With svq3/rtp, initializing before some parameters are known can lead to calling av_malloc(0), which on OS X currently returns broken pointers.
Diffstat (limited to 'libavcodec/svq3.c')
-rw-r--r--libavcodec/svq3.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index 1e4c962..bc0215e 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -804,20 +804,11 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx)
avctx->pix_fmt = avctx->codec->pix_fmts[0];
if (!s->context_initialized) {
- s->width = avctx->width;
- s->height = avctx->height;
h->halfpel_flag = 1;
h->thirdpel_flag = 1;
h->unknown_svq3_flag = 0;
h->chroma_qp[0] = h->chroma_qp[1] = 4;
- if (MPV_common_init(s) < 0)
- return -1;
-
- h->b_stride = 4*s->mb_width;
-
- ff_h264_alloc_tables(h);
-
/* prowl for the "SEQH" marker in the extradata */
extradata = (unsigned char *)avctx->extradata;
for (m = 0; m < avctx->extradata_size; m++) {
@@ -904,6 +895,16 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx)
#endif
}
}
+
+ s->width = avctx->width;
+ s->height = avctx->height;
+
+ if (MPV_common_init(s) < 0)
+ return -1;
+
+ h->b_stride = 4*s->mb_width;
+
+ ff_h264_alloc_tables(h);
}
return 0;
OpenPOWER on IntegriCloud