mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-05-18 13:33:27 -04:00
frontend: Allow 5 multitrack reconnect attempts before re-running GCC
This commit is contained in:
committed by
Ryan Foster
parent
6204c22853
commit
e474a3723b
@@ -26,6 +26,9 @@ static const char *hevc_main = "Main";
|
||||
static const char *hevc_main10 = "Main 10";
|
||||
static const char *av1_main = "Main";
|
||||
|
||||
// Maximum reconnect attempts with an invalid key error before giving up (roughly 30 seconds with default start value)
|
||||
static constexpr uint8_t MAX_RECONNECT_ATTEMPTS = 5;
|
||||
|
||||
Qt::ConnectionType BlockingConnectionTypeFor(QObject *object)
|
||||
{
|
||||
return object->thread() == QThread::currentThread() ? Qt::DirectConnection : Qt::BlockingQueuedConnection;
|
||||
@@ -474,10 +477,11 @@ void MultitrackVideoOutput::PrepareStreaming(
|
||||
obs_output_add_packet_callback(output, bpm_inject, NULL);
|
||||
|
||||
// Set callback to prevent reconnection attempts once the stream key has become invalid
|
||||
static auto reconnect_cb = [](void *, obs_output_t *, int code) -> bool {
|
||||
return code != OBS_OUTPUT_INVALID_STREAM;
|
||||
static auto reconnect_cb = [](void *param, obs_output_t *, int code) -> bool {
|
||||
auto _this = static_cast<MultitrackVideoOutput *>(param);
|
||||
return code != OBS_OUTPUT_INVALID_STREAM || (_this->reconnect_attempts++ < MAX_RECONNECT_ATTEMPTS);
|
||||
};
|
||||
obs_output_set_reconnect_callback(output, reconnect_cb, nullptr);
|
||||
obs_output_set_reconnect_callback(output, reconnect_cb, this);
|
||||
|
||||
OBSSignal start_streaming;
|
||||
OBSSignal stop_streaming;
|
||||
@@ -893,6 +897,7 @@ void StreamStartHandler(void *arg, calldata_t *)
|
||||
{
|
||||
auto self = static_cast<MultitrackVideoOutput *>(arg);
|
||||
self->restart_on_error = true;
|
||||
self->reconnect_attempts = 0;
|
||||
}
|
||||
|
||||
void StreamStopHandler(void *arg, calldata_t *data)
|
||||
|
||||
Reference in New Issue
Block a user