mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-06-04 05:57:49 +02:00
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.
This commit is contained in:
parent
21bbca5b44
commit
cdca7c378e
@ -804,20 +804,11 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx)
|
|||||||
avctx->pix_fmt = avctx->codec->pix_fmts[0];
|
avctx->pix_fmt = avctx->codec->pix_fmts[0];
|
||||||
|
|
||||||
if (!s->context_initialized) {
|
if (!s->context_initialized) {
|
||||||
s->width = avctx->width;
|
|
||||||
s->height = avctx->height;
|
|
||||||
h->halfpel_flag = 1;
|
h->halfpel_flag = 1;
|
||||||
h->thirdpel_flag = 1;
|
h->thirdpel_flag = 1;
|
||||||
h->unknown_svq3_flag = 0;
|
h->unknown_svq3_flag = 0;
|
||||||
h->chroma_qp[0] = h->chroma_qp[1] = 4;
|
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 */
|
/* prowl for the "SEQH" marker in the extradata */
|
||||||
extradata = (unsigned char *)avctx->extradata;
|
extradata = (unsigned char *)avctx->extradata;
|
||||||
for (m = 0; m < avctx->extradata_size; m++) {
|
for (m = 0; m < avctx->extradata_size; m++) {
|
||||||
@ -904,6 +895,16 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx)
|
|||||||
#endif
|
#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;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user