mirror of https://github.com/mpv-player/mpv
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:
parent
233db62d72
commit
d8e6384a05
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue