diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-17 16:21:14 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-17 16:21:14 +0200 |
commit | 8995b83bcbfbb68245f779b64e5517627c6cc6ea (patch) | |
tree | 17985605dab9263cc2444bd4d45f189e142cca7c /Source/WebCore/platform/audio/AudioChannel.cpp | |
parent | b9c9652036d5e9f1e29c574f40bc73a35c81ace6 (diff) |
Imported WebKit commit cf4f8fc6f19b0629f51860cb2d4b25e139d07e00 (http://svn.webkit.org/repository/webkit/trunk@131592)
New snapshot that includes the build fixes for Mac OS X 10.6 and earlier as well
as the previously cherry-picked changes
Diffstat (limited to 'Source/WebCore/platform/audio/AudioChannel.cpp')
-rw-r--r-- | Source/WebCore/platform/audio/AudioChannel.cpp | 19 |
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 |