UI: Don't use activeRefs to determine if active
Due to certain design changes for delay, it's better to simply determine whether outputs are active via booleans rather than an activeRefs variable, which could get decremented more than once if say, the signal for stopping the stream gets called more than once for whatever reason (which may happen in the case of delay due to the way delay works)master
parent
a508c17f0a
commit
2ebb6e60ce
|
@ -9,8 +9,8 @@ using namespace std;
|
|||
static void OBSStartStreaming(void *data, calldata_t *params)
|
||||
{
|
||||
BasicOutputHandler *output = static_cast<BasicOutputHandler*>(data);
|
||||
output->streamingActive = true;
|
||||
QMetaObject::invokeMethod(output->main, "StreamingStart");
|
||||
output->activeRefs++;
|
||||
|
||||
UNUSED_PARAMETER(params);
|
||||
}
|
||||
|
@ -20,17 +20,17 @@ static void OBSStopStreaming(void *data, calldata_t *params)
|
|||
BasicOutputHandler *output = static_cast<BasicOutputHandler*>(data);
|
||||
int code = (int)calldata_int(params, "code");
|
||||
|
||||
output->streamingActive = false;
|
||||
QMetaObject::invokeMethod(output->main,
|
||||
"StreamingStop", Q_ARG(int, code));
|
||||
output->activeRefs--;
|
||||
}
|
||||
|
||||
static void OBSStartRecording(void *data, calldata_t *params)
|
||||
{
|
||||
BasicOutputHandler *output = static_cast<BasicOutputHandler*>(data);
|
||||
|
||||
output->recordingActive = true;
|
||||
QMetaObject::invokeMethod(output->main, "RecordingStart");
|
||||
output->activeRefs++;
|
||||
|
||||
UNUSED_PARAMETER(params);
|
||||
}
|
||||
|
@ -40,9 +40,9 @@ static void OBSStopRecording(void *data, calldata_t *params)
|
|||
BasicOutputHandler *output = static_cast<BasicOutputHandler*>(data);
|
||||
int code = (int)calldata_int(params, "code");
|
||||
|
||||
output->recordingActive = false;
|
||||
QMetaObject::invokeMethod(output->main,
|
||||
"RecordingStop", Q_ARG(int, code));
|
||||
output->activeRefs--;
|
||||
|
||||
UNUSED_PARAMETER(params);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,8 @@ class OBSBasic;
|
|||
struct BasicOutputHandler {
|
||||
OBSOutput fileOutput;
|
||||
OBSOutput streamOutput;
|
||||
int activeRefs = 0;
|
||||
bool streamingActive = false;
|
||||
bool recordingActive = false;
|
||||
OBSBasic *main;
|
||||
|
||||
OBSSignal startRecording;
|
||||
|
@ -26,7 +27,10 @@ struct BasicOutputHandler {
|
|||
|
||||
virtual void Update() = 0;
|
||||
|
||||
inline bool Active() const {return !!activeRefs;}
|
||||
inline bool Active() const
|
||||
{
|
||||
return streamingActive || recordingActive;
|
||||
}
|
||||
};
|
||||
|
||||
BasicOutputHandler *CreateSimpleOutputHandler(OBSBasic *main);
|
||||
|
|
Loading…
Reference in New Issue