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

Side by Side Diff: webkit/media/android/webmediaplayer_android.h

Issue 14247018: Implement WebRTC in Chrome for TV (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Dongwon and Yuncheol's comments Created 7 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ 5 #ifndef WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_
6 #define WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ 6 #define WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/message_loop.h" 13 #include "base/message_loop.h"
14 #include "base/time.h" 14 #include "base/time.h"
15 #if defined(GOOGLE_TV)
16 #include "media/base/demuxer_stream.h"
17 #endif
18 #include "cc/layers/video_frame_provider.h" 15 #include "cc/layers/video_frame_provider.h"
16 #include "media/base/android/media_player_bridge.h"
19 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h" 17 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h"
20 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" 18 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h"
21 #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h" 19 #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h"
22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayer.h" 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayer.h"
23 #include "ui/gfx/rect_f.h" 21 #include "ui/gfx/rect_f.h"
24 #include "webkit/media/android/stream_texture_factory_android.h" 22 #include "webkit/media/android/stream_texture_factory_android.h"
25 23
24 #if defined(GOOGLE_TV)
25 #include "webkit/media/android/media_source_delegate.h"
26 #endif
27
26 namespace media { 28 namespace media {
29 class Demuxer;
27 class MediaLog; 30 class MediaLog;
28 } 31 }
29 32
30 namespace WebKit { 33 namespace WebKit {
31 class WebFrame; 34 class WebFrame;
32 } 35 }
33 36
34 namespace webkit { 37 namespace webkit {
35 class WebLayerImpl; 38 class WebLayerImpl;
36 } 39 }
37 40
38 namespace webkit_media { 41 namespace webkit_media {
39 42
40 #if defined(GOOGLE_TV) 43 #if defined(GOOGLE_TV)
41 class MediaSourceDelegate; 44 class MediaStreamAudioRenderer;
42 #endif 45 #endif
46 class MediaStreamClient;
43 class WebMediaPlayerManagerAndroid; 47 class WebMediaPlayerManagerAndroid;
44 class WebMediaPlayerProxyAndroid; 48 class WebMediaPlayerProxyAndroid;
45 49
46 // This class implements WebKit::WebMediaPlayer by keeping the android 50 // This class implements WebKit::WebMediaPlayer by keeping the android
47 // media player in the browser process. It listens to all the status changes 51 // media player in the browser process. It listens to all the status changes
48 // sent from the browser process and sends playback controls to the media 52 // sent from the browser process and sends playback controls to the media
49 // player. 53 // player.
50 class WebMediaPlayerAndroid 54 class WebMediaPlayerAndroid
51 : public WebKit::WebMediaPlayer, 55 : public WebKit::WebMediaPlayer,
52 public cc::VideoFrameProvider, 56 public cc::VideoFrameProvider,
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 unsigned key_length, 201 unsigned key_length,
198 const unsigned char* init_data, 202 const unsigned char* init_data,
199 unsigned init_data_length, 203 unsigned init_data_length,
200 const WebKit::WebString& session_id) OVERRIDE; 204 const WebKit::WebString& session_id) OVERRIDE;
201 virtual MediaKeyException cancelKeyRequest( 205 virtual MediaKeyException cancelKeyRequest(
202 const WebKit::WebString& key_system, 206 const WebKit::WebString& key_system,
203 const WebKit::WebString& session_id) OVERRIDE; 207 const WebKit::WebString& session_id) OVERRIDE;
204 208
205 // Called when DemuxerStreamPlayer needs to read data from ChunkDemuxer. 209 // Called when DemuxerStreamPlayer needs to read data from ChunkDemuxer.
206 void OnReadFromDemuxer(media::DemuxerStream::Type type, bool seek_done); 210 void OnReadFromDemuxer(media::DemuxerStream::Type type, bool seek_done);
211
212 bool InjectMediaStream(MediaStreamClient* media_stream_client,
213 media::Demuxer* demuxer,
214 const base::Closure& destroy_demuxer_cb);
207 #endif 215 #endif
208 216
209 protected: 217 protected:
210 // Helper method to update the playing state. 218 // Helper method to update the playing state.
211 void UpdatePlayingState(bool is_playing_); 219 void UpdatePlayingState(bool is_playing_);
212 220
213 // Helper methods for posting task for setting states and update WebKit. 221 // Helper methods for posting task for setting states and update WebKit.
214 void UpdateNetworkState(WebKit::WebMediaPlayer::NetworkState state); 222 void UpdateNetworkState(WebKit::WebMediaPlayer::NetworkState state);
215 void UpdateReadyState(WebKit::WebMediaPlayer::ReadyState state); 223 void UpdateReadyState(WebKit::WebMediaPlayer::ReadyState state);
216 224
217 // Helper method to reestablish the surface texture peer for android 225 // Helper method to reestablish the surface texture peer for android
218 // media player. 226 // media player.
219 void EstablishSurfaceTexturePeer(); 227 void EstablishSurfaceTexturePeer();
220 228
221 // Requesting whether the surface texture peer needs to be reestablished. 229 // Requesting whether the surface texture peer needs to be reestablished.
222 void SetNeedsEstablishPeer(bool needs_establish_peer); 230 void SetNeedsEstablishPeer(bool needs_establish_peer);
223 231
232 void InitializeMediaPlayer(
233 const WebKit::WebURL& url,
234 media::MediaPlayerAndroid::MediaSourceType media_source_type);
235
224 #if defined(GOOGLE_TV) 236 #if defined(GOOGLE_TV)
225 // Request external surface for out-of-band composition. 237 // Request external surface for out-of-band composition.
226 void RequestExternalSurface(); 238 void RequestExternalSurface();
227 #endif 239 #endif
228 240
229 private: 241 private:
230 void ReallocateVideoFrame(); 242 void ReallocateVideoFrame();
231 243
232 WebKit::WebFrame* const frame_; 244 WebKit::WebFrame* const frame_;
233 245
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 // not NULL while the compositor is actively using this webmediaplayer. 311 // not NULL while the compositor is actively using this webmediaplayer.
300 cc::VideoFrameProvider::Client* video_frame_provider_client_; 312 cc::VideoFrameProvider::Client* video_frame_provider_client_;
301 313
302 scoped_ptr<webkit::WebLayerImpl> video_weblayer_; 314 scoped_ptr<webkit::WebLayerImpl> video_weblayer_;
303 315
304 #if defined(GOOGLE_TV) 316 #if defined(GOOGLE_TV)
305 // A rectangle represents the geometry of video frame, when computed last 317 // A rectangle represents the geometry of video frame, when computed last
306 // time. 318 // time.
307 gfx::RectF last_computed_rect_; 319 gfx::RectF last_computed_rect_;
308 320
321 // Media Source / Media Stream related fields.
309 scoped_ptr<MediaSourceDelegate> media_source_delegate_; 322 scoped_ptr<MediaSourceDelegate> media_source_delegate_;
323 media::Demuxer* demuxer_;
324 base::Closure destroy_demuxer_cb_;
310 #endif 325 #endif
311 326
312 // Proxy object that delegates method calls on Render Thread. 327 // Proxy object that delegates method calls on Render Thread.
313 // This object is created on the Render Thread and is only called in the 328 // This object is created on the Render Thread and is only called in the
314 // destructor. 329 // destructor.
315 WebMediaPlayerProxyAndroid* proxy_; 330 WebMediaPlayerProxyAndroid* proxy_;
316 331
317 // The current playing time. Because the media player is in the browser 332 // The current playing time. Because the media player is in the browser
318 // process, it will regularly update the |current_time_| by calling 333 // process, it will regularly update the |current_time_| by calling
319 // OnTimeUpdate(). 334 // OnTimeUpdate().
320 float current_time_; 335 float current_time_;
321 336
322 media::MediaLog* media_log_; 337 media::MediaLog* media_log_;
338 MediaStreamClient* media_stream_client_;
323 339
324 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); 340 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid);
325 }; 341 };
326 342
327 } // namespace webkit_media 343 } // namespace webkit_media
328 344
329 #endif // WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ 345 #endif // WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698