-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
bugfix memory leaks #2214
bugfix memory leaks #2214
Conversation
avformat_close_input() already gets called when inputStream == null. This line only gets reached when inputStream != null. In that case, oc is allocated using avformat_alloc_context(), and according to the documentation of that, it should be released with avformat_free_context(), not avformat_close_input(): Could you try to ask upstream about this? If this is an error in the documentation, let's get that fixed first. |
code is like this InputStream inputStream = new ByteArrayInputStream(slice);
try (FFmpegFrameGrabber ff = new FFmpegFrameGrabber(inputStream)){
...
} but i found didn't execute if (inputStream == null && oc != null && !oc.isNull()) {
avformat_close_input(oc);
oc = null;
} should i set inputStream null and call |
In your case, avformat_free_context() should get called, so that's correct. We don't need to call avformat_close_input(). |
The stream must be closed with avformat_close_input().
|
When input_stream != null, avformat_open_input() is not called, so we cannot call avformat_close_input(). |
Isn't this a call to avformat_open_input() when input_stream != null? |
I see. What happens if we don't call avformat_open_input() there? |
|
This is the solution for the issue #2119
When release AVFormatContext use avformat_close_input instead of avformat_free_context.