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

Unified Diff: content/renderer/media/webmediaplayer_ms.h

Issue 1304863002: Revert of Preliminary change for new rtc rendering algorithm (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 | « content/renderer/media/video_capture_impl.cc ('k') | content/renderer/media/webmediaplayer_ms.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/webmediaplayer_ms.h
diff --git a/content/renderer/media/webmediaplayer_ms.h b/content/renderer/media/webmediaplayer_ms.h
index 3018113d86ad56cda6671c396b3e82314df9bfb8..3254f83ab3727352363088be8e1add1fccf00027 100644
--- a/content/renderer/media/webmediaplayer_ms.h
+++ b/content/renderer/media/webmediaplayer_ms.h
@@ -53,6 +53,7 @@
// WebKit client of this media player object.
class WebMediaPlayerMS
: public blink::WebMediaPlayer,
+ public cc::VideoFrameProvider,
public base::SupportsWeakPtr<WebMediaPlayerMS> {
public:
// Construct a WebMediaPlayerMS with reference to the client, and
@@ -61,10 +62,7 @@
blink::WebMediaPlayerClient* client,
base::WeakPtr<media::WebMediaPlayerDelegate> delegate,
media::MediaLog* media_log,
- scoped_ptr<MediaStreamRendererFactory> factory,
- const scoped_refptr<base::SingleThreadTaskRunner>&
- compositor_task_runner);
-
+ scoped_ptr<MediaStreamRendererFactory> factory);
virtual ~WebMediaPlayerMS();
virtual void load(LoadType load_type,
@@ -127,68 +125,16 @@
bool premultiply_alpha,
bool flip_y) override;
+ // VideoFrameProvider implementation.
+ void SetVideoFrameProviderClient(
+ cc::VideoFrameProvider::Client* client) override;
+ bool UpdateCurrentFrame(base::TimeTicks deadline_min,
+ base::TimeTicks deadline_max) override;
+ bool HasCurrentFrame() override;
+ scoped_refptr<media::VideoFrame> GetCurrentFrame() override;
+ void PutCurrentFrame() override;
+
private:
- class Compositor : public cc::VideoFrameProvider {
- public:
- explicit Compositor(const scoped_refptr<base::SingleThreadTaskRunner>&
- compositor_task_runner);
- ~Compositor() override;
-
- void EnqueueFrame(scoped_refptr<media::VideoFrame> const& frame);
-
- // Statistical data
- gfx::Size GetCurrentSize();
- base::TimeDelta GetCurrentTime();
- unsigned GetTotalFrameCount();
- unsigned GetDroppedFrameCount();
-
- // VideoFrameProvider implementation.
- void SetVideoFrameProviderClient(
- cc::VideoFrameProvider::Client* client) override;
- bool UpdateCurrentFrame(base::TimeTicks deadline_min,
- base::TimeTicks deadline_max) override;
- bool HasCurrentFrame() override;
- scoped_refptr<media::VideoFrame> GetCurrentFrame() override;
- void PutCurrentFrame() override;
-
- void StartRendering();
- void StopRendering();
-
- private:
- scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_;
-
- // A pointer back to the compositor to inform it about state changes. This
- // is not NULL while the compositor is actively using this webmediaplayer.
- cc::VideoFrameProvider::Client* video_frame_provider_client_;
-
- // |current_frame_| is updated only on compositor thread. The object it
- // holds can be freed on the compositor thread if it is the last to hold a
- // reference but media::VideoFrame is a thread-safe ref-pointer. It is
- // however read on the compositor and main thread so locking is required
- // around all modifications and all reads on the any thread.
- scoped_refptr<media::VideoFrame> current_frame_;
-
- // |current_frame_used_| is updated on compositor thread only.
- // It's used to track whether |current_frame_| was painted for detecting
- // when to increase |dropped_frame_count_|.
- bool current_frame_used_;
-
- // TODO(qiangchen): To be replaced by VRA.
- scoped_refptr<media::VideoFrame> staging_frame_;
-
- base::TimeTicks last_deadline_max_;
- unsigned total_frame_count_;
- unsigned dropped_frame_count_;
-
- bool paused_;
-
- media::SkCanvasVideoRenderer video_renderer_;
-
- // |current_frame_lock_| protects |current_frame_used_| and
- // |current_frame_|.
- base::Lock current_frame_lock_;
- };
-
// The callback for VideoFrameProvider to signal a new frame is available.
void OnFrameAvailable(const scoped_refptr<media::VideoFrame>& frame);
// Need repaint due to state change.
@@ -225,23 +171,36 @@
scoped_refptr<content::VideoFrameProvider> video_frame_provider_;
bool paused_;
+ // |current_frame_| is updated only on main thread. The object it holds
+ // can be freed on the compositor thread if it is the last to hold a
+ // reference but media::VideoFrame is a thread-safe ref-pointer. It is
+ // however read on the compositing thread so locking is required around all
+ // modifications on the main thread, and all reads on the compositing thread.
+ scoped_refptr<media::VideoFrame> current_frame_;
+ // |current_frame_used_| is updated on both main and compositing thread.
+ // It's used to track whether |current_frame_| was painted for detecting
+ // when to increase |dropped_frame_count_|.
+ bool current_frame_used_;
+ // |current_frame_lock_| protects |current_frame_used_| and |current_frame_|.
+ base::Lock current_frame_lock_;
+
scoped_ptr<cc_blink::WebLayerImpl> video_weblayer_;
+ // A pointer back to the compositor to inform it about state changes. This is
+ // not NULL while the compositor is actively using this webmediaplayer.
+ cc::VideoFrameProvider::Client* video_frame_provider_client_;
+
bool received_first_frame_;
+ base::TimeDelta current_time_;
+ unsigned total_frame_count_;
+ unsigned dropped_frame_count_;
+ media::SkCanvasVideoRenderer video_renderer_;
scoped_refptr<MediaStreamAudioRenderer> audio_renderer_;
- media::SkCanvasVideoRenderer video_renderer_;
-
scoped_refptr<media::MediaLog> media_log_;
scoped_ptr<MediaStreamRendererFactory> renderer_factory_;
-
- // WebMediaPlayerMS owns the Compositor instance, but the destructions of
- // compositor should take place on Compositor Thread.
- scoped_ptr<Compositor> compositor_;
-
- scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_;
DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerMS);
};
« no previous file with comments | « content/renderer/media/video_capture_impl.cc ('k') | content/renderer/media/webmediaplayer_ms.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698