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> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/threading/thread_checker.h" |
16 #include "base/time/time.h" | 17 #include "base/time/time.h" |
17 #include "cc/layers/video_frame_provider.h" | 18 #include "cc/layers/video_frame_provider.h" |
18 #include "content/common/media/media_player_messages_enums_android.h" | 19 #include "content/common/media/media_player_messages_enums_android.h" |
19 #include "content/public/renderer/render_frame_observer.h" | 20 #include "content/public/renderer/render_frame_observer.h" |
20 #include "content/renderer/media/android/media_info_loader.h" | 21 #include "content/renderer/media/android/media_info_loader.h" |
21 #include "content/renderer/media/android/media_source_delegate.h" | 22 #include "content/renderer/media/android/media_source_delegate.h" |
22 #include "content/renderer/media/android/stream_texture_factory.h" | 23 #include "content/renderer/media/android/stream_texture_factory.h" |
23 #include "content/renderer/media/crypto/proxy_decryptor.h" | 24 #include "content/renderer/media/crypto/proxy_decryptor.h" |
24 #include "gpu/command_buffer/common/mailbox.h" | 25 #include "gpu/command_buffer/common/mailbox.h" |
25 #include "media/base/android/media_player_android.h" | 26 #include "media/base/android/media_player_android.h" |
26 #include "media/base/demuxer_stream.h" | 27 #include "media/base/demuxer_stream.h" |
27 #include "media/base/media_keys.h" | 28 #include "media/base/media_keys.h" |
28 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 29 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
29 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" | 30 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" |
30 #include "third_party/WebKit/public/platform/WebSize.h" | 31 #include "third_party/WebKit/public/platform/WebSize.h" |
31 #include "third_party/WebKit/public/platform/WebURL.h" | 32 #include "third_party/WebKit/public/platform/WebURL.h" |
32 #include "third_party/skia/include/core/SkBitmap.h" | 33 #include "third_party/skia/include/core/SkBitmap.h" |
33 #include "third_party/skia/include/gpu/GrContext.h" | 34 #include "third_party/skia/include/gpu/GrContext.h" |
34 #include "third_party/skia/include/gpu/SkGrPixelRef.h" | 35 #include "third_party/skia/include/gpu/SkGrPixelRef.h" |
35 #include "ui/gfx/rect_f.h" | 36 #include "ui/gfx/rect_f.h" |
36 | 37 |
37 namespace base { | 38 namespace base { |
38 class MessageLoopProxy; | 39 class SingleThreadTaskRunner; |
39 } | 40 } |
40 | 41 |
41 namespace blink { | 42 namespace blink { |
42 class WebContentDecryptionModule; | 43 class WebContentDecryptionModule; |
43 class WebContentDecryptionModuleResult; | 44 class WebContentDecryptionModuleResult; |
44 class WebFrame; | 45 class WebFrame; |
45 class WebURL; | 46 class WebURL; |
46 } | 47 } |
47 | 48 |
48 namespace cc_blink { | 49 namespace cc_blink { |
(...skipping 21 matching lines...) Expand all Loading... |
70 class WebMediaPlayerAndroid : public blink::WebMediaPlayer, | 71 class WebMediaPlayerAndroid : public blink::WebMediaPlayer, |
71 public cc::VideoFrameProvider, | 72 public cc::VideoFrameProvider, |
72 public RenderFrameObserver { | 73 public RenderFrameObserver { |
73 public: | 74 public: |
74 // Construct a WebMediaPlayerAndroid object. This class communicates with the | 75 // Construct a WebMediaPlayerAndroid object. This class communicates with the |
75 // MediaPlayerAndroid object in the browser process through |proxy|. | 76 // MediaPlayerAndroid object in the browser process through |proxy|. |
76 // TODO(qinmin): |frame| argument is used to determine whether the current | 77 // TODO(qinmin): |frame| argument is used to determine whether the current |
77 // player can enter fullscreen. This logic should probably be moved into | 78 // player can enter fullscreen. This logic should probably be moved into |
78 // blink, so that enterFullscreen() will not be called if another video is | 79 // blink, so that enterFullscreen() will not be called if another video is |
79 // already in fullscreen. | 80 // already in fullscreen. |
80 WebMediaPlayerAndroid(blink::WebFrame* frame, | 81 WebMediaPlayerAndroid( |
81 blink::WebMediaPlayerClient* client, | 82 blink::WebFrame* frame, |
82 base::WeakPtr<WebMediaPlayerDelegate> delegate, | 83 blink::WebMediaPlayerClient* client, |
83 RendererMediaPlayerManager* player_manager, | 84 base::WeakPtr<WebMediaPlayerDelegate> delegate, |
84 RendererCdmManager* cdm_manager, | 85 RendererMediaPlayerManager* player_manager, |
85 scoped_refptr<StreamTextureFactory> factory, | 86 RendererCdmManager* cdm_manager, |
86 const scoped_refptr<base::MessageLoopProxy>& media_loop, | 87 scoped_refptr<StreamTextureFactory> factory, |
87 media::MediaLog* media_log); | 88 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 89 media::MediaLog* media_log); |
88 virtual ~WebMediaPlayerAndroid(); | 90 virtual ~WebMediaPlayerAndroid(); |
89 | 91 |
90 // blink::WebMediaPlayer implementation. | 92 // blink::WebMediaPlayer implementation. |
91 virtual void enterFullscreen(); | 93 virtual void enterFullscreen(); |
92 virtual bool canEnterFullscreen() const; | 94 virtual bool canEnterFullscreen() const; |
93 | 95 |
94 // Resource loading. | 96 // Resource loading. |
95 virtual void load(LoadType load_type, | 97 virtual void load(LoadType load_type, |
96 const blink::WebURL& url, | 98 const blink::WebURL& url, |
97 CORSMode cors_mode); | 99 CORSMode cors_mode); |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 // Size that has been sent to StreamTexture. | 341 // Size that has been sent to StreamTexture. |
340 blink::WebSize cached_stream_texture_size_; | 342 blink::WebSize cached_stream_texture_size_; |
341 | 343 |
342 // The video frame object used for rendering by the compositor. | 344 // The video frame object used for rendering by the compositor. |
343 scoped_refptr<media::VideoFrame> current_frame_; | 345 scoped_refptr<media::VideoFrame> current_frame_; |
344 base::Lock current_frame_lock_; | 346 base::Lock current_frame_lock_; |
345 | 347 |
346 base::ThreadChecker main_thread_checker_; | 348 base::ThreadChecker main_thread_checker_; |
347 | 349 |
348 // Message loop for media thread. | 350 // Message loop for media thread. |
349 const scoped_refptr<base::MessageLoopProxy> media_loop_; | 351 const scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; |
350 | 352 |
351 // URL of the media file to be fetched. | 353 // URL of the media file to be fetched. |
352 GURL url_; | 354 GURL url_; |
353 | 355 |
354 // Media duration. | 356 // Media duration. |
355 base::TimeDelta duration_; | 357 base::TimeDelta duration_; |
356 | 358 |
357 // Flag to remember if we have a trusted duration_ value provided by | 359 // Flag to remember if we have a trusted duration_ value provided by |
358 // MediaSourceDelegate notifying OnDurationChanged(). In this case, ignore | 360 // MediaSourceDelegate notifying OnDurationChanged(). In this case, ignore |
359 // any subsequent duration value passed to OnMediaMetadataChange(). | 361 // any subsequent duration value passed to OnMediaMetadataChange(). |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 | 487 |
486 // NOTE: Weak pointers must be invalidated before all other member variables. | 488 // NOTE: Weak pointers must be invalidated before all other member variables. |
487 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; | 489 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; |
488 | 490 |
489 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); | 491 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); |
490 }; | 492 }; |
491 | 493 |
492 } // namespace content | 494 } // namespace content |
493 | 495 |
494 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 496 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
OLD | NEW |