fixing segfault: libavcodec doesn't allocate some buffers if avctx->thread_count == 0

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@11962 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
rik 2004-02-16 14:41:42 +00:00
parent 233db62d72
commit d8e6384a05
2 changed files with 6 additions and 0 deletions

View File

@ -360,6 +360,9 @@ static jpeg_enc_t *jpeg_enc_init(int w, int h, int y_psize, int y_rsize,
/* alloc bogus avctx to keep MPV_common_init from segfaulting */
j->s->avctx = calloc(sizeof(*j->s->avctx), 1);
/* make MPV_common_init allocate important buffers, like s->block */
j->s->avctx->thread_count = 1;
if (MPV_common_init(j->s) < 0) {
free(j->s);
free(j);

View File

@ -352,6 +352,9 @@ jpeg_enc_t *jpeg_enc_init(int w, int h, int y_psize, int y_rsize,
/* alloc bogus avctx to keep MPV_common_init from segfaulting */
j->s->avctx = calloc(sizeof(*j->s->avctx), 1);
/* make MPV_common_init allocate important buffers, like s->block */
j->s->avctx->thread_count = 1;
if (MPV_common_init(j->s) < 0) {
av_free(j->s);
av_free(j);