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