Bug 867089 - Validate the playbackRate before using it. r=ehsan
☠☠ backed out by 4b68073547c0 ☠ ☠
authorPaul Adenot <paul@paul.cx>
Tue, 30 Apr 2013 16:04:05 +0200
changeset 130336 ab9c9d0819a2b62feb9dd6c2ac9d9fd29fa08f75
parent 130335 0d3a0ab31adf03f0e0be28d3c0740b18d7389329
child 130337 5447d49a2c6fcc4fe725676e0553ba66fe5a4f8d
push id27311
push userpaul@paul.cx
push dateTue, 30 Apr 2013 14:04:56 +0000
treeherdermozilla-inbound@5447d49a2c6f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs867089
milestone23.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 867089 - Validate the playbackRate before using it. r=ehsan
content/media/webaudio/AudioBufferSourceNode.cpp
--- a/content/media/webaudio/AudioBufferSourceNode.cpp
+++ b/content/media/webaudio/AudioBufferSourceNode.cpp
@@ -307,16 +307,21 @@ public:
   void UpdateSampleRateIfNeeded(AudioNodeStream* aStream)
   {
     if (mPlaybackRateTimeline.HasSimpleValue()) {
       mPlaybackRate = mPlaybackRateTimeline.GetValue();
     } else {
       mPlaybackRate = mPlaybackRateTimeline.GetValueAtTime<TrackTicks>(aStream->GetCurrentPosition());
     }
 
+    // Make sure the playback rate if something our resampler can work with.
+    if (mPlaybackRate <= 0.0 || mPlaybackRate >= 1024) {
+      mPlaybackRate = 1.0;
+    }
+
     uint32_t currentOutSampleRate, currentInSampleRate;
     if (ShouldResample()) {
       SpeexResamplerState* resampler = Resampler(mChannels);
       speex_resampler_get_rate(resampler, &currentInSampleRate, &currentOutSampleRate);
       uint32_t finalSampleRate = ComputeFinalOutSampleRate();
       if (currentOutSampleRate != finalSampleRate) {
         speex_resampler_set_rate(resampler, currentInSampleRate, finalSampleRate);
       }