Repository navigation
obs-ffmpeg: Fix reconnection for SRT protocol and mpegts muxer & other bugfixes - #12165
Conversation
5f7da71 to
77a3365
Compare
|
If I use the pkt_size parameter in the SRT output streaming url to reduce packet size (because of reduced MTU in the path), OBS can't connect and display and error in popup telling me to look at log. 17:35:21.094: [obs-ffmpeg mpegts muxer: 'adv_stream']: Output format name and long_name: mpegts, MPEG-TS (MPEG-2 Transport Stream) |
|
If I start a stream to srt://:port?mode=listener or srt://0.0.0.0:port?mode=listener or 127.0.0.1:port?mode=listener, If I stream to srt://ip:port?mode=caller with a destination port that is not open on other side, OBS crash with segfault. Again, if I add pkt_size=1128 parameter in the srt url, OBS don't start the streaming and ask to look at log: When I open 2 srt in two media sources and when I re-apply the stream in one of them, both media source reset (like before the patch) but no reset on external player (ffplay) with the same url, its only in OBS. |
are you reporting this for current release or specifically for this PR ? if there's the same issue on master, then post a specific issue; if it works on master, but is broken in the PR, please provide details about your test setup |
you have to have a caller or it will not connect, so it keeps staying in the connecting state. This is not a bug, and won't be fixed.
did you test with the current PR ? if you did, give me details on your test setup.
we pass the pkt size to libsrt, so if you have an issue, i suspect it's on libsrt side; i would check with FFmpeg compiled with the exact same version of libsrt, in order to confirm where the issue dwells.
It is unacceptable to mix issues; this is not a general SRT fix thread but a PR. That issue you report is with Media Sources, not with SRT output. The current PR deals with outputting an SRT stream from OBS. |
All comments are for this PR.
For this PR and for master, the connection state remains suspended until a caller comes and holds the button. Its needed to set a timeout or something from libsrt to release the listener if no one calls.
Yes, it's with this PR and if there are no tests done with Linux then this PR is not viable for multi-platform.
You've never made a mistake or misunderstood anything in your life, that's unacceptable. |
|
@ogmkp i apologize for the harsh words but from a dev point of view, it's difficult when info is dumped and lacks enough context to make it actionable. Realize that the maintenance for srt is done in my free time on top of a regular job. I am not paid for it. |
|
No problem, most of us are volunteers and we do it with passion. Whether we're a developer or a power user. |
|
@ogmkp i could definitively add a log entry about the listener waiting for a connection. For a pop up that will have to be negotiated with our UI/UX people but yeah that's a good suggestion. |
3ba2ee8 to
766b7a9
Compare
|
@ogmkp managed to repro your pkt_size issue and fixed it. |
287c526 to
fc67008
Compare
|
|
0f6f2d8 to
55a09d8
Compare
|
Update |
RytoEX
left a comment
There was a problem hiding this comment.
Commit message nits:
- srt -> SRT
- whip -> WHIP
Nits.
The do_log function defined for the muxer expects that the struct is named stream rather than output. So rename output to stream. This also avoids confusion with stream->output which is an obs_output_t pointer. Signed-off-by: pkv <[email protected]>
This is the first part of a fix for reconnection issues with SRT protocol. This part implements the logic on the side of the protocol. The fixes are as follows: - a cleanup of return values of the various functions used. The main libsrt_open function returns OBS_OUTPUT_XXX enum members. But the other functions return now only AVERROR(xxx). - an explicit check of the socket state before returning OBS_OUTPUT_SUCCESS. This fixes an issue due to relying on socket non-blocking mode; in caller mode, the srt_connect function will return a success even before a connection has succeeded since it relies on notifications by srt_epoll_wait. This would prompt obs UI to display a successful reconnection in spite of a failure. Signed-off-by: pkv <[email protected]>
This reimplements the reconnect logic in mpegts muxer. Taking cues from the WHIP output, a start and stop thread is used, controlled by a mutex, ensuring the start and stop pipelines can never be run concurrently. Fixes bugs obsproject#11885, obsproject#11721, obsproject#11620, obsproject#11062, obsproject#12133. For better readibility, this commits also breaks the big set_config function into smaller units. Signed-off-by: pkv <[email protected]>
This fixes a crash when an invalid URL is used. Signed-off-by: pkv <[email protected]>
This updates a few OBS-OUTPUT-XXX to better reflect the output failures for the RIST protocol. Signed-off-by: pkv <[email protected]>
Signed-off-by: pkv <[email protected]>
This fixes a crash when using a pkt_size which is not the UDP default of 1316 Bytes ( 7 * 188 ). Signed-off-by: pkv <[email protected]>
Fixed |
Description
The mpegts output used with srt protocol has long been plagued by reconnection issues, leading to crashes.
This fixes (hopefully) the issue.
This also fixes the following bugs:
Motivation and Context
The reconnection logic proved difficult to implement for several reasons:
In order to fix the issue, we have:
multi-layered bools used in rtmp-stream.c.
This fixes:
#11062
#11620
#11721
#12133
#11885
How Has This Been Tested?
Used the clumsy app to simulate a complete network failure.
OBS detects correctly a network disconnection.
It triggers correctly the reconnect thread from obs-output.c.
The reconnects start.
After a few reconnects, upon reestablishment of the network, obs manages to reconnect.
Types of changes
Checklist: