Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/sanear.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Marsev <alex.marsev@gmail.com>2015-10-17 02:01:43 +0300
committerAlex Marsev <alex.marsev@gmail.com>2015-10-17 08:02:15 +0300
commit2b63d17177d2bf1e666e187623194c8538c1d6c0 (patch)
tree204384a7ab8ae65d8cfd64fb274df4d5cfd47996 /src
parentdfee95c0b7d941b70f730021e776cdcdb69fe187 (diff)
Enable sample drop/crop/pad after discontinuity
Diffstat (limited to 'src')
-rw-r--r--src/SampleCorrection.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/SampleCorrection.cpp b/src/SampleCorrection.cpp
index da99b1f..c1d93aa 100644
--- a/src/SampleCorrection.cpp
+++ b/src/SampleCorrection.cpp
@@ -53,19 +53,19 @@ namespace SaneAudioRenderer
assert(chunk.IsEmpty());
}
}
- else if (m_lastFrameEnd == 0 && !realtimeDevice)
+ else if (!realtimeDevice && (m_lastFrameEnd == 0 || (sampleProps.dwSampleFlags & AM_SAMPLE_TIMEDISCONTINUITY)))
{
- if ((sampleProps.dwSampleFlags & AM_SAMPLE_STOPVALID) && sampleProps.tStop <= 0)
+ if ((sampleProps.dwSampleFlags & AM_SAMPLE_STOPVALID) && sampleProps.tStop <= m_lastFrameEnd)
{
// Drop the sample.
DebugOut("SampleCorrection drop [", sampleProps.tStart, sampleProps.tStop, "]");
chunk = DspChunk();
assert(chunk.IsEmpty());
}
- else if ((sampleProps.dwSampleFlags & AM_SAMPLE_TIMEVALID) && sampleProps.tStart < 0)
+ else if ((sampleProps.dwSampleFlags & AM_SAMPLE_TIMEVALID) && sampleProps.tStart < m_lastFrameEnd)
{
// Crop the sample.
- const size_t cropFrames = (size_t)TimeToFrames(0 - sampleProps.tStart);
+ const size_t cropFrames = (size_t)TimeToFrames(m_lastFrameEnd - sampleProps.tStart);
if (cropFrames > 0)
{
@@ -75,7 +75,7 @@ namespace SaneAudioRenderer
chunk.ShrinkHead(chunk.GetFrameCount() > cropFrames ? chunk.GetFrameCount() - cropFrames : 0);
}
}
- else if ((sampleProps.dwSampleFlags & AM_SAMPLE_TIMEVALID) && sampleProps.tStart > 0)
+ else if ((sampleProps.dwSampleFlags & AM_SAMPLE_TIMEVALID) && sampleProps.tStart > m_lastFrameEnd)
{
// Zero-pad the sample.
const size_t padFrames = (size_t)TimeToFrames(sampleProps.tStart - m_lastFrameEnd);