From 9c6ee8aa83b29f76f1e056834c9892b796cd4df8 Mon Sep 17 00:00:00 2001 From: Valentin Noel Date: Mon, 25 Jul 2016 17:45:20 +0200 Subject: [PATCH 1/3] StreamTranscoder: unref the filtergraph output AVFrame after it has been converted --- src/AvTranscoder/transcoder/StreamTranscoder.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/AvTranscoder/transcoder/StreamTranscoder.cpp b/src/AvTranscoder/transcoder/StreamTranscoder.cpp index 9b72ec49..a6fa9604 100644 --- a/src/AvTranscoder/transcoder/StreamTranscoder.cpp +++ b/src/AvTranscoder/transcoder/StreamTranscoder.cpp @@ -550,6 +550,10 @@ bool StreamTranscoder::processTranscode() LOG_DEBUG("Convert") _transform->convert(*_filteredData, *_transformedData); + // free the filtered AVFrame now it has been converted into another one + // @see the av_buffersink_get_frame documentation + av_frame_unref(&_filteredData->getAVFrame()); + LOG_DEBUG("Encode") _outputEncoder->encodeFrame(*_transformedData, data); } From 6ab2b3cab151822712c61d7e390354d8cb2fb213 Mon Sep 17 00:00:00 2001 From: Valentin Noel Date: Tue, 26 Jul 2016 14:03:28 +0200 Subject: [PATCH 2/3] FilterGraph: adds a warning into the process() method documentation --- src/AvTranscoder/filter/FilterGraph.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/AvTranscoder/filter/FilterGraph.hpp b/src/AvTranscoder/filter/FilterGraph.hpp index 4ae9274c..86a5ea4c 100644 --- a/src/AvTranscoder/filter/FilterGraph.hpp +++ b/src/AvTranscoder/filter/FilterGraph.hpp @@ -52,6 +52,8 @@ class AvExport FilterGraph * filter 1 -> filter 2 -> output * | * input 2 ---| + * @warning the output frame must be cleared once it has been used + * @see the av_buffersink_get_frame function documentation */ void process(const std::vector& inputs, Frame& output); From 14c730d7c857deaee70afd1f6a111c51667c89a5 Mon Sep 17 00:00:00 2001 From: Valentin Noel Date: Tue, 26 Jul 2016 14:05:07 +0200 Subject: [PATCH 3/3] StreamTranscoder: calls the Frame clear() method instead of calling directly the av_frame_unref function And removes redundant documentation --- src/AvTranscoder/transcoder/StreamTranscoder.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/AvTranscoder/transcoder/StreamTranscoder.cpp b/src/AvTranscoder/transcoder/StreamTranscoder.cpp index a6fa9604..25a63d1b 100644 --- a/src/AvTranscoder/transcoder/StreamTranscoder.cpp +++ b/src/AvTranscoder/transcoder/StreamTranscoder.cpp @@ -550,9 +550,7 @@ bool StreamTranscoder::processTranscode() LOG_DEBUG("Convert") _transform->convert(*_filteredData, *_transformedData); - // free the filtered AVFrame now it has been converted into another one - // @see the av_buffersink_get_frame documentation - av_frame_unref(&_filteredData->getAVFrame()); + _filteredData->clear(); LOG_DEBUG("Encode") _outputEncoder->encodeFrame(*_transformedData, data);