bug 1205558 introduce SecondsToNearestStreamTime r=padenot
authorKarl Tomlinson <karlt+@karlt.net>
Fri, 18 Sep 2015 15:42:00 +1200
changeset 265089 c47751b43a71927d2df84074ce2d1114c65e6323
parent 265088 33053d791e56928a4906949ff4ee15681edf935b
child 265090 13e85dc6b41bf1ce0a6f1d50e290b6159dd79786
push id65838
push userktomlinson@mozilla.com
push dateWed, 30 Sep 2015 00:43:54 +0000
treeherdermozilla-inbound@f1f82e673a34 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1205558
milestone44.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 1205558 introduce SecondsToNearestStreamTime r=padenot
dom/media/MediaStreamGraph.h
--- a/dom/media/MediaStreamGraph.h
+++ b/dom/media/MediaStreamGraph.h
@@ -482,16 +482,22 @@ public:
     NS_ASSERTION(0 <= aTime && aTime <= STREAM_TIME_MAX, "Bad time");
     return static_cast<double>(aTime)/mBuffer.GraphRate();
   }
   int64_t StreamTimeToMicroseconds(StreamTime aTime)
   {
     NS_ASSERTION(0 <= aTime && aTime <= STREAM_TIME_MAX, "Bad time");
     return (aTime*1000000)/mBuffer.GraphRate();
   }
+  StreamTime SecondsToNearestStreamTime(double aSeconds)
+  {
+    NS_ASSERTION(0 <= aSeconds && aSeconds <= TRACK_TICKS_MAX/TRACK_RATE_MAX,
+                 "Bad seconds");
+    return mBuffer.GraphRate() * aSeconds + 0.5;
+  }
   StreamTime MicrosecondsToStreamTimeRoundDown(int64_t aMicroseconds) {
     return (aMicroseconds*mBuffer.GraphRate())/1000000;
   }
 
   TrackTicks TimeToTicksRoundUp(TrackRate aRate, StreamTime aTime)
   {
     return RateConvertTicksRoundUp(aRate, mBuffer.GraphRate(), aTime);
   }