| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 // find out what web stream this WebMediaPlayerMSCompositor is playing, and | 53 // find out what web stream this WebMediaPlayerMSCompositor is playing, and |
| 54 // together with flag "--disable-rtc-smoothness-algorithm" determine whether | 54 // together with flag "--disable-rtc-smoothness-algorithm" determine whether |
| 55 // we enable algorithm or not. | 55 // we enable algorithm or not. |
| 56 WebMediaPlayerMSCompositor( | 56 WebMediaPlayerMSCompositor( |
| 57 const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner, | 57 const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner, |
| 58 const blink::WebMediaStream& web_stream, | 58 const blink::WebMediaStream& web_stream, |
| 59 const base::WeakPtr<WebMediaPlayerMS>& player); | 59 const base::WeakPtr<WebMediaPlayerMS>& player); |
| 60 | 60 |
| 61 ~WebMediaPlayerMSCompositor() override; | 61 ~WebMediaPlayerMSCompositor() override; |
| 62 | 62 |
| 63 void EnqueueFrame(const scoped_refptr<media::VideoFrame>& frame); | 63 void EnqueueFrame(scoped_refptr<media::VideoFrame> frame); |
| 64 | 64 |
| 65 // Statistical data | 65 // Statistical data |
| 66 gfx::Size GetCurrentSize(); | 66 gfx::Size GetCurrentSize(); |
| 67 base::TimeDelta GetCurrentTime(); | 67 base::TimeDelta GetCurrentTime(); |
| 68 size_t total_frame_count() const; | 68 size_t total_frame_count() const; |
| 69 size_t dropped_frame_count() const; | 69 size_t dropped_frame_count() const; |
| 70 | 70 |
| 71 // VideoFrameProvider implementation. | 71 // VideoFrameProvider implementation. |
| 72 void SetVideoFrameProviderClient( | 72 void SetVideoFrameProviderClient( |
| 73 cc::VideoFrameProvider::Client* client) override; | 73 cc::VideoFrameProvider::Client* client) override; |
| 74 bool UpdateCurrentFrame(base::TimeTicks deadline_min, | 74 bool UpdateCurrentFrame(base::TimeTicks deadline_min, |
| 75 base::TimeTicks deadline_max) override; | 75 base::TimeTicks deadline_max) override; |
| 76 bool HasCurrentFrame() override; | 76 bool HasCurrentFrame() override; |
| 77 scoped_refptr<media::VideoFrame> GetCurrentFrame() override; | 77 scoped_refptr<media::VideoFrame> GetCurrentFrame() override; |
| 78 void PutCurrentFrame() override; | 78 void PutCurrentFrame() override; |
| 79 | 79 |
| 80 // Return the current frame being rendered. | 80 // Return the current frame being rendered. |
| 81 // Difference between GetCurrentFrame(): GetCurrentFrame() is designed for | 81 // Difference between GetCurrentFrame(): GetCurrentFrame() is designed for |
| 82 // chrome compositor to pull frame from WebMediaPlayerMSCompositor, and thus | 82 // chrome compositor to pull frame from WebMediaPlayerMSCompositor, and thus |
| 83 // calling GetCurrentFrame() will affect statistics like |dropped_frames_| | 83 // calling GetCurrentFrame() will affect statistics like |dropped_frames_| |
| 84 // etc. Calling this function has no side effect. | 84 // etc. Calling this function has no side effect. |
| 85 scoped_refptr<media::VideoFrame> GetCurrentFrameWithoutUpdatingStatistics(); | 85 scoped_refptr<media::VideoFrame> GetCurrentFrameWithoutUpdatingStatistics(); |
| 86 | 86 |
| 87 void StartRendering(); | 87 void StartRendering(); |
| 88 void StopRendering(); | 88 void StopRendering(); |
| 89 void ReplaceCurrentFrameWithACopy(); | 89 void ReplaceCurrentFrameWithACopy(); |
| 90 | 90 |
| 91 base::WeakPtr<WebMediaPlayerMSCompositor> GetWeakPtr(); |
| 92 |
| 91 private: | 93 private: |
| 92 friend class WebMediaPlayerMSTest; | 94 friend class WebMediaPlayerMSTest; |
| 93 | 95 |
| 94 bool MapTimestampsToRenderTimeTicks( | 96 bool MapTimestampsToRenderTimeTicks( |
| 95 const std::vector<base::TimeDelta>& timestamps, | 97 const std::vector<base::TimeDelta>& timestamps, |
| 96 std::vector<base::TimeTicks>* wall_clock_times); | 98 std::vector<base::TimeTicks>* wall_clock_times); |
| 97 | 99 |
| 98 void SetCurrentFrame(const scoped_refptr<media::VideoFrame>& frame); | 100 void SetCurrentFrame(const scoped_refptr<media::VideoFrame>& frame); |
| 99 | 101 |
| 100 // For algorithm enabled case only: given the render interval, update | 102 // For algorithm enabled case only: given the render interval, update |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 151 |
| 150 bool stopped_; | 152 bool stopped_; |
| 151 | 153 |
| 152 std::map<base::TimeDelta, base::TimeTicks> timestamps_to_clock_times_; | 154 std::map<base::TimeDelta, base::TimeTicks> timestamps_to_clock_times_; |
| 153 | 155 |
| 154 // |current_frame_lock_| protects |current_frame_used_by_compositor_|, | 156 // |current_frame_lock_| protects |current_frame_used_by_compositor_|, |
| 155 // |current_frame_|, and |rendering_frame_buffer_|. | 157 // |current_frame_|, and |rendering_frame_buffer_|. |
| 156 base::Lock current_frame_lock_; | 158 base::Lock current_frame_lock_; |
| 157 | 159 |
| 158 // Make sure the weak pointer factory member is the last member of the class. | 160 // Make sure the weak pointer factory member is the last member of the class. |
| 159 base::WeakPtrFactory<WebMediaPlayerMSCompositor> weak_ptr_factory_; | 161 base::WeakPtrFactory<WebMediaPlayerMSCompositor> weak_factory_for_compositor_; |
| 160 | 162 |
| 161 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerMSCompositor); | 163 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerMSCompositor); |
| 162 }; | 164 }; |
| 163 } // namespace content | 165 } // namespace content |
| 164 | 166 |
| 165 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_COMPOSITOR_H_ | 167 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_COMPOSITOR_H_ |
| OLD | NEW |