Skip to content
Permalink
Browse files

Flush data out of the decoder in NewSegment instead of discarding it

This allows the source filter to call NewSegment on actual segment
changes, and get a seamless cut. On Seeking, Begin/EndFlush will instead
flush the decoder.
  • Loading branch information...
Nevcairiel committed Dec 12, 2017
1 parent f22787d commit aab883bd37468313d3897a9236262d1efe592ac5
Showing with 12 additions and 6 deletions.
  1. +11 −6 decoder/LAVVideo/LAVVideo.cpp
  2. +1 −0 decoder/LAVVideo/LAVVideo.h
@@ -813,14 +813,11 @@ HRESULT CLAVVideo::EndFlush()
DbgLog((LOG_TRACE, 1, L"::EndFlush"));
CAutoLock cAutoLock(&m_csReceive);

ReleaseLastSequenceFrame();

if (m_dwDecodeFlags & LAV_VIDEO_DEC_FLAG_DVD) {
PerformFlush();
}
PerformFlush();

HRESULT hr = __super::EndFlush();
m_bFlushing = FALSE;
m_bFlushed = TRUE;
return hr;
}

@@ -864,7 +861,14 @@ HRESULT CLAVVideo::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, doubl
{
DbgLog((LOG_TRACE, 1, L"::NewSegment - %I64d / %I64d", tStart, tStop));

PerformFlush();
// If this call is not directly following a flush anyway..
if (m_bFlushing == FALSE && m_bFlushed == FALSE) {
// Ensure all previous data is flushed out of the decoder
m_Decoder.EndOfStream();

// and reset the decoder
PerformFlush();
}

return __super::NewSegment(tStart, tStop, dRate);
}
@@ -1443,6 +1447,7 @@ HRESULT CLAVVideo::Receive(IMediaSample *pIn)
}

m_hrDeliver = S_OK;
m_bFlushed = FALSE;

// Skip over empty packets
if (pIn->GetActualDataLength() == 0) {
@@ -243,6 +243,7 @@ class __declspec(uuid("EE30215D-164F-4A92-A4EB-9D4C13390F9F")) CLAVVideo : publi
BOOL m_bForceInputAR = FALSE;
BOOL m_bSendMediaType = FALSE;
BOOL m_bFlushing = FALSE;
BOOL m_bFlushed = FALSE;
BOOL m_bForceFormatNegotiation = FALSE;

HRESULT m_hrDeliver = S_OK;

0 comments on commit aab883b

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.