From dceecebd37d5e1b5c098ad1358310d3f276c703c Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 10 Dec 2018 01:16:16 +0000 Subject: [PATCH 1/1] Add a couple of missing deallocation calls and fix a warning with current FFmpeg (returning AVERROR_EOF rather than 0 when a AVIO source is finished). --- src/lib/ffmpeg_image_proxy.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib/ffmpeg_image_proxy.cc b/src/lib/ffmpeg_image_proxy.cc index e38b80be1..46c9836e0 100644 --- a/src/lib/ffmpeg_image_proxy.cc +++ b/src/lib/ffmpeg_image_proxy.cc @@ -84,6 +84,9 @@ int FFmpegImageProxy::avio_read (uint8_t* buffer, int const amount) { int const to_do = min(int64_t(amount), _data.size() - _pos); + if (to_do == 0) { + return AVERROR_EOF; + } memcpy (buffer, _data.data().get() + _pos, to_do); _pos += to_do; return to_do; @@ -167,7 +170,9 @@ FFmpegImageProxy::image (optional) const _image.reset (new Image (frame)); + av_packet_unref (&packet); av_frame_free (&frame); + avcodec_close (codec_context); avformat_close_input (&format_context); av_free (avio_context->buffer); av_free (avio_context); -- 2.30.2