From 8ea9b12b5eb64cd6503c2612bbc8a0400dbffd3e Mon Sep 17 00:00:00 2001 From: Jonathan Thomas Date: Sun, 31 Jul 2016 15:15:48 -0500 Subject: [PATCH] Small change to memory allocation in FFmpegWriter, to be consistent between different versions of FFmpeg/LibAV --- src/FFmpegWriter.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/FFmpegWriter.cpp b/src/FFmpegWriter.cpp index e3a47635..c9314881 100644 --- a/src/FFmpegWriter.cpp +++ b/src/FFmpegWriter.cpp @@ -576,7 +576,6 @@ void FFmpegWriter::flush_encoders() // Encode Picture and Write Frame int video_outbuf_size = 0; - //video_outbuf = new uint8_t[200000]; /* encode the image */ int out_size = avcodec_encode_video(video_codec, NULL, video_outbuf_size, NULL); @@ -621,7 +620,7 @@ void FFmpegWriter::flush_encoders() // Deallocate memory (if needed) if (video_outbuf) - delete[] video_outbuf; + av_freep(&video_outbuf); } // FLUSH AUDIO ENCODER @@ -1513,7 +1512,7 @@ bool FFmpegWriter::write_video_packet(tr1::shared_ptr frame, AVFrame* fra // Encode Picture and Write Frame int video_outbuf_size = 200000; - video_outbuf = new uint8_t[200000]; + video_outbuf = (uint8_t*) av_malloc(200000); /* encode the image */ int out_size = avcodec_encode_video(video_codec, video_outbuf, video_outbuf_size, frame_final);