| Index: content/renderer/media/webmediaplayer_ms_compositor.h
|
| diff --git a/content/renderer/media/webmediaplayer_ms_compositor.h b/content/renderer/media/webmediaplayer_ms_compositor.h
|
| index cf38aa5baeb2ea0d15f13482633c8dfd7363b0c8..ff71f7f4cf41f56700781d7381a6781f34e2cdb5 100644
|
| --- a/content/renderer/media/webmediaplayer_ms_compositor.h
|
| +++ b/content/renderer/media/webmediaplayer_ms_compositor.h
|
| @@ -39,7 +39,7 @@ class WebMediaPlayerMS;
|
|
|
| // This class is designed to handle the work load on compositor thread for
|
| // WebMediaPlayerMS. It will be instantiated on the main thread, but destroyed
|
| -// on the compositor thread.
|
| +// on the thread holding the last reference.
|
| //
|
| // WebMediaPlayerMSCompositor utilizes VideoRendererAlgorithm to store the
|
| // incoming frames and select the best frame for rendering to maximize the
|
| @@ -47,7 +47,8 @@ class WebMediaPlayerMS;
|
| // Otherwise, WebMediaPlayerMSCompositor will simply store the most recent
|
| // frame, and submit it whenever asked by the compositor.
|
| class CONTENT_EXPORT WebMediaPlayerMSCompositor
|
| - : public NON_EXPORTED_BASE(cc::VideoFrameProvider) {
|
| + : public NON_EXPORTED_BASE(cc::VideoFrameProvider),
|
| + public base::RefCountedThreadSafe<WebMediaPlayerMSCompositor> {
|
| public:
|
| // This |url| represents the media stream we are rendering. |url| is used to
|
| // find out what web stream this WebMediaPlayerMSCompositor is playing, and
|
| @@ -58,8 +59,6 @@ class CONTENT_EXPORT WebMediaPlayerMSCompositor
|
| const blink::WebMediaStream& web_stream,
|
| const base::WeakPtr<WebMediaPlayerMS>& player);
|
|
|
| - ~WebMediaPlayerMSCompositor() override;
|
| -
|
| void EnqueueFrame(scoped_refptr<media::VideoFrame> frame);
|
|
|
| // Statistical data
|
| @@ -88,26 +87,35 @@ class CONTENT_EXPORT WebMediaPlayerMSCompositor
|
| void StopRendering();
|
| void ReplaceCurrentFrameWithACopy();
|
|
|
| + // Tell |video_frame_provider_client_| to stop using this instance in
|
| + // preparation for dtor.
|
| + void StopUsingProvider();
|
| +
|
| private:
|
| + friend class base::RefCountedThreadSafe<WebMediaPlayerMSCompositor>;
|
| friend class WebMediaPlayerMSTest;
|
|
|
| + ~WebMediaPlayerMSCompositor() override;
|
| +
|
| bool MapTimestampsToRenderTimeTicks(
|
| const std::vector<base::TimeDelta>& timestamps,
|
| std::vector<base::TimeTicks>* wall_clock_times);
|
|
|
| - void SetCurrentFrame(const scoped_refptr<media::VideoFrame>& frame);
|
| -
|
| // For algorithm enabled case only: given the render interval, update
|
| // current_frame_ and dropped_frame_count_.
|
| void Render(base::TimeTicks deadline_min, base::TimeTicks deadline_max);
|
|
|
| + void SetCurrentFrame(const scoped_refptr<media::VideoFrame>& frame);
|
| +
|
| void StartRenderingInternal();
|
| void StopRenderingInternal();
|
| + void StopUsingProviderInternal();
|
|
|
| void SetAlgorithmEnabledForTesting(bool algorithm_enabled);
|
|
|
| // Used for DCHECKs to ensure method calls executed in the correct thread.
|
| base::ThreadChecker thread_checker_;
|
| + base::ThreadChecker io_thread_checker_;
|
|
|
| scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_;
|
| base::MessageLoop* main_message_loop_;
|
| @@ -155,9 +163,6 @@ class CONTENT_EXPORT WebMediaPlayerMSCompositor
|
| // |current_frame_|, and |rendering_frame_buffer_|.
|
| base::Lock current_frame_lock_;
|
|
|
| - // Make sure the weak pointer factory member is the last member of the class.
|
| - base::WeakPtrFactory<WebMediaPlayerMSCompositor> weak_ptr_factory_;
|
| -
|
| DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerMSCompositor);
|
| };
|
| } // namespace content
|
|
|