The initial implementation in 4e528206 failed to synchronise the threads at all, so it died horribly when they are enabled. This introduces the necessary serialisation to the decode operations.
Thanks to Jun Zhao <[email protected]> for noting this issue. --- libavcodec/vp8.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index bf1b03e..139ef2b 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -2549,7 +2549,7 @@ int vp78_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, // release no longer referenced frames for (i = 0; i < 5; i++) - if (s->frames[i].tf.f->data[0] && + if (s->frames[i].tf.f->buf[0] && &s->frames[i] != prev_frame && &s->frames[i] != s->framep[VP56_FRAME_PREVIOUS] && &s->frames[i] != s->framep[VP56_FRAME_GOLDEN] && @@ -2607,6 +2607,12 @@ int vp78_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, ff_thread_finish_setup(avctx); if (avctx->hwaccel) { + // When using a hwaccel, the previous thread must have fully issued + // all of its decode operations before we can start (though it need + // not actually have finished and output anything). + if (prev_frame) + ff_thread_await_progress(&prev_frame->tf, INT_MAX, 0); + ret = avctx->hwaccel->start_frame(avctx, avpkt->data, avpkt->size); if (ret < 0) goto err; @@ -2802,13 +2808,14 @@ static int vp8_decode_update_thread_context(AVCodecContext *dst, s->mb_height = s_src->mb_height; } + s->pix_fmt = s_src->pix_fmt; s->prob[0] = s_src->prob[!s_src->update_probabilities]; s->segmentation = s_src->segmentation; s->lf_delta = s_src->lf_delta; memcpy(s->sign_bias, s_src->sign_bias, sizeof(s->sign_bias)); for (i = 0; i < FF_ARRAY_ELEMS(s_src->frames); i++) { - if (s_src->frames[i].tf.f->data[0]) { + if (s_src->frames[i].tf.f->buf[0]) { int ret = vp8_ref_frame(s, &s->frames[i], &s_src->frames[i]); if (ret < 0) return ret; -- 2.10.2 _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
