Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge remote-tracking branch 'upstream/EXP-TsReader_noStopMod' into D…

…isaster123MP
  • Loading branch information...
commit 692686a82d0be10fe4ce68ae9b56401c4980ed67 2 parents be8c4cc + 0fe9ac2
@disaster123 authored
View
BIN  DirectShowFilters/TsReader/bin/Debug/TsReader.ax
Binary file not shown
View
BIN  DirectShowFilters/TsReader/bin/Debug/TsReader.pdb
Binary file not shown
View
BIN  DirectShowFilters/TsReader/bin/Release/TsReader.ax
Binary file not shown
View
31 DirectShowFilters/TsReader/source/AudioPin.cpp
@@ -315,7 +315,6 @@ HRESULT CAudioPin::FillBuffer(IMediaSample *pSample)
//we dont try to read any packets, but simply return...
if (m_pTsReaderFilter->IsSeeking() || m_pTsReaderFilter->IsStopping())
{
- //Sleep(20);
m_FillBuffSleepTime = 5;
CreateEmptySample(pSample);
m_bInFillBuffer = false;
@@ -349,7 +348,6 @@ HRESULT CAudioPin::FillBuffer(IMediaSample *pSample)
//Wait until we have audio (and video, if pin connected)
if (!m_pTsReaderFilter->m_bStreamCompensated || (buffer==NULL))
{
- //Sleep(10);
m_FillBuffSleepTime = 5;
buffer=NULL; //Continue looping
if (!m_pTsReaderFilter->m_bStreamCompensated && (m_nNextASD != 0))
@@ -365,7 +363,7 @@ HRESULT CAudioPin::FillBuffer(IMediaSample *pSample)
bool HasTimestamp ;
double fTime = 0.0;
double clock = 0.0;
- double stallPoint = 1.0;
+ double stallPoint = 1.5;
//check if it has a timestamp
if ((HasTimestamp=buffer->MediaTime(RefTime)))
{
@@ -383,7 +381,9 @@ HRESULT CAudioPin::FillBuffer(IMediaSample *pSample)
//and samples outside a sensible timing window during play
//(helps with signal corruption recovery)
cRefTime -= m_pTsReaderFilter->m_ClockOnStart.m_time;
- if ((cRefTime.m_time >= PRESENT_DELAY) && (fTime > ((cRefTime.m_time >= FS_TIM_LIM) ? -0.3 : -0.5)) && (fTime < 2.0))
+
+ if ((cRefTime.m_time >= PRESENT_DELAY) &&
+ (fTime > ((cRefTime.m_time >= FS_TIM_LIM) ? -0.3 : -0.5)) && (fTime < 2.5))
{
if ((fTime < 0.3) && (m_dRateSeeking == 1.0) && (m_pTsReaderFilter->State() == State_Running))
{
@@ -395,13 +395,10 @@ HRESULT CAudioPin::FillBuffer(IMediaSample *pSample)
demux.m_bAudioSampleLate = true;
}
- //Slowly increase stall point threshold over the first 8 seconds of play
- //to allow audio renderer buffer to build up to 0.4s
- // stallPoint = min(0.4, (0.2 + (((double)cRefTime.m_time)/400000000.0)));
- if ((fTime > stallPoint) && (m_pTsReaderFilter->State() == State_Running))
+ if ((fTime > stallPoint) && (m_sampleCount > 2))
{
- //Too early - stall to avoid over-filling of audio decode/renderer buffers
- //Sleep(10);
+ //Too early - stall to avoid over-filling of audio decode/renderer buffers,
+ //but don't enable at start of play to make sure graph starts properly
m_FillBuffSleepTime = 10;
buffer = NULL;
earlyStall = true;
@@ -412,16 +409,8 @@ HRESULT CAudioPin::FillBuffer(IMediaSample *pSample)
{
// Sample is too late.
m_bPresentSample = false ;
- //m_bDiscontinuity = TRUE; //Next good sample will be discontinuous
}
- cRefTime += m_pTsReaderFilter->m_ClockOnStart.m_time;
-
- //Calculate sleep times (average sample duration/4)
- // m_sampleDuration = GetAverageSampleDur(RefTime.GetUnits());
- // if ((m_dRateSeeking == 1.0) && (demux.GetAudioBufferCnt() < 10))
- // {
- // m_FillBuffSleepTime = (DWORD)min(20, max(1, m_sampleDuration/40000));
- // }
+ cRefTime += m_pTsReaderFilter->m_ClockOnStart.m_time;
}
if (m_bPresentSample && (m_dRateSeeking == 1.0) && (buffer->Length() > 0))
@@ -487,7 +476,6 @@ HRESULT CAudioPin::FillBuffer(IMediaSample *pSample)
//delete the buffer and return
delete buffer;
demux.EraseAudioBuff();
- //Sleep(sampSleepTime) ;
//m_sampleCount++ ;
}
else
@@ -495,9 +483,8 @@ HRESULT CAudioPin::FillBuffer(IMediaSample *pSample)
delete buffer;
demux.EraseAudioBuff();
buffer=NULL ;
- m_FillBuffSleepTime = (m_dRateSeeking == 1.0) ? 0 : 5;
+ m_FillBuffSleepTime = (m_dRateSeeking == 1.0) ? 1 : 2;
m_bDiscontinuity = TRUE; //Next good sample will be discontinuous
- //Sleep(1) ;
}
}
earlyStall = false;
View
11 DirectShowFilters/TsReader/source/DeMultiplexer.cpp
@@ -2558,17 +2558,6 @@ void CDeMultiplexer::SetMediaChanging(bool onOff)
LogDebug("demux:Wait for media format change:%d", onOff);
m_bWaitForMediaChange=onOff;
m_tWaitForMediaChange=GET_TIME_NOW() ;
-
-// if (m_filter.GetAudioPin())
-// {
-// m_filter.GetAudioPin()->SetDiscontinuity(true);
-// m_filter.GetAudioPin()->SetAddPMT();
-// }
-// if (m_filter.GetVideoPin())
-// {
-// m_filter.GetVideoPin()->SetDiscontinuity(true);
-// m_filter.GetVideoPin()->SetAddPMT();
-// }
}
bool CDeMultiplexer::IsMediaChanging(void)
View
22 DirectShowFilters/TsReader/source/TsReader.cpp
@@ -181,7 +181,7 @@ CTsReaderFilter::CTsReaderFilter(IUnknown *pUnk, HRESULT *phr):
GetLogFile(filename);
::DeleteFile(filename);
LogDebug("----- Experimental noStopMod version -----");
- LogDebug("---------- v0.0.52 XXX -------------------");
+ LogDebug("---------- v0.0.54 XXX -------------------");
m_fileReader=NULL;
m_fileDuration=NULL;
@@ -578,11 +578,15 @@ STDMETHODIMP CTsReaderFilter::Run(REFERENCE_TIME tStart)
m_demultiplexer.m_LastDataFromRtsp=GET_TIME_NOW();
//Set our StreamTime Reference offset to zero
- HRESULT hr= CSource::Run(tStart);
SetMediaPosnUpdate(m_MediaPos) ; // reset offset.
+ HRESULT hr= CSource::Run(tStart);
+
FindSubtitleFilter();
m_bPauseOnClockTooFast=false ;
+
+ m_ShowBufferVideo = 3;
+ m_ShowBufferAudio = 3;
LogDebug("CTsReaderFilter::Run(%05.2f) state %d -->done",msec,m_State);
return hr;
@@ -672,11 +676,14 @@ bool CTsReaderFilter::IsLiveTV()
STDMETHODIMP CTsReaderFilter::Pause()
{
- if (m_bPauseOnClockTooFast)
- {
- m_ShowBufferVideo = 2;
- m_ShowBufferAudio = 2;
- }
+// if (m_bPauseOnClockTooFast)
+// {
+// m_ShowBufferVideo = 2;
+// m_ShowBufferAudio = 2;
+// }
+
+ m_ShowBufferVideo = 3;
+ m_ShowBufferAudio = 3;
LogDebug("CTsReaderFilter::Pause() - IsTimeShifting = %d - state = %d", IsTimeShifting(), m_State);
HRESULT hr = S_FALSE;
@@ -794,6 +801,7 @@ STDMETHODIMP CTsReaderFilter::Pause()
}
LogDebug("CTsReaderFilter::Pause() - END - state = %d", m_State);
+ SetMediaPosnUpdate(m_MediaPos) ; // reset offset.
m_bForcePosnUpdate = true;
WakeThread();
View
38 DirectShowFilters/TsReader/source/VideoPin.cpp
@@ -353,7 +353,6 @@ HRESULT CVideoPin::FillBuffer(IMediaSample *pSample)
//we dont try to read any packets, but simply return...
if (m_pTsReaderFilter->IsSeeking() || m_pTsReaderFilter->IsStopping())
{
- //Sleep(5);
m_FillBuffSleepTime = 5;
CreateEmptySample(pSample);
m_bInFillBuffer = false;
@@ -361,25 +360,7 @@ HRESULT CVideoPin::FillBuffer(IMediaSample *pSample)
}
if (m_pTsReaderFilter->m_bStreamCompensated && !demux.m_bFlushRunning)
- {
- // Avoid excessive video Fill buffer preemption
- // and slow down emptying rate when data available gets really low
- // double frameTime;
- // int buffCnt = demux.GetVideoBuffCntFt(&frameTime);
- // DWORD sampSleepTime = max(1,(DWORD)(frameTime/4.0));
- // if ((buffCnt == 0) || (buffCnt > 5) || (m_dRateSeeking != 1.0))
- // {
- // sampSleepTime = 1;
- // }
- // //Sleep(min(10,sampSleepTime));
- // m_FillBuffSleepTime = min(8,sampSleepTime);
-
- // int buffCnt = demux.GetVideoBufferCnt();
- // if ((buffCnt != 0) && (m_dRateSeeking == 1.0) && (m_pTsReaderFilter->State() == State_Running))
- // {
- // m_FillBuffSleepTime = 2;
- // }
-
+ {
//CAutoLock flock (&demux.m_sectionFlushVideo);
// Get next video buffer from demultiplexer
buffer=demux.GetVideo(earlyStall);
@@ -404,7 +385,6 @@ HRESULT CVideoPin::FillBuffer(IMediaSample *pSample)
if (buffer == NULL)
{
- //Sleep(10);
m_FillBuffSleepTime = 5;
}
else
@@ -414,7 +394,7 @@ HRESULT CVideoPin::FillBuffer(IMediaSample *pSample)
CRefTime RefTime, cRefTime;
double fTime = 0.0;
double clock = 0.0;
- double stallPoint = 1.2;
+ double stallPoint = 2.5;
//check if it has a timestamp
bool HasTimestamp=buffer->MediaTime(RefTime);
if (HasTimestamp)
@@ -467,20 +447,16 @@ HRESULT CVideoPin::FillBuffer(IMediaSample *pSample)
demux.m_bVideoSampleLate = true;
}
- //Slowly increase stall point threshold over the first 8 seconds of play
- //stallPoint = min(1.8, (1.3 + (((double)cRefTime.m_time)/160000000.0)));
- //stallPoint = min(1.3, (0.8 + (((double)cRefTime.m_time)/160000000.0)));
- //stallPoint = min(1.1, (0.8 + (((double)cRefTime.m_time)/160000000.0)));
-
//Discard late samples at start of play,
//and samples outside a sensible timing window during play
//(helps with signal corruption recovery)
if ((fTime > (ForcePresent ? -0.5 : -0.3)) && (fTime < 3.5))
{
- if ((fTime > stallPoint) && (m_pTsReaderFilter->State() == State_Running))
+ //if ((fTime > stallPoint) && (m_pTsReaderFilter->State() == State_Running))
+ if ((fTime > stallPoint) && (m_sampleCount > 10))
{
- //Too early - stall for a while to avoid over-filling of video pipeline buffers
- //Sleep(10);
+ //Too early - stall for a while to avoid over-filling of video pipeline buffers,
+ //but don't enable at start of play to make sure graph starts properly
m_FillBuffSleepTime = 10;
buffer = NULL;
earlyStall = true;
@@ -612,7 +588,7 @@ HRESULT CVideoPin::FillBuffer(IMediaSample *pSample)
demux.EraseVideoBuff();
m_bDiscontinuity = TRUE; //Next good sample will be discontinuous
buffer = NULL;
- m_FillBuffSleepTime = (m_dRateSeeking == 1.0) ? 0 : 5;
+ m_FillBuffSleepTime = 1;
}
}
earlyStall = false;

0 comments on commit 692686a

Please sign in to comment.
Something went wrong with that request. Please try again.