stream.ffmpegmux: ign pipe write err on stream end #6558
Merged
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.
Don't log an error message when writing to the named pipe fails after the FFmpeg process has been terminated/killed.
Check if the substream has been closed or if the process does not exist anymore and then log the pipe-copy completion debug message.
Unfortunately, we don't have tests written for that. This is a race condition, depending on where the copy-to-pipe thread of each substream is currently at. If the next
stream.read()
call blocks and the result is an empty byte string due to the substream having been closed, then we log the completion message. But if some stream data has been read and it's being written to the named pipe while the FFmpeg process gets terminated/killed upon closing the stream, then we unintentionally log an error message. This needs to be fixed, because it's not an actual error.Therefore just check if the substream has already been closed or if the FFmpeg process is not alive anymore.
Btw, this is just a band-aid fix, but it should be fine for now...
master
PR (reliably reproducible)