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
diff options
context:
space:
mode:
Diffstat (limited to 'src/AudioRenderer.cpp')
-rw-r--r--src/AudioRenderer.cpp18
1 files changed, 2 insertions, 16 deletions
diff --git a/src/AudioRenderer.cpp b/src/AudioRenderer.cpp
index 281feb0..d2fcb52 100644
--- a/src/AudioRenderer.cpp
+++ b/src/AudioRenderer.cpp
@@ -607,14 +607,7 @@ namespace SaneAudioRenderer
size_t padFrames = (size_t)llMulDiv(m_device->GetWaveFormat()->nSamplesPerSec,
latency * 3 / 4 - remaining, OneSecond, 0); // x1.5
- DspChunk tempChunk(chunk.GetFormat(), chunk.GetChannelCount(),
- chunk.GetFrameCount() + padFrames, chunk.GetRate());
-
- size_t padBytes = tempChunk.GetFrameSize() * padFrames;
- ZeroMemory(tempChunk.GetData(), padBytes);
- memcpy(tempChunk.GetData() + padBytes, chunk.GetData(), chunk.GetSize());
-
- chunk = std::move(tempChunk);
+ chunk.PadHead(padFrames);
DebugOut("AudioRenderer pad", padFrames, "frames for rate matching");
}
@@ -643,14 +636,7 @@ namespace SaneAudioRenderer
if (padFrames > m_device->GetWaveFormat()->nSamplesPerSec / 33) // ~30ms threshold
{
- DspChunk tempChunk(chunk.GetFormat(), chunk.GetChannelCount(),
- chunk.GetFrameCount() + padFrames, chunk.GetRate());
-
- size_t padBytes = tempChunk.GetFrameSize() * padFrames;
- ZeroMemory(tempChunk.GetData(), padBytes);
- memcpy(tempChunk.GetData() + padBytes, chunk.GetData(), chunk.GetSize());
-
- chunk = std::move(tempChunk);
+ chunk.PadHead(padFrames);
REFERENCE_TIME paddedTime = llMulDiv(padFrames, OneSecond,
m_device->GetWaveFormat()->nSamplesPerSec, 0);