virtualcam-module: Don't send frames if stopped
Fixes a bug where frames would continue to send even while stopped
This commit is contained in:
parent
382e37440e
commit
0f08432f53
@ -138,10 +138,23 @@ STDMETHODIMP VCamFilter::Pause()
|
||||
return hr;
|
||||
}
|
||||
|
||||
os_atomic_set_bool(&active, true);
|
||||
SetEvent(thread_start);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP VCamFilter::Run(REFERENCE_TIME tStart)
|
||||
{
|
||||
os_atomic_set_bool(&active, true);
|
||||
return OutputFilter::Run(tStart);
|
||||
}
|
||||
|
||||
STDMETHODIMP VCamFilter::Stop()
|
||||
{
|
||||
os_atomic_set_bool(&active, false);
|
||||
return OutputFilter::Stop();
|
||||
}
|
||||
|
||||
inline uint64_t VCamFilter::GetTime()
|
||||
{
|
||||
if (!!clock) {
|
||||
@ -189,7 +202,8 @@ void VCamFilter::Thread()
|
||||
UpdatePlaceholder();
|
||||
|
||||
while (!stopped()) {
|
||||
Frame(filter_time);
|
||||
if (os_atomic_load_bool(&active))
|
||||
Frame(filter_time);
|
||||
sleepto_100ns(cur_time += interval);
|
||||
filter_time += interval;
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ class VCamFilter : public DShow::OutputFilter {
|
||||
uint64_t interval = DEFAULT_INTERVAL;
|
||||
WinHandle thread_start;
|
||||
WinHandle thread_stop;
|
||||
volatile bool active = false;
|
||||
|
||||
nv12_scale_t scaler = {};
|
||||
|
||||
@ -61,4 +62,6 @@ public:
|
||||
~VCamFilter() override;
|
||||
|
||||
STDMETHODIMP Pause() override;
|
||||
STDMETHODIMP Run(REFERENCE_TIME tStart) override;
|
||||
STDMETHODIMP Stop() override;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user