Bug 1189506. Remove INCLUDE_TRAILING_BLOCKED_INTERVAL from PlayVideo. r=karlt
authorRobert O'Callahan <robert@ocallahan.org>
Tue, 08 Sep 2015 16:42:42 +1200
changeset 295517 04c37cfa2299a6bd18a9f8a122120d605c81e5d2
parent 295516 c9d2999a87739e3edd120cbd6ccbc3555fb43044
child 295518 1cd584f42eeefc8f394c664d7f80f69a683931ef
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 INCLUDE_TRAILING_BLOCKED_INTERVAL from PlayVideo. r=karlt A video frame whose timestamp is right at mStartBlocking should just be rendered then, not delayed until the end of blocking.
dom/media/MediaStreamGraph.cpp
dom/media/MediaStreamGraphImpl.h
--- a/dom/media/MediaStreamGraph.cpp
+++ b/dom/media/MediaStreamGraph.cpp
@@ -226,29 +226,27 @@ MediaStreamGraphImpl::GraphTimeToStreamT
   MOZ_ASSERT(aTime <= mStateComputedTime,
              "Don't ask about times where we haven't made blocking decisions yet");
   return std::max<StreamTime>(0,
       std::min(aTime, aStream->mStartBlocking) - aStream->mBufferStartTime);
 }
 
 GraphTime
 MediaStreamGraphImpl::StreamTimeToGraphTimeWithBlocking(MediaStream* aStream,
-    StreamTime aTime, uint32_t aFlags)
+    StreamTime aTime)
 {
   // Avoid overflows
   if (aTime >= STREAM_TIME_MAX) {
     return GRAPH_TIME_MAX;
   }
 
   // Assume we're unblocked from 0..mStartBlocking, blocked from mStartBlocking
   // to mStateComputedTime, and unblocked from mStateComputedTime..forever
   GraphTime timeAssumingNoBlocking = aTime + aStream->mBufferStartTime;
-  if (timeAssumingNoBlocking < aStream->mStartBlocking ||
-      (timeAssumingNoBlocking == aStream->mStartBlocking &&
-             !(aFlags & INCLUDE_TRAILING_BLOCKED_INTERVAL))) {
+  if (timeAssumingNoBlocking <= aStream->mStartBlocking) {
     return timeAssumingNoBlocking;
   }
   // XXX we generally shouldn't need to call this for aTime >= mStartBlocking!
   // Check callers.
 
   return timeAssumingNoBlocking + (mStateComputedTime - aStream->mStartBlocking);
 }
 
@@ -830,18 +828,17 @@ MediaStreamGraphImpl::PlayVideo(MediaStr
     STREAM_LOG(LogLevel::Verbose,
                ("MediaStream %p writing video frame %p (%dx%d)",
                 aStream, image, frame->GetIntrinsicSize().width,
                 frame->GetIntrinsicSize().height));
     // Schedule this frame after the previous frame finishes, instead of at
     // its start time.  These times only differ in the case of multiple
     // tracks.
     GraphTime frameTime =
-      StreamTimeToGraphTimeWithBlocking(aStream, frameBufferTime,
-                            INCLUDE_TRAILING_BLOCKED_INTERVAL);
+      StreamTimeToGraphTimeWithBlocking(aStream, frameBufferTime);
     TimeStamp targetTime = currentTimeStamp +
       TimeDuration::FromSeconds(MediaTimeToSeconds(frameTime - IterationEnd()));
 
     if (frame->GetForceBlack()) {
       if (!blackImage) {
         blackImage = aStream->mVideoOutputs[0]->
           GetImageContainer()->CreateImage(ImageFormat::PLANAR_YCBCR);
         if (blackImage) {
@@ -1710,17 +1707,17 @@ StreamTime
 MediaStream::GraphTimeToStreamTimeWithBlocking(GraphTime aTime)
 {
   return GraphImpl()->GraphTimeToStreamTimeWithBlocking(this, aTime);
 }
 
 GraphTime
 MediaStream::StreamTimeToGraphTimeWithBlocking(StreamTime aTime)
 {
-  return GraphImpl()->StreamTimeToGraphTimeWithBlocking(this, aTime, 0);
+  return GraphImpl()->StreamTimeToGraphTimeWithBlocking(this, aTime);
 }
 
 void
 MediaStream::FinishOnGraphThread()
 {
   GraphImpl()->FinishStream(this);
 }
 
--- a/dom/media/MediaStreamGraphImpl.h
+++ b/dom/media/MediaStreamGraphImpl.h
@@ -319,32 +319,24 @@ public:
    */
   GraphTime WillUnderrun(MediaStream* aStream, GraphTime aEndBlockingDecisions);
 
   /**
    * Given a graph time aTime, convert it to a stream time taking into
    * account the time during which aStream is scheduled to be blocked.
    */
   StreamTime GraphTimeToStreamTimeWithBlocking(MediaStream* aStream, GraphTime aTime);
-  enum
-  {
-    INCLUDE_TRAILING_BLOCKED_INTERVAL = 0x01
-  };
-
   /**
    * Given a stream time aTime, convert it to a graph time taking into
    * account the time during which aStream is scheduled to be blocked.
    * aTime must be <= mStateComputedTime since blocking decisions
    * are only known up to that point.
-   * If aTime is exactly at the start of a blocked interval, then the blocked
-   * interval is included in the time returned if and only if
-   * aFlags includes INCLUDE_TRAILING_BLOCKED_INTERVAL.
    */
-  GraphTime StreamTimeToGraphTimeWithBlocking(MediaStream* aStream, StreamTime aTime,
-                                  uint32_t aFlags = 0);
+  GraphTime StreamTimeToGraphTimeWithBlocking(MediaStream* aStream, StreamTime aTime);
+
   /**
    * Call NotifyHaveCurrentData on aStream's listeners.
    */
   void NotifyHasCurrentData(MediaStream* aStream);
   /**
    * If aStream needs an audio stream but doesn't have one, create it.
    * If aStream doesn't need an audio stream but has one, destroy it.
    */