From dd0a1490ab5b6387c339a98080a41de588c3d562 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Wed, 5 Jul 2017 23:56:13 +0200 Subject: [PATCH] dxva2: flush the decoder context when skipping a re-init The flush is required to be able to re-start decoding on the same context after an EndOfStream was issued to flush existing frames out. --- decoder/LAVVideo/decoders/dxva2dec.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/decoder/LAVVideo/decoders/dxva2dec.cpp b/decoder/LAVVideo/decoders/dxva2dec.cpp index 20f709ebc..cebfbdaea 100644 --- a/decoder/LAVVideo/decoders/dxva2dec.cpp +++ b/decoder/LAVVideo/decoders/dxva2dec.cpp @@ -1029,6 +1029,9 @@ STDMETHODIMP CDecDXVA2::InitDecoder(AVCodecID codec, const CMediaType *pmt) if (mediaTypeCheck == *pmt) { DbgLog((LOG_TRACE, 10, L"-> Skipping re-init because media type is unchanged.")); m_MediaType = *pmt; + + // flush the decoder so we can resume decoding properly (before a re-init, EndOfStream would be called, making this necessary) + avcodec_flush_buffers(m_pAVCtx); return S_OK; } }