diff options
author | Ronald S. Bultje <rsbultje@gmail.com> | 2014-01-07 07:24:31 -0500 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2014-01-07 20:43:35 -0500 |
commit | 5b0fc078191138795e817244555741356f9d12e9 (patch) | |
tree | 0fb7b5fbaf52a8be32bd9bc5bc493378fc17afcc /libavcodec/vp9.c | |
parent | 04a187fb2ae2c14645c34e0e678f797af3ebb7a9 (diff) | |
download | ffmpeg-5b0fc078191138795e817244555741356f9d12e9.tar.gz |
vp9: reset contextual caches on frame size change with mt enabled.
Fixes crash/valgrind errors in trac ticket 3188 and hang in 3274.
Diffstat (limited to 'libavcodec/vp9.c')
-rw-r--r-- | libavcodec/vp9.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c index 78b8d2c23b..ca6795f169 100644 --- a/libavcodec/vp9.c +++ b/libavcodec/vp9.c @@ -3450,6 +3450,13 @@ static void adapt_probs(VP9Context *s) } } +static void free_buffers(VP9Context *s) +{ + av_freep(&s->above_partition_ctx); + av_freep(&s->b_base); + av_freep(&s->block_base); +} + static av_cold int vp9_decode_free(AVCodecContext *ctx) { VP9Context *s = ctx->priv_data; @@ -3468,11 +3475,9 @@ static av_cold int vp9_decode_free(AVCodecContext *ctx) ff_thread_release_buffer(ctx, &s->next_refs[i]); av_frame_free(&s->next_refs[i].f); } - av_freep(&s->above_partition_ctx); + free_buffers(s); av_freep(&s->c_b); s->c_b_size = 0; - av_freep(&s->b_base); - av_freep(&s->block_base); return 0; } @@ -3762,7 +3767,10 @@ static int vp9_decode_update_thread_context(AVCodecContext *dst, const AVCodecCo int i, res; VP9Context *s = dst->priv_data, *ssrc = src->priv_data; - // FIXME scalability, size, etc. + // detect size changes in other threads + if (s->above_partition_ctx && (s->cols != ssrc->cols || s->rows != ssrc->rows)) { + free_buffers(s); + } for (i = 0; i < 2; i++) { if (s->frames[i].tf.f->data[0]) |