Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Unified Diff: trunk/src/content/renderer/media/video_frame_compositor.h

Issue 258383002: Revert 266822 "Remove dropped frame counting and task posting fr..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | trunk/src/content/renderer/media/video_frame_compositor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/content/renderer/media/video_frame_compositor.h
===================================================================
--- trunk/src/content/renderer/media/video_frame_compositor.h (revision 266950)
+++ trunk/src/content/renderer/media/video_frame_compositor.h (working copy)
@@ -8,29 +8,35 @@
#include "base/callback.h"
#include "base/memory/ref_counted.h"
#include "base/synchronization/lock.h"
-#include "cc/layers/video_frame_provider.h"
#include "content/common/content_export.h"
#include "ui/gfx/size.h"
+namespace base {
+class SingleThreadTaskRunner;
+}
+
+namespace cc {
+class VideoFrameProvider;
+}
+
namespace media {
class VideoFrame;
}
namespace content {
-// VideoFrameCompositor handles incoming frames by notifying the compositor and
-// dispatching callbacks when detecting changes in video frames.
+// VideoFrameCompositor handles incoming frames by notifying the compositor in a
+// thread-safe manner.
//
-// Typical usage is to deliver ready-to-be-displayed video frames to
+// Typical usage is to deliver the output of VideoRendererImpl to
// UpdateCurrentFrame() so that VideoFrameCompositor can take care of tracking
-// changes in video frames and firing callbacks as needed.
+// dropped frames and firing callbacks as needed.
//
-// While VideoFrameCompositor must live on the same thread as the compositor,
-// GetCurrentFrame() is callable from any thread to let clients access the
-// current frame for non-compositing purposes.
-class CONTENT_EXPORT VideoFrameCompositor
- : NON_EXPORTED_BASE(public cc::VideoFrameProvider) {
+// All APIs are callable from any thread.
+class CONTENT_EXPORT VideoFrameCompositor {
public:
+ // |compositor_task_runner| is the task runner of the compositor.
+ //
// |natural_size_changed_cb| is run with the new natural size of the video
// frame whenever a change in natural size is detected. It is not called the
// first time UpdateCurrentFrame() is called. Run on the same thread as the
@@ -44,31 +50,34 @@
// respect to why we don't call |natural_size_changed_cb| on the first frame.
// I suspect it was for historical reasons that no longer make sense.
VideoFrameCompositor(
+ const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner,
const base::Callback<void(gfx::Size)>& natural_size_changed_cb,
const base::Callback<void(bool)>& opacity_changed_cb);
- virtual ~VideoFrameCompositor();
+ ~VideoFrameCompositor();
- // cc::VideoFrameProvider implementation.
- //
- // NOTE: GetCurrentFrame() is safe to call from any thread.
- virtual void SetVideoFrameProviderClient(
- cc::VideoFrameProvider::Client* client) OVERRIDE;
- virtual scoped_refptr<media::VideoFrame> GetCurrentFrame() OVERRIDE;
- virtual void PutCurrentFrame(
- const scoped_refptr<media::VideoFrame>& frame) OVERRIDE;
+ cc::VideoFrameProvider* GetVideoFrameProvider();
// Updates the current frame and notifies the compositor.
void UpdateCurrentFrame(const scoped_refptr<media::VideoFrame>& frame);
- private:
- base::Callback<void(gfx::Size)> natural_size_changed_cb_;
- base::Callback<void(bool)> opacity_changed_cb_;
+ // Retrieves the last frame set via UpdateCurrentFrame() for non-compositing
+ // purposes (e.g., painting to a canvas).
+ //
+ // Note that the compositor retrieves frames via the cc::VideoFrameProvider
+ // interface instead of using this method.
+ scoped_refptr<media::VideoFrame> GetCurrentFrame();
- cc::VideoFrameProvider::Client* client_;
+ // Returns the number of frames dropped before the compositor was notified
+ // of a new frame.
+ uint32 GetFramesDroppedBeforeCompositorWasNotified();
- base::Lock lock_;
- scoped_refptr<media::VideoFrame> current_frame_;
+ void SetFramesDroppedBeforeCompositorWasNotifiedForTesting(
+ uint32 dropped_frames);
+ private:
+ class Internal;
+ Internal* internal_;
+
DISALLOW_COPY_AND_ASSIGN(VideoFrameCompositor);
};
« no previous file with comments | « no previous file | trunk/src/content/renderer/media/video_frame_compositor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698