summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/audio/AudioChannel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/platform/audio/AudioChannel.cpp')
-rw-r--r--Source/WebCore/platform/audio/AudioChannel.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/Source/WebCore/platform/audio/AudioChannel.cpp b/Source/WebCore/platform/audio/AudioChannel.cpp
index 2321349bc..09f638fbd 100644
--- a/Source/WebCore/platform/audio/AudioChannel.cpp
+++ b/Source/WebCore/platform/audio/AudioChannel.cpp
@@ -41,6 +41,13 @@ namespace WebCore {
using namespace VectorMath;
+void AudioChannel::resizeSmaller(size_t newLength)
+{
+ ASSERT(newLength <= m_length);
+ if (newLength <= m_length)
+ m_length = newLength;
+}
+
void AudioChannel::scale(float scale)
{
if (isSilent())
@@ -65,15 +72,15 @@ void AudioChannel::copyFrom(const AudioChannel* sourceChannel)
void AudioChannel::copyFromRange(const AudioChannel* sourceChannel, unsigned startFrame, unsigned endFrame)
{
- if (sourceChannel->isSilent() && isSilent())
- return;
-
// Check that range is safe for reading from sourceChannel.
bool isRangeSafe = sourceChannel && startFrame < endFrame && endFrame <= sourceChannel->length();
ASSERT(isRangeSafe);
if (!isRangeSafe)
return;
+ if (sourceChannel->isSilent() && isSilent())
+ return;
+
// Check that this channel has enough space.
size_t rangeLength = endFrame - startFrame;
bool isRangeLengthSafe = rangeLength <= length();
@@ -95,14 +102,14 @@ void AudioChannel::copyFromRange(const AudioChannel* sourceChannel, unsigned sta
void AudioChannel::sumFrom(const AudioChannel* sourceChannel)
{
- if (sourceChannel->isSilent())
- return;
-
bool isSafe = sourceChannel && sourceChannel->length() >= length();
ASSERT(isSafe);
if (!isSafe)
return;
+ if (sourceChannel->isSilent())
+ return;
+
if (isSilent())
copyFrom(sourceChannel);
else