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

Side by Side Diff: content/renderer/media/webmediaplayer_ms.h

Issue 2472273002: Move passing of WebRTC rendering frames from main thread to compositor thread (Closed)
Patch Set: perkj@ and qiangchen@ comments. Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_
6 #define CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_ 6 #define CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 29 matching lines...) Expand all
40 namespace gpu { 40 namespace gpu {
41 namespace gles2 { 41 namespace gles2 {
42 class GLES2Interface; 42 class GLES2Interface;
43 } 43 }
44 } 44 }
45 45
46 namespace content { 46 namespace content {
47 class MediaStreamAudioRenderer; 47 class MediaStreamAudioRenderer;
48 class MediaStreamRendererFactory; 48 class MediaStreamRendererFactory;
49 class MediaStreamVideoRenderer; 49 class MediaStreamVideoRenderer;
50 class RenderFrameObserver;
perkj_chrome 2016/11/14 15:19:55 This class does not seem to be used in this header
emircan 2016/11/14 22:43:32 Leftover from rebase. Removed.
50 class WebMediaPlayerMSCompositor; 51 class WebMediaPlayerMSCompositor;
51 52
52 // WebMediaPlayerMS delegates calls from WebCore::MediaPlayerPrivate to 53 // WebMediaPlayerMS delegates calls from WebCore::MediaPlayerPrivate to
53 // Chrome's media player when "src" is from media stream. 54 // Chrome's media player when "src" is from media stream.
54 // 55 //
55 // All calls to WebMediaPlayerMS methods must be from the main thread of 56 // All calls to WebMediaPlayerMS methods must be from the main thread of
56 // Renderer process. 57 // Renderer process.
57 // 58 //
58 // WebMediaPlayerMS works with multiple objects, the most important ones are: 59 // WebMediaPlayerMS works with multiple objects, the most important ones are:
59 // 60 //
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 bool copyVideoTextureToPlatformTexture(gpu::gles2::GLES2Interface* gl, 154 bool copyVideoTextureToPlatformTexture(gpu::gles2::GLES2Interface* gl,
154 unsigned int texture, 155 unsigned int texture,
155 unsigned int internal_format, 156 unsigned int internal_format,
156 unsigned int type, 157 unsigned int type,
157 bool premultiply_alpha, 158 bool premultiply_alpha,
158 bool flip_y) override; 159 bool flip_y) override;
159 160
160 private: 161 private:
161 friend class WebMediaPlayerMSTest; 162 friend class WebMediaPlayerMSTest;
162 163
163 // The callback for MediaStreamVideoRenderer to signal a new frame is 164 // Inner class used for transfering frames on compositor thread to
164 // available. 165 // |compositor_|.
165 void OnFrameAvailable(const scoped_refptr<media::VideoFrame>& frame); 166 class FrameDelivererOnCompositor;
167
168 void OnFirstFrameReceived(media::VideoRotation video_rotation,
169 bool is_opaque);
170 void OnOpacityChanged(bool is_opaque);
171
166 // Need repaint due to state change. 172 // Need repaint due to state change.
167 void RepaintInternal(); 173 void RepaintInternal();
168 174
169 // The callback for source to report error. 175 // The callback for source to report error.
170 void OnSourceError(); 176 void OnSourceError();
171 177
172 // Helpers that set the network/ready state and notifies the client if 178 // Helpers that set the network/ready state and notifies the client if
173 // they've changed. 179 // they've changed.
174 void SetNetworkState(blink::WebMediaPlayer::NetworkState state); 180 void SetNetworkState(blink::WebMediaPlayer::NetworkState state);
175 void SetReadyState(blink::WebMediaPlayer::ReadyState state); 181 void SetReadyState(blink::WebMediaPlayer::ReadyState state);
(...skipping 10 matching lines...) Expand all
186 192
187 blink::WebMediaPlayerClient* const client_; 193 blink::WebMediaPlayerClient* const client_;
188 194
189 // WebMediaPlayer notifies the |delegate_| of playback state changes using 195 // WebMediaPlayer notifies the |delegate_| of playback state changes using
190 // |delegate_id_|; an id provided after registering with the delegate. The 196 // |delegate_id_|; an id provided after registering with the delegate. The
191 // WebMediaPlayer may also receive directives (play, pause) from the delegate 197 // WebMediaPlayer may also receive directives (play, pause) from the delegate
192 // via the WebMediaPlayerDelegate::Observer interface after registration. 198 // via the WebMediaPlayerDelegate::Observer interface after registration.
193 const base::WeakPtr<media::WebMediaPlayerDelegate> delegate_; 199 const base::WeakPtr<media::WebMediaPlayerDelegate> delegate_;
194 int delegate_id_; 200 int delegate_id_;
195 201
202 std::unique_ptr<FrameDelivererOnCompositor> frame_deliverer_;
203
196 scoped_refptr<MediaStreamVideoRenderer> video_frame_provider_; // Weak 204 scoped_refptr<MediaStreamVideoRenderer> video_frame_provider_; // Weak
197 205
198 std::unique_ptr<cc_blink::WebLayerImpl> video_weblayer_; 206 std::unique_ptr<cc_blink::WebLayerImpl> video_weblayer_;
199 207
200 scoped_refptr<MediaStreamAudioRenderer> audio_renderer_; // Weak 208 scoped_refptr<MediaStreamAudioRenderer> audio_renderer_; // Weak
201 media::SkCanvasVideoRenderer video_renderer_; 209 media::SkCanvasVideoRenderer video_renderer_;
202 210
203 bool last_frame_opaque_;
204 bool paused_; 211 bool paused_;
205 bool render_frame_suspended_;
206 bool received_first_frame_;
207 media::VideoRotation video_rotation_; 212 media::VideoRotation video_rotation_;
208 213
209 scoped_refptr<media::MediaLog> media_log_; 214 scoped_refptr<media::MediaLog> media_log_;
210 215
211 std::unique_ptr<MediaStreamRendererFactory> renderer_factory_; 216 std::unique_ptr<MediaStreamRendererFactory> renderer_factory_;
212 217
213 const scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; 218 const scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_;
214 const scoped_refptr<base::TaskRunner> worker_task_runner_; 219 const scoped_refptr<base::TaskRunner> worker_task_runner_;
215 media::GpuVideoAcceleratorFactories* gpu_factories_; 220 media::GpuVideoAcceleratorFactories* gpu_factories_;
216 221
(...skipping 19 matching lines...) Expand all
236 // True if playback should be started upon the next call to OnShown(). Only 241 // True if playback should be started upon the next call to OnShown(). Only
237 // used on Android. 242 // used on Android.
238 bool should_play_upon_shown_; 243 bool should_play_upon_shown_;
239 244
240 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerMS); 245 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerMS);
241 }; 246 };
242 247
243 } // namespace content 248 } // namespace content
244 249
245 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_ 250 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698