STDMETHODIMP CDecDXVA2::Flush() { CDecAvcodec::Flush(); FlushDisplayQueue(FALSE); #ifdef DEBUG int used = 0; for (int i = 0; i < m_NumSurfaces; i++) { d3d_surface_t *s = &m_pSurfaces[i]; if (s->used) { used++; } } if (used > 0) { DbgLog((LOG_TRACE, 10, L"WARNING! %d frames still in use after flush", used)); } #endif // This solves an issue with corruption after seeks on AMD systems, see JIRA LAV-5 if (m_dwVendorId == VEND_ID_ATI && m_nCodecId == AV_CODEC_ID_H264 && m_pDecoder) { if (m_bNative && m_pDXVA2Allocator) { // The allocator needs to be locked because flushes can happen async to other graph events // and in the worst case the allocator is decommited while we're using it. CAutoLock allocatorLock(m_pDXVA2Allocator); if (m_pDXVA2Allocator->IsCommited()) CreateDXVA2Decoder(m_NumSurfaces, m_pRawSurface); } else if(!m_bNative) CreateDXVA2Decoder(); } return S_OK; }
// flush requires a specific handling since we need to be able to use the CAutoLock void CTimeStretchFilter::flush() { CAutoLock allocatorLock(&m_allocatorLock); if (m_Streams) { for(int i = 0; i < m_Streams->size(); i++) m_Streams->at(i)->flush(); } }
uint CTimeStretchFilter::flushEx() { CAutoLock allocatorLock(&m_allocatorLock); uint minZeros = 0; if (m_Streams) { for(int i = 0; i < m_Streams->size(); i++) { uint zeros = m_Streams->at(i)->flushEx(); if (i == 0 || minZeros > zeros) minZeros = zeros; } } return minZeros; }