bug 962719 provide frame ID service to clients r=roc
authorKarl Tomlinson <karlt+@karlt.net>
Fri, 07 Aug 2015 11:37:08 +1200
changeset 257987 e4cadc8dc05885a798be43019e0d9c75b4da572a
parent 257986 a4b1ad86a79b17dc18f6b2afa28c06ead84c58e5
child 257988 75e8c21a10e6b32da342afddaac184a5cb9f6fd5
push id29238
push userryanvm@gmail.com
push dateMon, 17 Aug 2015 13:06:57 +0000
treeherdermozilla-central@a6eeb28458fd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs962719
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 962719 provide frame ID service to clients r=roc
dom/media/VideoFrameContainer.h
--- a/dom/media/VideoFrameContainer.h
+++ b/dom/media/VideoFrameContainer.h
@@ -51,16 +51,25 @@ public:
     SetCurrentFrames(aIntrinsicSize, nsTArray<ImageContainer::NonOwningImage>());
   }
 
   void ClearCurrentFrame();
   // Time in seconds by which the last painted video frame was late by.
   // E.g. if the last painted frame should have been painted at time t,
   // but was actually painted at t+n, this returns n in seconds. Threadsafe.
   double GetFrameDelay();
+
+  // Returns a new frame ID for SetCurrentFrames().  The client must either
+  // call this on only one thread or provide barriers.  Do not use together
+  // with SetCurrentFrame().
+  ImageContainer::FrameID NewFrameID()
+  {
+    return ++mFrameID;
+  }
+
   // Call on main thread
   enum {
     INVALIDATE_DEFAULT,
     INVALIDATE_FORCE
   };
   void Invalidate() { InvalidateWithFlags(INVALIDATE_DEFAULT); }
   B2G_ACL_EXPORT void InvalidateWithFlags(uint32_t aFlags);
   B2G_ACL_EXPORT ImageContainer* GetImageContainer();
@@ -78,18 +87,18 @@ protected:
   // mMutex protects all the fields below.
   Mutex mMutex;
   // The intrinsic size is the ideal size which we should render the
   // ImageContainer's current Image at.
   // This can differ from the Image's actual size when the media resource
   // specifies that the Image should be stretched to have the correct aspect
   // ratio.
   gfxIntSize mIntrinsicSize;
-  // For SetCurrentFrame callers we maintain our own mFrameID which is auto-
-  // incremented at every SetCurrentFrame.
+  // We maintain our own mFrameID which is auto-incremented at every
+  // SetCurrentFrame() or NewFrameID() call.
   ImageContainer::FrameID mFrameID;
   // True when the intrinsic size has been changed by SetCurrentFrame() since
   // the last call to Invalidate().
   // The next call to Invalidate() will recalculate
   // and update the intrinsic size on the element, request a frame reflow and
   // then reset this flag.
   bool mIntrinsicSizeChanged;
   // True when the Image size has changed since the last time Invalidate() was