Repository navigation
Close and free the RTMP sink output context even when writing the trailer fails - #134
Merged
Merged
Conversation
varsill
commented
Nov 5, 2026
Return an error from every NIF entry point once the output context is freed, refuse to write frames before the FLV header exists, and raise instead of handing FFmpeg a NULL connection when the header or trailer would be written before try_connect. Based on #132.
A NULL output context already means the stream is closed.
…osed or unconnected RTMP sink
mat-hek
removed their request for review
November 9, 2026 12:50
mat-hek
approved these changes
Nov 9, 2026
| int trailer_err = av_write_trailer(state->output_ctx); | ||
| close_output(state); | ||
| if (trailer_err) { | ||
| return unifex_raise(env, "Failed writing stream trailer"); |
Member
There was a problem hiding this comment.
since you changed all raises to returned errors, maybe change this place too?
Contributor
Author
There was a problem hiding this comment.
I missed this one, thanks for spotting 👍
… fails, and warn in the element
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR:
context is freed even when writing the stream trailer fails (which happens in case of
"Broken Pipe" errors)
changes from Guard RTMP sink NIFs against closed or unready streams #132)
init_*_stream, so a failedcall does not change the state
output_ctx(i.e.output_ctxis NULLonly when the stream is closed)
is_ready, eachinit_*_streamchecks the other stream directly