| OLD | NEW |
| (Empty) | |
| 1 diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c |
| 2 index c3dff7f..d853df6 100644 |
| 3 --- a/libavcodec/vp3.c |
| 4 +++ b/libavcodec/vp3.c |
| 5 @@ -1906,7 +1906,7 @@ static int vp3_decode_frame(AVCodecContext *avctx, |
| 6 } else { |
| 7 if (!s->golden_frame.data[0]) { |
| 8 av_log(s->avctx, AV_LOG_WARNING, "vp3: first frame not a keyframe\n
"); |
| 9 - |
| 10 + return -1; |
| 11 s->golden_frame.reference = 3; |
| 12 s->golden_frame.pict_type = AV_PICTURE_TYPE_I; |
| 13 if (ff_thread_get_buffer(avctx, &s->golden_frame) < 0) { |
| 14 @@ -2321,6 +2321,26 @@ static av_cold int theora_decode_init(AVCodecContext *avc
tx) |
| 15 return vp3_decode_init(avctx); |
| 16 } |
| 17 |
| 18 +static void vp3_decode_flush(AVCodecContext *avctx) |
| 19 +{ |
| 20 + Vp3DecodeContext *s = avctx->priv_data; |
| 21 + |
| 22 + if (s->golden_frame.data[0]) { |
| 23 + if (s->golden_frame.data[0] == s->last_frame.data[0]) |
| 24 + memset(&s->last_frame, 0, sizeof(AVFrame)); |
| 25 + if (s->current_frame.data[0] == s->golden_frame.data[0]) |
| 26 + memset(&s->current_frame, 0, sizeof(AVFrame)); |
| 27 + ff_thread_release_buffer(avctx, &s->golden_frame); |
| 28 + } |
| 29 + if (s->last_frame.data[0]) { |
| 30 + if (s->current_frame.data[0] == s->last_frame.data[0]) |
| 31 + memset(&s->current_frame, 0, sizeof(AVFrame)); |
| 32 + ff_thread_release_buffer(avctx, &s->last_frame); |
| 33 + } |
| 34 + if (s->current_frame.data[0]) |
| 35 + ff_thread_release_buffer(avctx, &s->current_frame); |
| 36 +} |
| 37 + |
| 38 AVCodec ff_theora_decoder = { |
| 39 "theora", |
| 40 AVMEDIA_TYPE_VIDEO, |
| 41 @@ -2332,6 +2352,7 @@ AVCodec ff_theora_decoder = { |
| 42 vp3_decode_frame, |
| 43 CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_FRAME_THREADS, |
| 44 NULL, |
| 45 + .flush = vp3_decode_flush, |
| 46 .long_name = NULL_IF_CONFIG_SMALL("Theora"), |
| 47 .update_thread_context = ONLY_IF_THREADS_ENABLED(vp3_update_thread_context) |
| 48 }; |
| 49 @@ -2348,6 +2369,7 @@ AVCodec ff_vp3_decoder = { |
| 50 vp3_decode_frame, |
| 51 CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_FRAME_THREADS, |
| 52 NULL, |
| 53 + .flush = vp3_decode_flush, |
| 54 .long_name = NULL_IF_CONFIG_SMALL("On2 VP3"), |
| 55 .update_thread_context = ONLY_IF_THREADS_ENABLED(vp3_update_thread_context) |
| 56 }; |
| OLD | NEW |