Bug 1618225 - Set stop time when using loop with duration. r=padenot
authorCorentin Arnould <koalab1999@gmail.com>
Wed, 24 Jun 2020 11:59:53 +0000
changeset 537106 f74c10d883047b1fe6d072d1cd93bc464beb98e4
parent 537105 19a830ebcabe764758de2e82f30b626b5cc45306
child 537107 99ac03bfe9ce6e913ae3fa55fb8ce54ef98fbc15
push id119816
push userpadenot@mozilla.com
push dateWed, 24 Jun 2020 12:05:27 +0000
treeherderautoland@feff7b5ed5b1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1618225
milestone79.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 1618225 - Set stop time when using loop with duration. r=padenot The AudioBufferSourceNode can now be looping and stop after duration. Differential Revision: https://phabricator.services.mozilla.com/D79873
dom/media/webaudio/AudioBufferSourceNode.cpp
--- a/dom/media/webaudio/AudioBufferSourceNode.cpp
+++ b/dom/media/webaudio/AudioBufferSourceNode.cpp
@@ -689,16 +689,19 @@ void AudioBufferSourceNode::Start(double
   if (mBuffer) {
     SendOffsetAndDurationParametersToTrack(ns);
   }
 
   // Don't set parameter unnecessarily
   if (aWhen > 0.0) {
     ns->SetDoubleParameter(START, aWhen);
   }
+  if (mDuration != std::numeric_limits<double>::min()) {
+    ns->SetTrackTimeParameter(STOP, Context(), aWhen + mDuration);
+  }
 
   Context()->StartBlockedAudioContextIfAllowed();
 }
 
 void AudioBufferSourceNode::Start(double aWhen, ErrorResult& aRv) {
   Start(aWhen, 0 /* offset */, Optional<double>(), aRv);
 }