OLD | NEW |
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_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
6 #define CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 6 #define CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "content/public/renderer/render_frame_observer.h" | 21 #include "content/public/renderer/render_frame_observer.h" |
22 #include "content/renderer/media/android/media_info_loader.h" | 22 #include "content/renderer/media/android/media_info_loader.h" |
23 #include "content/renderer/media/android/media_source_delegate.h" | 23 #include "content/renderer/media/android/media_source_delegate.h" |
24 #include "content/renderer/media/android/stream_texture_factory.h" | 24 #include "content/renderer/media/android/stream_texture_factory.h" |
25 #include "gpu/command_buffer/common/mailbox.h" | 25 #include "gpu/command_buffer/common/mailbox.h" |
26 #include "media/base/android/media_player_android.h" | 26 #include "media/base/android/media_player_android.h" |
27 #include "media/base/cdm_context.h" | 27 #include "media/base/cdm_context.h" |
28 #include "media/base/demuxer_stream.h" | 28 #include "media/base/demuxer_stream.h" |
29 #include "media/base/media_keys.h" | 29 #include "media/base/media_keys.h" |
30 #include "media/base/time_delta_interpolator.h" | 30 #include "media/base/time_delta_interpolator.h" |
31 #include "media/blink/webmediaplayer_params.h" | |
32 #include "media/blink/webmediaplayer_util.h" | 31 #include "media/blink/webmediaplayer_util.h" |
33 #include "media/cdm/proxy_decryptor.h" | 32 #include "media/cdm/proxy_decryptor.h" |
34 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 33 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
35 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" | 34 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" |
36 #include "third_party/WebKit/public/platform/WebSize.h" | 35 #include "third_party/WebKit/public/platform/WebSize.h" |
37 #include "third_party/WebKit/public/platform/WebURL.h" | 36 #include "third_party/WebKit/public/platform/WebURL.h" |
38 #include "third_party/skia/include/core/SkBitmap.h" | 37 #include "third_party/skia/include/core/SkBitmap.h" |
39 #include "ui/gfx/geometry/rect_f.h" | 38 #include "ui/gfx/geometry/rect_f.h" |
40 | 39 |
41 namespace base { | 40 namespace base { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // player can enter fullscreen. This logic should probably be moved into | 87 // player can enter fullscreen. This logic should probably be moved into |
89 // blink, so that enterFullscreen() will not be called if another video is | 88 // blink, so that enterFullscreen() will not be called if another video is |
90 // already in fullscreen. | 89 // already in fullscreen. |
91 WebMediaPlayerAndroid( | 90 WebMediaPlayerAndroid( |
92 blink::WebFrame* frame, | 91 blink::WebFrame* frame, |
93 blink::WebMediaPlayerClient* client, | 92 blink::WebMediaPlayerClient* client, |
94 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client, | 93 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client, |
95 base::WeakPtr<media::WebMediaPlayerDelegate> delegate, | 94 base::WeakPtr<media::WebMediaPlayerDelegate> delegate, |
96 RendererMediaPlayerManager* player_manager, | 95 RendererMediaPlayerManager* player_manager, |
97 media::CdmFactory* cdm_factory, | 96 media::CdmFactory* cdm_factory, |
| 97 media::MediaPermission* media_permission, |
| 98 blink::WebContentDecryptionModule* initial_cdm, |
98 scoped_refptr<StreamTextureFactory> factory, | 99 scoped_refptr<StreamTextureFactory> factory, |
99 const media::WebMediaPlayerParams& params); | 100 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 101 media::MediaLog* media_log); |
100 virtual ~WebMediaPlayerAndroid(); | 102 virtual ~WebMediaPlayerAndroid(); |
101 | 103 |
102 // blink::WebMediaPlayer implementation. | 104 // blink::WebMediaPlayer implementation. |
103 virtual bool supportsOverlayFullscreenVideo(); | 105 virtual bool supportsOverlayFullscreenVideo(); |
104 virtual void enterFullscreen(); | 106 virtual void enterFullscreen(); |
105 | 107 |
106 // Resource loading. | 108 // Resource loading. |
107 virtual void load(LoadType load_type, | 109 virtual void load(LoadType load_type, |
108 const blink::WebURL& url, | 110 const blink::WebURL& url, |
109 CORSMode cors_mode); | 111 CORSMode cors_mode); |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 // pipeline/decoders. | 336 // pipeline/decoders. |
335 void ContentDecryptionModuleAttached( | 337 void ContentDecryptionModuleAttached( |
336 blink::WebContentDecryptionModuleResult result, | 338 blink::WebContentDecryptionModuleResult result, |
337 bool success); | 339 bool success); |
338 | 340 |
339 bool IsHLSStream() const; | 341 bool IsHLSStream() const; |
340 // Report whether the loaded url, after following redirects, points to a HLS | 342 // Report whether the loaded url, after following redirects, points to a HLS |
341 // playlist, and record the origin of the player. | 343 // playlist, and record the origin of the player. |
342 void ReportHLSMetrics() const; | 344 void ReportHLSMetrics() const; |
343 | 345 |
344 // Called after |defer_load_cb_| has decided to allow the load. If | |
345 // |defer_load_cb_| is null this is called immediately. | |
346 void DoLoad(LoadType load_type, const blink::WebURL& url, CORSMode cors_mode); | |
347 | |
348 blink::WebFrame* const frame_; | 346 blink::WebFrame* const frame_; |
349 | 347 |
350 blink::WebMediaPlayerClient* const client_; | 348 blink::WebMediaPlayerClient* const client_; |
351 blink::WebMediaPlayerEncryptedMediaClient* const encrypted_client_; | 349 blink::WebMediaPlayerEncryptedMediaClient* const encrypted_client_; |
352 | 350 |
353 // |delegate_| is used to notify the browser process of the player status, so | 351 // |delegate_| is used to notify the browser process of the player status, so |
354 // that the browser process can control screen locks. | 352 // that the browser process can control screen locks. |
355 // TODO(qinmin): Currently android mediaplayer takes care of the screen | 353 // TODO(qinmin): Currently android mediaplayer takes care of the screen |
356 // lock. So this is only used for media source. Will apply this to regular | 354 // lock. So this is only used for media source. Will apply this to regular |
357 // media tag once http://crbug.com/247892 is fixed. | 355 // media tag once http://crbug.com/247892 is fixed. |
358 base::WeakPtr<media::WebMediaPlayerDelegate> delegate_; | 356 base::WeakPtr<media::WebMediaPlayerDelegate> delegate_; |
359 | 357 |
360 // Callback responsible for determining if loading of media should be deferred | |
361 // for external reasons; called during load(). | |
362 media::WebMediaPlayerParams::DeferLoadCB defer_load_cb_; | |
363 | |
364 // Save the list of buffered time ranges. | 358 // Save the list of buffered time ranges. |
365 blink::WebTimeRanges buffered_; | 359 blink::WebTimeRanges buffered_; |
366 | 360 |
367 // Size of the video. | 361 // Size of the video. |
368 blink::WebSize natural_size_; | 362 blink::WebSize natural_size_; |
369 | 363 |
370 // Size that has been sent to StreamTexture. | 364 // Size that has been sent to StreamTexture. |
371 blink::WebSize cached_stream_texture_size_; | 365 blink::WebSize cached_stream_texture_size_; |
372 | 366 |
373 // The video frame object used for rendering by the compositor. | 367 // The video frame object used for rendering by the compositor. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 | 432 |
439 // Whether the media player is playing. | 433 // Whether the media player is playing. |
440 bool is_playing_; | 434 bool is_playing_; |
441 | 435 |
442 // Whether media player needs to re-establish the surface texture peer. | 436 // Whether media player needs to re-establish the surface texture peer. |
443 bool needs_establish_peer_; | 437 bool needs_establish_peer_; |
444 | 438 |
445 // Whether the video size info is available. | 439 // Whether the video size info is available. |
446 bool has_size_info_; | 440 bool has_size_info_; |
447 | 441 |
448 const scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; | 442 const scoped_refptr<base::SingleThreadTaskRunner> compositor_loop_; |
449 | 443 |
450 // Object for allocating stream textures. | 444 // Object for allocating stream textures. |
451 scoped_refptr<StreamTextureFactory> stream_texture_factory_; | 445 scoped_refptr<StreamTextureFactory> stream_texture_factory_; |
452 | 446 |
453 // Object for calling back the compositor thread to repaint the video when a | 447 // Object for calling back the compositor thread to repaint the video when a |
454 // frame available. It should be initialized on the compositor thread. | 448 // frame available. It should be initialized on the compositor thread. |
455 // Accessed on main thread and on compositor thread when main thread is | 449 // Accessed on main thread and on compositor thread when main thread is |
456 // blocked. | 450 // blocked. |
457 ScopedStreamTextureProxy stream_texture_proxy_; | 451 ScopedStreamTextureProxy stream_texture_proxy_; |
458 | 452 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 | 524 |
531 // NOTE: Weak pointers must be invalidated before all other member variables. | 525 // NOTE: Weak pointers must be invalidated before all other member variables. |
532 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; | 526 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; |
533 | 527 |
534 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); | 528 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); |
535 }; | 529 }; |
536 | 530 |
537 } // namespace content | 531 } // namespace content |
538 | 532 |
539 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 533 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
OLD | NEW |