Bug 1061046. Part 14: Remove TimeToTicksRoundDown. r=karlt
authorRobert O'Callahan <robert@ocallahan.org>
Thu, 18 Sep 2014 17:13:14 +1200
changeset 216582 098a4f0cd0ae3aa30bb0c3bed4a04c1d1ceca129
parent 216581 eeda13df89b49a9bdb9410c12e50d0a5e8aedbe8
child 216583 b93cef4c711270560af4aa9bc1b8c1b1c1c4c7bf
push id52093
push userrocallahan@mozilla.com
push dateThu, 20 Nov 2014 08:12:12 +0000
treeherdermozilla-inbound@43a6e96a6614 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt
bugs1061046
milestone36.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 1061046. Part 14: Remove TimeToTicksRoundDown. r=karlt
dom/media/MediaStreamGraph.cpp
dom/media/MediaStreamGraph.h
dom/media/MediaStreamGraphImpl.h
dom/media/TrackUnionStream.cpp
--- a/dom/media/MediaStreamGraph.cpp
+++ b/dom/media/MediaStreamGraph.cpp
@@ -957,17 +957,17 @@ MediaStreamGraphImpl::PlayAudio(MediaStr
   MOZ_ASSERT(mRealtime, "Should only attempt to play audio in realtime mode");
 
   TrackTicks ticksWritten = 0;
   // We compute the number of needed ticks by converting a difference of graph
   // time rather than by substracting two converted stream time to ensure that
   // the rounding between {Graph,Stream}Time and track ticks is not dependant
   // on the absolute value of the {Graph,Stream}Time, and so that number of
   // ticks to play is the same for each cycle.
-  TrackTicks ticksNeeded = TimeToTicksRoundDown(mSampleRate, aTo) - TimeToTicksRoundDown(mSampleRate, aFrom);
+  TrackTicks ticksNeeded = aTo - aFrom;
 
   if (aStream->mAudioOutputStreams.IsEmpty()) {
     return 0;
   }
 
   float volume = 0.0f;
   for (uint32_t i = 0; i < aStream->mAudioOutputs.Length(); ++i) {
     volume += aStream->mAudioOutputs[i].mVolume;
@@ -1006,17 +1006,17 @@ MediaStreamGraphImpl::PlayAudio(MediaStr
       end = std::min(end, aTo);
 
       // Check how many ticks of sound we can provide if we are blocked some
       // time in the middle of this cycle.
       TrackTicks toWrite = 0;
       if (end >= aTo) {
         toWrite = ticksNeeded;
       } else {
-        toWrite = TimeToTicksRoundDown(mSampleRate, end - t);
+        toWrite = end - t;
       }
       ticksNeeded -= toWrite;
 
       if (blocked) {
         output.InsertNullDataAtStart(toWrite);
         ticksWritten += toWrite;
         STREAM_LOG(PR_LOG_DEBUG+1, ("MediaStream %p writing %ld blocking-silence samples for %f to %f (%ld to %ld)\n",
                                     aStream, toWrite, MediaTimeToSeconds(t), MediaTimeToSeconds(end),
--- a/dom/media/MediaStreamGraph.h
+++ b/dom/media/MediaStreamGraph.h
@@ -496,20 +496,16 @@ public:
   StreamTime MicrosecondsToStreamTimeRoundDown(int64_t aMicroseconds) {
     return (aMicroseconds*mBuffer.GraphRate())/1000000;
   }
 
   TrackTicks TimeToTicksRoundUp(TrackRate aRate, StreamTime aTime)
   {
     return RateConvertTicksRoundUp(aRate, mBuffer.GraphRate(), aTime);
   }
-  TrackTicks TimeToTicksRoundDown(TrackRate aRate, StreamTime aTime)
-  {
-    return RateConvertTicksRoundDown(aRate, mBuffer.GraphRate(), aTime);
-  }
   StreamTime TicksToTimeRoundDown(TrackRate aRate, TrackTicks aTicks)
   {
     return RateConvertTicksRoundDown(mBuffer.GraphRate(), aRate, aTicks);
   }
   /**
    * Convert graph time to stream time. aTime must be <= mStateComputedTime
    * to ensure we know exactly how much time this stream will be blocked during
    * the interval.
--- a/dom/media/MediaStreamGraphImpl.h
+++ b/dom/media/MediaStreamGraphImpl.h
@@ -409,21 +409,16 @@ public:
   {
     return SecondsToTicksRoundDown(GraphRate(), aS);
   }
   GraphTime MillisecondsToMediaTime(int32_t aMS)
   {
     return RateConvertTicksRoundDown(GraphRate(), 1000, aMS);
   }
 
-  TrackTicks TimeToTicksRoundDown(TrackRate aRate, StreamTime aTime)
-  {
-    return RateConvertTicksRoundDown(aRate, GraphRate(), aTime);
-  }
-
   /**
    * Signal to the graph that the thread has paused indefinitly,
    * or resumed.
    */
   void PausedIndefinitly();
   void ResumedFromPaused();
 
   /**
--- a/dom/media/TrackUnionStream.cpp
+++ b/dom/media/TrackUnionStream.cpp
@@ -293,17 +293,17 @@ TrackUnionStream::TrackUnionStream(DOMMe
         // inputEndTicks - inputStartTicks = ticks.
         // 2) inputEndTicks <= aInputTrack->GetSegment()->GetDuration().
         // 3) In any sequence of intervals where neither stream is blocked,
         // the content of the input track we use is a contiguous sequence of
         // ticks with no gaps or overlaps.
         if (map->mEndOfLastInputIntervalInInputStream != inputStart ||
             map->mEndOfLastInputIntervalInOutputStream != outputStart) {
           // Start of a new series of intervals where neither stream is blocked.
-          map->mEndOfConsumedInputTicks = TimeToTicksRoundDown(rate, inputStart) - 1;
+          map->mEndOfConsumedInputTicks = inputStart - 1;
         }
         TrackTicks inputStartTicks = map->mEndOfConsumedInputTicks;
         TrackTicks inputEndTicks = inputStartTicks + ticks;
         map->mEndOfConsumedInputTicks = inputEndTicks;
         map->mEndOfLastInputIntervalInInputStream = inputEnd;
         map->mEndOfLastInputIntervalInOutputStream = outputEnd;
 
         if (GraphImpl()->mFlushSourcesNow) {