| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_COMPOSITOR_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_COMPOSITOR_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_COMPOSITOR_H_ | 6 #define CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_COMPOSITOR_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 // frame, and submit it whenever asked by the compositor. | 50 // frame, and submit it whenever asked by the compositor. |
| 51 class CONTENT_EXPORT WebMediaPlayerMSCompositor | 51 class CONTENT_EXPORT WebMediaPlayerMSCompositor |
| 52 : public NON_EXPORTED_BASE(cc::VideoFrameProvider), | 52 : public NON_EXPORTED_BASE(cc::VideoFrameProvider), |
| 53 public base::RefCountedThreadSafe<WebMediaPlayerMSCompositor> { | 53 public base::RefCountedThreadSafe<WebMediaPlayerMSCompositor> { |
| 54 public: | 54 public: |
| 55 // This |url| represents the media stream we are rendering. |url| is used to | 55 // This |url| represents the media stream we are rendering. |url| is used to |
| 56 // find out what web stream this WebMediaPlayerMSCompositor is playing, and | 56 // find out what web stream this WebMediaPlayerMSCompositor is playing, and |
| 57 // together with flag "--disable-rtc-smoothness-algorithm" determine whether | 57 // together with flag "--disable-rtc-smoothness-algorithm" determine whether |
| 58 // we enable algorithm or not. | 58 // we enable algorithm or not. |
| 59 WebMediaPlayerMSCompositor( | 59 WebMediaPlayerMSCompositor( |
| 60 const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner, | 60 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner, |
| 61 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
| 61 const blink::WebMediaStream& web_stream, | 62 const blink::WebMediaStream& web_stream, |
| 62 const base::WeakPtr<WebMediaPlayerMS>& player); | 63 const base::WeakPtr<WebMediaPlayerMS>& player); |
| 63 | 64 |
| 64 void EnqueueFrame(scoped_refptr<media::VideoFrame> frame); | 65 void EnqueueFrame(scoped_refptr<media::VideoFrame> frame); |
| 65 | 66 |
| 66 // Statistical data | 67 // Statistical data |
| 67 gfx::Size GetCurrentSize(); | 68 gfx::Size GetCurrentSize(); |
| 68 base::TimeDelta GetCurrentTime(); | 69 base::TimeDelta GetCurrentTime(); |
| 69 size_t total_frame_count(); | 70 size_t total_frame_count(); |
| 70 size_t dropped_frame_count(); | 71 size_t dropped_frame_count(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 106 |
| 106 // For algorithm enabled case only: given the render interval, update | 107 // For algorithm enabled case only: given the render interval, update |
| 107 // current_frame_ and dropped_frame_count_. | 108 // current_frame_ and dropped_frame_count_. |
| 108 void Render(base::TimeTicks deadline_min, base::TimeTicks deadline_max); | 109 void Render(base::TimeTicks deadline_min, base::TimeTicks deadline_max); |
| 109 | 110 |
| 110 void SetCurrentFrame(const scoped_refptr<media::VideoFrame>& frame); | 111 void SetCurrentFrame(const scoped_refptr<media::VideoFrame>& frame); |
| 111 | 112 |
| 112 void StartRenderingInternal(); | 113 void StartRenderingInternal(); |
| 113 void StopRenderingInternal(); | 114 void StopRenderingInternal(); |
| 114 void StopUsingProviderInternal(); | 115 void StopUsingProviderInternal(); |
| 116 void ReplaceCurrentFrameWithACopyInternal(); |
| 115 | 117 |
| 116 void SetAlgorithmEnabledForTesting(bool algorithm_enabled); | 118 void SetAlgorithmEnabledForTesting(bool algorithm_enabled); |
| 117 | 119 |
| 118 // Used for DCHECKs to ensure method calls executed in the correct thread. | 120 // Used for DCHECKs to ensure method calls executed in the correct thread. |
| 119 base::ThreadChecker thread_checker_; | 121 base::ThreadChecker thread_checker_; |
| 120 base::ThreadChecker io_thread_checker_; | |
| 121 | 122 |
| 122 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; | 123 const scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; |
| 124 const scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
| 123 base::MessageLoop* main_message_loop_; | 125 base::MessageLoop* main_message_loop_; |
| 124 | 126 |
| 125 base::WeakPtr<WebMediaPlayerMS> player_; | 127 base::WeakPtr<WebMediaPlayerMS> player_; |
| 126 | 128 |
| 127 // TODO(qiangchen, emircan): It might be nice to use a real MediaLog here from | 129 // TODO(qiangchen, emircan): It might be nice to use a real MediaLog here from |
| 128 // the WebMediaPlayerMS instance, but it owns the MediaLog and this class has | 130 // the WebMediaPlayerMS instance, but it owns the MediaLog and this class has |
| 129 // non-deterministic destruction paths (either compositor or IO). | 131 // non-deterministic destruction paths (either compositor or IO). |
| 130 media::MediaLog media_log_; | 132 media::MediaLog media_log_; |
| 131 | 133 |
| 132 size_t serial_; | 134 size_t serial_; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 | 170 |
| 169 // |current_frame_lock_| protects |current_frame_used_by_compositor_|, | 171 // |current_frame_lock_| protects |current_frame_used_by_compositor_|, |
| 170 // |current_frame_|, and |rendering_frame_buffer_|. | 172 // |current_frame_|, and |rendering_frame_buffer_|. |
| 171 base::Lock current_frame_lock_; | 173 base::Lock current_frame_lock_; |
| 172 | 174 |
| 173 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerMSCompositor); | 175 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerMSCompositor); |
| 174 }; | 176 }; |
| 175 } // namespace content | 177 } // namespace content |
| 176 | 178 |
| 177 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_COMPOSITOR_H_ | 179 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_COMPOSITOR_H_ |
| OLD | NEW |