Bug 1189506. Remove invalid assertion. r=karlt
authorRobert O'Callahan <robert@ocallahan.org>
Wed, 16 Sep 2015 16:31:12 +1200
changeset 295529 052e47bcd8ac132b46454bcf81877cf717b7d99f
parent 295528 724eb2edb328cd7083bd1c09b717a56b70071c23
child 295530 71f39e19070eac1697666f90ff1bc9014a20f935
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt
bugs1189506
milestone43.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 1189506. Remove invalid assertion. r=karlt That's nothing stopping someone passing an AudioContext time of (e.g.) zero to AudioBufferSourceNode::Stop and OscillatorNode::Start/Stop, which can get turned into a negative time here. Those nodes can handle negative start/stop times just fine.
dom/media/webaudio/AudioNodeStream.cpp
--- a/dom/media/webaudio/AudioNodeStream.cpp
+++ b/dom/media/webaudio/AudioNodeStream.cpp
@@ -6,16 +6,17 @@
 #include "AudioNodeStream.h"
 
 #include "MediaStreamGraphImpl.h"
 #include "AudioNodeEngine.h"
 #include "ThreeDPoint.h"
 #include "AudioChannelFormat.h"
 #include "AudioParamTimeline.h"
 #include "AudioContext.h"
+#include "nsMathUtils.h"
 
 using namespace mozilla::dom;
 
 namespace mozilla {
 
 /**
  * An AudioNodeStream produces a single audio track with ID
  * AUDIO_TRACK. This track has rate AudioContext::sIdealAudioRate
@@ -652,32 +653,29 @@ AudioNodeStream::FractionalTicksFromDest
   StreamTime destinationStreamTime = destinationFractionalTicks; // round down
   // MediaTime does not have the resolution of double
   double offset = destinationFractionalTicks - destinationStreamTime;
 
   GraphTime graphTime =
     aDestination->StreamTimeToGraphTime(destinationStreamTime);
   StreamTime thisStreamTime = GraphTimeToStreamTime(graphTime);
   double thisFractionalTicks = thisStreamTime + offset;
-  MOZ_ASSERT(thisFractionalTicks >= 0.0);
   return thisFractionalTicks;
 }
 
 StreamTime
 AudioNodeStream::TicksFromDestinationTime(MediaStream* aDestination,
                                           double aSeconds)
 {
   AudioNodeStream* destination = aDestination->AsAudioNodeStream();
   MOZ_ASSERT(destination);
 
   double thisSeconds =
     FractionalTicksFromDestinationTime(destination, aSeconds);
-  // Round to nearest
-  StreamTime ticks = thisSeconds + 0.5;
-  return ticks;
+  return NS_round(thisSeconds);
 }
 
 double
 AudioNodeStream::DestinationTimeFromTicks(AudioNodeStream* aDestination,
                                           StreamTime aPosition)
 {
   MOZ_ASSERT(SampleRate() == aDestination->SampleRate());