UI: Add ability to forcibly stop streams/recordings
If the user hits the "stop stream" button it'll transition in to "stopping stream..." and will continue to output until the stream reaches the timing in which "stop" was pressed. However, if there is significant congestion, stopping the stream can take far longer than the user may like. So there needs to be an option to forcibly stop the stream in that case; pushing the "stop" button a second time should allow the user to tell the stream/recording to stop right away instead of waiting for the precise stop timing.
This commit is contained in:
parent
50d7cc8ae6
commit
5c5d0ba9e5
@ -179,9 +179,8 @@ struct SimpleOutput : BasicOutputHandler {
|
||||
|
||||
virtual bool StartStreaming(obs_service_t *service) override;
|
||||
virtual bool StartRecording() override;
|
||||
virtual void StopStreaming() override;
|
||||
virtual void ForceStopStreaming() override;
|
||||
virtual void StopRecording() override;
|
||||
virtual void StopStreaming(bool force) override;
|
||||
virtual void StopRecording(bool force) override;
|
||||
virtual bool StreamingActive() const override;
|
||||
virtual bool RecordingActive() const override;
|
||||
};
|
||||
@ -650,19 +649,20 @@ bool SimpleOutput::StartRecording()
|
||||
return false;
|
||||
}
|
||||
|
||||
void SimpleOutput::StopStreaming()
|
||||
void SimpleOutput::StopStreaming(bool force)
|
||||
{
|
||||
obs_output_stop(streamOutput);
|
||||
if (force)
|
||||
obs_output_force_stop(streamOutput);
|
||||
else
|
||||
obs_output_stop(streamOutput);
|
||||
}
|
||||
|
||||
void SimpleOutput::ForceStopStreaming()
|
||||
void SimpleOutput::StopRecording(bool force)
|
||||
{
|
||||
obs_output_force_stop(streamOutput);
|
||||
}
|
||||
|
||||
void SimpleOutput::StopRecording()
|
||||
{
|
||||
obs_output_stop(fileOutput);
|
||||
if (force)
|
||||
obs_output_force_stop(fileOutput);
|
||||
else
|
||||
obs_output_stop(fileOutput);
|
||||
}
|
||||
|
||||
bool SimpleOutput::StreamingActive() const
|
||||
@ -703,9 +703,8 @@ struct AdvancedOutput : BasicOutputHandler {
|
||||
|
||||
virtual bool StartStreaming(obs_service_t *service) override;
|
||||
virtual bool StartRecording() override;
|
||||
virtual void StopStreaming() override;
|
||||
virtual void ForceStopStreaming() override;
|
||||
virtual void StopRecording() override;
|
||||
virtual void StopStreaming(bool force) override;
|
||||
virtual void StopRecording(bool force) override;
|
||||
virtual bool StreamingActive() const override;
|
||||
virtual bool RecordingActive() const override;
|
||||
};
|
||||
@ -1193,19 +1192,20 @@ bool AdvancedOutput::StartRecording()
|
||||
return false;
|
||||
}
|
||||
|
||||
void AdvancedOutput::StopStreaming()
|
||||
void AdvancedOutput::StopStreaming(bool force)
|
||||
{
|
||||
obs_output_stop(streamOutput);
|
||||
if (force)
|
||||
obs_output_force_stop(streamOutput);
|
||||
else
|
||||
obs_output_stop(streamOutput);
|
||||
}
|
||||
|
||||
void AdvancedOutput::ForceStopStreaming()
|
||||
void AdvancedOutput::StopRecording(bool force)
|
||||
{
|
||||
obs_output_force_stop(streamOutput);
|
||||
}
|
||||
|
||||
void AdvancedOutput::StopRecording()
|
||||
{
|
||||
obs_output_stop(fileOutput);
|
||||
if (force)
|
||||
obs_output_force_stop(fileOutput);
|
||||
else
|
||||
obs_output_stop(fileOutput);
|
||||
}
|
||||
|
||||
bool AdvancedOutput::StreamingActive() const
|
||||
|
@ -24,9 +24,8 @@ struct BasicOutputHandler {
|
||||
|
||||
virtual bool StartStreaming(obs_service_t *service) = 0;
|
||||
virtual bool StartRecording() = 0;
|
||||
virtual void StopStreaming() = 0;
|
||||
virtual void ForceStopStreaming() = 0;
|
||||
virtual void StopRecording() = 0;
|
||||
virtual void StopStreaming(bool force = false) = 0;
|
||||
virtual void StopRecording(bool force = false) = 0;
|
||||
virtual bool StreamingActive() const = 0;
|
||||
virtual bool RecordingActive() const = 0;
|
||||
|
||||
|
@ -3642,7 +3642,7 @@ void OBSBasic::StopStreaming()
|
||||
SaveProject();
|
||||
|
||||
if (outputHandler->StreamingActive())
|
||||
outputHandler->StopStreaming();
|
||||
outputHandler->StopStreaming(streamingStopping);
|
||||
|
||||
OnDeactivate();
|
||||
|
||||
@ -3659,7 +3659,7 @@ void OBSBasic::ForceStopStreaming()
|
||||
SaveProject();
|
||||
|
||||
if (outputHandler->StreamingActive())
|
||||
outputHandler->ForceStopStreaming();
|
||||
outputHandler->StopStreaming(true);
|
||||
|
||||
OnDeactivate();
|
||||
|
||||
@ -3734,6 +3734,7 @@ void OBSBasic::StreamStopping()
|
||||
ui->streamButton->setText(QTStr("Basic.Main.StoppingStreaming"));
|
||||
sysTrayStream->setText(ui->streamButton->text());
|
||||
|
||||
streamingStopping = true;
|
||||
if (api)
|
||||
api->on_event(OBS_FRONTEND_EVENT_STREAMING_STOPPING);
|
||||
}
|
||||
@ -3773,6 +3774,7 @@ void OBSBasic::StreamingStop(int code)
|
||||
sysTrayStream->setText(ui->streamButton->text());
|
||||
sysTrayStream->setEnabled(true);
|
||||
|
||||
streamingStopping = false;
|
||||
if (api)
|
||||
api->on_event(OBS_FRONTEND_EVENT_STREAMING_STOPPED);
|
||||
|
||||
@ -3812,6 +3814,7 @@ void OBSBasic::RecordStopping()
|
||||
ui->recordButton->setText(QTStr("Basic.Main.StoppingRecording"));
|
||||
sysTrayRecord->setText(ui->recordButton->text());
|
||||
|
||||
recordingStopping = true;
|
||||
if (api)
|
||||
api->on_event(OBS_FRONTEND_EVENT_RECORDING_STOPPING);
|
||||
}
|
||||
@ -3821,7 +3824,7 @@ void OBSBasic::StopRecording()
|
||||
SaveProject();
|
||||
|
||||
if (outputHandler->RecordingActive())
|
||||
outputHandler->StopRecording();
|
||||
outputHandler->StopRecording(recordingStopping);
|
||||
|
||||
OnDeactivate();
|
||||
}
|
||||
@ -3832,6 +3835,7 @@ void OBSBasic::RecordingStart()
|
||||
ui->recordButton->setText(QTStr("Basic.Main.StopRecording"));
|
||||
sysTrayRecord->setText(ui->recordButton->text());
|
||||
|
||||
recordingStopping = false;
|
||||
if (api)
|
||||
api->on_event(OBS_FRONTEND_EVENT_RECORDING_STARTED);
|
||||
|
||||
|
@ -120,6 +120,8 @@ private:
|
||||
|
||||
OBSService service;
|
||||
std::unique_ptr<BasicOutputHandler> outputHandler;
|
||||
bool streamingStopping = false;
|
||||
bool recordingStopping = false;
|
||||
|
||||
gs_vertbuffer_t *box = nullptr;
|
||||
gs_vertbuffer_t *boxLeft = nullptr;
|
||||
|
Loading…
x
Reference in New Issue
Block a user