Skip to content

Fix filter graph memory leak #274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 27, 2016

Conversation

valnoel
Copy link
Member

@valnoel valnoel commented Jul 25, 2016

Each time we use the av_buffersink_get_frame function, we have to free the output AVFrame.

See the av_buffersink_get_frame documentation.

@coveralls
Copy link

coveralls commented Jul 25, 2016

Coverage Status

Coverage increased (+0.007%) to 77.022% when pulling 9c6ee8a on valnoel:fix_filtergraph_memory_leak into 6d4a2aa on avTranscoder:develop.

@cchampet
Copy link
Member

I thought it was done each time here ;


If this does not work, this intruction should be removed...
In which case you saw a memory leak ?

@@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a warning in the doc of the FilterGraph::process method about that ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, 6ab2b3c!

Valentin Noel added 2 commits July 26, 2016 14:03
@valnoel
Copy link
Member Author

valnoel commented Jul 26, 2016

Actually, this code is only executed if there is no filter to apply. The problem is that we have to free the AVFrame each time we apply the filter graph.

Without this clear, the memory usage grows all along the process until it is completely full. This appears on processing long medias (muxing audio channels extracted from movies, for instance).

@coveralls
Copy link

coveralls commented Jul 26, 2016

Coverage Status

Coverage increased (+0.007%) to 77.022% when pulling 14c730d on valnoel:fix_filtergraph_memory_leak into 6d4a2aa on avTranscoder:develop.

@cchampet
Copy link
Member

cchampet commented Jul 26, 2016

Ok great ! So this code at

is not necessary. Could you remove it, and after that this PR is ready to be meged i think :)

@valnoel
Copy link
Member Author

valnoel commented Jul 27, 2016

Yes, actually this code is necessary if no filter has been added to the FilterGraph.
Running the unit tests confirms it is really necessary! :)

@cchampet cchampet merged commit fde9230 into avTranscoder:develop Jul 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants