Skip to content

Commit

Permalink
dxva2: flush the decoder context when skipping a re-init
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Nevcairiel committed Jul 5, 2017
1 parent fe492a7 commit dd0a149
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions decoder/LAVVideo/decoders/dxva2dec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit dd0a149

Please sign in to comment.