diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2013-11-07 17:26:27 +0400 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2013-11-07 17:26:27 +0400 |
commit | 0ae7f12805eb2b30d63445491ebf393d9c42a604 (patch) | |
tree | be4828dd1c78228aa0e70b921ea7c54853b7d51b /demuxer/LAVSplitter | |
parent | 5b0fae2417a71e115282449d56a89f1a051a7e2a (diff) |
Refactor playback init checks into an event instead of a critical section
Its enough to wait for the action to finish, we don't need to lock code
execution.
Diffstat (limited to 'demuxer/LAVSplitter')
-rw-r--r-- | demuxer/LAVSplitter/LAVSplitter.cpp | 9 | ||||
-rw-r--r-- | demuxer/LAVSplitter/LAVSplitter.h | 3 |
2 files changed, 8 insertions, 4 deletions
diff --git a/demuxer/LAVSplitter/LAVSplitter.cpp b/demuxer/LAVSplitter/LAVSplitter.cpp index 0902da76..27f00cd6 100644 --- a/demuxer/LAVSplitter/LAVSplitter.cpp +++ b/demuxer/LAVSplitter/LAVSplitter.cpp @@ -60,6 +60,7 @@ CLAVSplitter::CLAVSplitter(LPUNKNOWN pUnk, HRESULT* phr) , m_bStopValid(FALSE) , m_rtOffset(0) , m_pTrayIcon(NULL) + , m_ePlaybackInit(TRUE) { WCHAR fileName[1024]; GetModuleFileName(NULL, fileName, 1024); @@ -705,7 +706,7 @@ DWORD CLAVSplitter::ThreadProc() return 0; } - m_csPlaybackInit.Lock(); + m_ePlaybackInit.Reset(); m_rtStart = m_rtNewStart; m_rtStop = m_rtNewStop; @@ -732,7 +733,7 @@ DWORD CLAVSplitter::ThreadProc() m_bDiscontinuitySent.clear(); m_bPlaybackStarted = TRUE; - m_csPlaybackInit.Unlock(); + m_ePlaybackInit.Set(); HRESULT hr = S_OK; while(SUCCEEDED(hr) && !CheckRequest(&cmd)) { @@ -865,7 +866,9 @@ STDMETHODIMP_(CMediaType *) CLAVSplitter::GetOutputMediatype(int stream) STDMETHODIMP CLAVSplitter::Stop() { CAutoLock cAutoLock(this); - CAutoLock cPlaybackLock(&m_csPlaybackInit); + + // Wait for playback to finish initializing + m_ePlaybackInit.Wait(); // Ask network operations to exit if (m_pDemuxer) diff --git a/demuxer/LAVSplitter/LAVSplitter.h b/demuxer/LAVSplitter/LAVSplitter.h index a7846c3d..0d596c1a 100644 --- a/demuxer/LAVSplitter/LAVSplitter.h +++ b/demuxer/LAVSplitter/LAVSplitter.h @@ -232,7 +232,6 @@ protected: private: CCritSec m_csPins; - CCritSec m_csPlaybackInit; std::vector<CLAVOutputPin *> m_pPins; std::vector<CLAVOutputPin *> m_pActivePins; std::vector<CLAVOutputPin *> m_pRetiredPins; @@ -256,6 +255,8 @@ private: REFERENCE_TIME m_rtLastStart, m_rtLastStop; std::set<void *> m_LastSeekers; + CAMEvent m_ePlaybackInit; + // flushing bool m_fFlushing; CAMEvent m_eEndFlush; |