diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2017-08-23 01:19:43 +0300 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2017-08-23 01:19:43 +0300 |
commit | bbc76e953df45e90511068a26d05e046021f205f (patch) | |
tree | 43984c3aaf6d32ba7c4369e3628bfb9965c99021 /decoder | |
parent | f56c6a89f336f5d1fb546471d43fae443a82af77 (diff) |
Use a less racey way to stop frame delivery
Diffstat (limited to 'decoder')
-rw-r--r-- | decoder/LAVVideo/LAVVideo.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/decoder/LAVVideo/LAVVideo.cpp b/decoder/LAVVideo/LAVVideo.cpp index 494a0283..1251ce50 100644 --- a/decoder/LAVVideo/LAVVideo.cpp +++ b/decoder/LAVVideo/LAVVideo.cpp @@ -1018,6 +1018,12 @@ HRESULT CLAVVideo::StartStreaming() STDMETHODIMP CLAVVideo::Stop() { + // Get the receiver lock and prevent frame delivery + { + CAutoLock lck3(&m_csReceive); + m_bFlushing = TRUE; + } + CAutoLock lck1(&m_csFilter); if (m_State == State_Stopped) { return NOERROR; @@ -1034,9 +1040,6 @@ STDMETHODIMP CLAVVideo::Stop() ASSERT(m_pInput); ASSERT(m_pOutput); - // block futher delivery to prevent lock issues - m_bFlushing = TRUE; - // decommit the input pin before locking or we can deadlock m_pInput->Inactive(); @@ -1055,6 +1058,7 @@ STDMETHODIMP CLAVVideo::Stop() m_bEOSDelivered = FALSE; } + // unblock delivery again, if we continue receiving frames m_bFlushing = FALSE; return hr; } |