diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-03-18 09:50:06 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-03-18 09:50:06 +0300 |
commit | cc12fc1f118c0921cd399a25456ea44a9f330bc2 (patch) | |
tree | 975bba6eaa838d4d75f739a43cdc1eed60b7e061 /source/blender/imbuf/intern | |
parent | 9777c5b0cafaaffb8ef224465785081f60efa2f8 (diff) |
Fix T47806: Blender animation player stop working correctly with XVID codec
Something weird, seems some buffers _might_ be shared between codec context
and frame, which is quite weird. Could be a bug in FFmpeg or could be wrong
API usage somewhere else..
Diffstat (limited to 'source/blender/imbuf/intern')
-rw-r--r-- | source/blender/imbuf/intern/anim_movie.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index 763ec121688..d378ca9a78c 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -1168,6 +1168,15 @@ static void free_anim_ffmpeg(struct anim *anim) if (anim->pCodecCtx) { avcodec_close(anim->pCodecCtx); avformat_close_input(&anim->pFormatCtx); + + /* Special case here: pFrame could share pointers with codec, + * so in order to avoid double-free we don't use av_frame_free() + * to free the frame. + * + * Could it be a bug in FFmpeg? + */ + av_free(anim->pFrame); + if (!need_aligned_ffmpeg_buffer(anim)) { /* If there's no need for own aligned buffer it means that FFmpeg's * frame shares the same buffer as temporary ImBuf. In this case we @@ -1179,8 +1188,8 @@ static void free_anim_ffmpeg(struct anim *anim) anim->x, anim->y); } av_frame_free(&anim->pFrameRGB); - av_frame_free(&anim->pFrame); av_frame_free(&anim->pFrameDeinterlaced); + sws_freeContext(anim->img_convert_ctx); IMB_freeImBuf(anim->last_frame); if (anim->next_packet.stream_index != -1) { |