Hi
@hanatyan, Thanks for your continued support and development work on Branch Output, it's been great so far!
I found what I believe to be a bug on MacOS.
Specs
M4 Mac mini
OS: Sequoia 15.3.1
OBS: 31.0.2
BranchOut Version: 1.0.3 & 1.0.4
OBS Studio Advanced Settings:
- Automatically Reconnect:
- Enabled
- Retry Delay 10s
- Maximum Retries 100
The issue
When connected to the network, a stream can be started and stopped successfully.
However, when a stream is running and the network connection gets interrupted for longer than a few seconds, OBS will crash completely and not adhere to OBS's reconnection mechanic.
It appears to stack reconnect attempts very closely together (or at least that's what the log makes me think) and then after 10 tries or so it crashes. If the network connection remains down and OBS is started again, the stream automatically tries to connect (great) However it will crash again after a few seconds due to the same issue. At this point, a regular user cannot turn off the stream from auto starting (I ended up going to the plugin config folder and changing some parameters there).
OBS' build in streaming function does not show the same behavior and tries to reconnect normally under the same conditions.
How to reproduce
1. Start a branch out stream with a remote destination (can be LAN or WAN) in OBS on a Mac (I have not tested Windows).
2. Once the stream is running, turn off wifi or ethernet NIC, after 4 to 5 seconds OBS Studio will crash.
3. Starting OBS Studio again without a network connection will continue to crash OBS until wifi or ethernet is re-enabled.
I have also tested this by disabling the internet on my router, which produces the same fault.
LOGS
Code:
12:15:40.412: [obs-ffmpeg mpegts muxer / libsrt]: RTT [3.08 ms], Link Bandwidth [3575.9 Mbps]
12:16:11.365: [obs-ffmpeg mpegts muxer / libsrt]: Connection rejected, Unknown or erroneous
12:16:11.365: process_packet: Error writing packet: Input/output error
12:16:11.365: Output 'test-stream': stopping
12:16:11.365: Output 'test-stream': Total frames output: 2257
12:16:11.365: Output 'test-stream': Total drawn frames: 2274
12:16:11.365: Output 'test-stream': Reconnecting in 1.00 seconds..
12:16:11.372: Qavg: 65526.422
12:16:11.372:
12:16:11.372: 2 frames left in the queue on closing
12:16:11.372:
12:16:12.371: [obs-ffmpeg mpegts muxer: 'test-stream']: Output format name and long_name: mpegts, MPEG-TS (MPEG-2 Transport Stream)
12:16:12.371: [obs-ffmpeg mpegts muxer / libsrt]: libsrt version 1.5.2 loaded
12:16:12.482: [obs-ffmpeg mpegts muxer / libsrt]: Connection rejected, Unknown or erroneous
12:16:12.594: [obs-ffmpeg mpegts muxer / libsrt]: Connection rejected, Unknown or erroneous
12:16:12.704: [obs-ffmpeg mpegts muxer / libsrt]: Connection rejected, Unknown or erroneous
12:16:12.813: [obs-ffmpeg mpegts muxer / libsrt]: Connection rejected, Unknown or erroneous
12:16:12.915: [obs-ffmpeg mpegts muxer / libsrt]: Connection rejected, Unknown or erroneous
12:16:13.023: [obs-ffmpeg mpegts muxer / libsrt]: Connection rejected, Unknown or erroneous
12:16:13.131: [obs-ffmpeg mpegts muxer / libsrt]: Connection rejected, Unknown or erroneous
12:16:13.240: [obs-ffmpeg mpegts muxer / libsrt]: Connection rejected, Unknown or erroneous
12:16:13.347: [obs-ffmpeg mpegts muxer / libsrt]: Connection rejected, Unknown or erroneous
12:16:13.456: [obs-ffmpeg mpegts muxer / libsrt]: Connection rejected, Unknown or erroneous
12:16:13.568: [obs-ffmpeg mpegts muxer / libsrt]: Connection rejected, Unknown or erroneous
12:16:13.673: [obs-ffmpeg mpegts muxer / libsrt]: Connection rejected, Unknown or erroneous
12:16:13.780: [obs-ffmpeg mpegts muxer / libsrt]: Connection rejected, Unknown or erroneous
12:16:13.889: [obs-ffmpeg mpegts muxer / libsrt]: Connection rejected, Unknown or erroneous
12:16:13.999: [obs-ffmpeg mpegts muxer / libsrt]: Connection rejected, Unknown or erroneous
12:16:14.106: [obs-ffmpeg mpegts muxer / libsrt]: Connection rejected, Unknown or erroneous
12:16:14.212: [obs-ffmpeg mpegts muxer / libsrt]: Connection rejected, Unknown or erroneous
12:16:14.320: [obs-ffmpeg mpegts muxer / libsrt]: Connection rejected, Unknown or erroneous
12:16:14.427: [obs-ffmpeg mpegts muxer / libsrt]: Connection rejected, Unknown or erroneous
12:16:14.534: [obs-ffmpeg mpegts muxer / libsrt]: Connection rejected, Unknown or erroneous
12:16:14.634: [obs-ffmpeg mpegts muxer / libsrt]: Connection rejected, Unknown or erroneous
12:16:14.734: [obs-ffmpeg mpegts muxer / libsrt]: Connection rejected, Unknown or erroneous
12:16:14.840: [obs-ffmpeg mpegts muxer / libsrt]: Connection rejected, Unknown or erroneous
12:16:14.946: [obs-ffmpeg mpegts muxer / libsrt]: Connection rejected, Unknown or erroneous
12:16:15.055: [obs-ffmpeg mpegts muxer / libsrt]: Connection rejected, Unknown or erroneous
12:16:15.165: [obs-ffmpeg mpegts muxer / libsrt]: Connection rejected, Unknown or erroneous
12:16:15.276: [obs-ffmpeg mpegts muxer / libsrt]: Connection rejected, Unknown or erroneous
12:16:15.385: [obs-ffmpeg mpegts muxer / libsrt]: Connection rejected, wrong password or invalid URL
12:16:15.385: [obs-ffmpeg mpegts muxer / libsrt]: Connection to srt://<IP removed>:<Port removed>?streamid=publish:test-stream&pkt_size=1316 failed: No such process
12:16:15.385: [obs-ffmpeg mpegts muxer: 'test-stream']: Failed to open the url or invalid stream
12:16:15.385: [obs-ffmpeg mpegts muxer: 'test-stream']: Failed to open the url
It appears to reconnect very quickly every 200ms for a few seconds and then gives up and crashes.
EDIT: It appears it is currently hardcoded in branch output:
Code:
src/plugin-main.cpp
#define FILTER_ID "osi_branch_output"
#define OUTPUT_MAX_RETRIES 7
#define OUTPUT_RETRY_DELAY_SECS 1
#define CONNECT_ATTEMPTING_TIMEOUT_NS 15000000000ULL
#define AVAILAVILITY_CHECK_INTERVAL_NS 1000000000ULL
#define TASK_INTERVAL_MS 1000
Interestingly, the log line
Code:
void BranchOutputFilter::reconnectStreamingOutput(size_t index)
{
pthread_mutex_lock(&outputMutex);
{
OBSMutexAutoUnlock locked(&outputMutex);
if (streamings[index].active) {
obs_output_force_stop(streamings[index].output);
streamings[index].connectAttemptingAt = os_gettime_ns();
if (!obs_output_start(streamings[index].output)) {
obs_log(LOG_ERROR, "%s: Reconnect streaming %zu output failed", qUtf8Printable(name), index);
}
}
}
}
Does not appear to show up in my logs.
/END EDIT
Solution/How it should be working
- At a minimum implementation level, the plugin should not crash when a prolonged network outage happens.
- At a basic implementation level, it should follow OBS's build-in Automatic retry logic. If it exceeds this user defined settings, it should stop trying (or perhaps disable the filter).
- In an ideal implementation level, it would have user definable retry logic fields in the filter options.
Let me know if you want me to provide any more information, My use case is always running in harsh, network unstable environments (Cellular, Satcoms, etc) making it a fairly big issue.
Thanks again