diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2014-12-06 01:45:50 +0300 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2014-12-06 01:45:50 +0300 |
commit | 2bf891032f6d0480cec1537248876d52dc94f530 (patch) | |
tree | 799f9a7930025b0327885962e44f2c3667df265e /decoder | |
parent | 87805febbbf64edc04a3195cfc3bbf467ee540fb (diff) |
Check if the codec is open before flushing it
Diffstat (limited to 'decoder')
-rw-r--r-- | decoder/LAVAudio/LAVAudio.cpp | 4 | ||||
-rw-r--r-- | decoder/LAVVideo/decoders/avcodec.cpp | 2 | ||||
-rw-r--r-- | decoder/LAVVideo/decoders/dxva2dec.cpp | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/decoder/LAVAudio/LAVAudio.cpp b/decoder/LAVAudio/LAVAudio.cpp index 653d83ff..f8de1351 100644 --- a/decoder/LAVAudio/LAVAudio.cpp +++ b/decoder/LAVAudio/LAVAudio.cpp @@ -1520,8 +1520,8 @@ HRESULT CLAVAudio::FlushDecoder() m_bUpdateTimeCache = TRUE; } - if (m_pAVCtx && m_pAVCtx->codec) { - avcodec_flush_buffers (m_pAVCtx); + if (m_pAVCtx && avcodec_is_open(m_pAVCtx)) { + avcodec_flush_buffers(m_pAVCtx); } FlushDTSDecoder(); diff --git a/decoder/LAVVideo/decoders/avcodec.cpp b/decoder/LAVVideo/decoders/avcodec.cpp index 30a167f7..846ad599 100644 --- a/decoder/LAVVideo/decoders/avcodec.cpp +++ b/decoder/LAVVideo/decoders/avcodec.cpp @@ -947,7 +947,7 @@ STDMETHODIMP CDecAvcodec::Decode(const BYTE *buffer, int buflen, REFERENCE_TIME STDMETHODIMP CDecAvcodec::Flush() { - if (m_pAVCtx) { + if (m_pAVCtx && avcodec_is_open(m_pAVCtx)) { avcodec_flush_buffers(m_pAVCtx); } diff --git a/decoder/LAVVideo/decoders/dxva2dec.cpp b/decoder/LAVVideo/decoders/dxva2dec.cpp index 758e492b..d529447b 100644 --- a/decoder/LAVVideo/decoders/dxva2dec.cpp +++ b/decoder/LAVVideo/decoders/dxva2dec.cpp @@ -1312,7 +1312,7 @@ HRESULT CDecDXVA2::PostDecode() STDMETHODIMP CDecDXVA2::FlushFromAllocator() { - if (m_pAVCtx) + if (m_pAVCtx && avcodec_is_open(m_pAVCtx)) avcodec_flush_buffers(m_pAVCtx); FlushDisplayQueue(FALSE); |