aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2010-11-04 22:45:46 +0000
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2010-11-04 22:45:46 +0000
commit58b4e5407d05164f1874ffb32612237253411093 (patch)
tree762d00b8cd1896b19b1b0c7c841052543a18cd89
parente61bb0852fa53c40633f9330f4a4f62a101ae544 (diff)
downloadffmpeg-58b4e5407d05164f1874ffb32612237253411093.tar.gz
Fix FFv1 decoder buffer releasing.
Previously it was releasing the buffer which was returned to the user, which was resulting in a crash in case of direct rendering. Originally committed as revision 25678 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/ffv1.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c
index 813e41d6e3..9bc97e87f9 100644
--- a/libavcodec/ffv1.c
+++ b/libavcodec/ffv1.c
@@ -1274,6 +1274,9 @@ static av_cold int common_end(AVCodecContext *avctx){
FFV1Context *s = avctx->priv_data;
int i, j;
+ if (avctx->codec->decode && s->picture.data[0])
+ avctx->release_buffer(avctx, &s->picture);
+
for(j=0; j<s->slice_count; j++){
FFV1Context *fs= s->slice_context[j];
for(i=0; i<s->plane_count; i++){
@@ -1712,6 +1715,10 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
AVFrame *picture = data;
+ /* release previously stored data */
+ if (p->data[0])
+ avctx->release_buffer(avctx, p);
+
ff_init_range_decoder(c, buf, buf_size);
ff_build_rac_states(c, 0.05*(1LL<<32), 256-8);
@@ -1774,9 +1781,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
f->picture_number++;
*picture= *p;
-
- avctx->release_buffer(avctx, p); //FIXME
-
*data_size = sizeof(AVFrame);
return buf_size;