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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "base/threading/thread_checker.h" | 17 #include "base/threading/thread_checker.h" |
18 #include "base/time/default_tick_clock.h" | 18 #include "base/time/default_tick_clock.h" |
19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
20 #include "cc/layers/video_frame_provider.h" | 20 #include "cc/layers/video_frame_provider.h" |
21 #include "content/common/media/media_player_messages_enums_android.h" | |
22 #include "content/public/renderer/render_frame_observer.h" | 21 #include "content/public/renderer/render_frame_observer.h" |
23 #include "content/renderer/media/android/media_info_loader.h" | 22 #include "content/renderer/media/android/media_info_loader.h" |
24 #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/renderer_media_player_manager.h" |
25 #include "content/renderer/media/android/stream_texture_factory.h" | 25 #include "content/renderer/media/android/stream_texture_factory.h" |
26 #include "gpu/command_buffer/common/mailbox.h" | 26 #include "gpu/command_buffer/common/mailbox.h" |
27 #include "media/base/android/media_player_android.h" | 27 #include "media/base/android/media_player_android.h" |
28 #include "media/base/cdm_context.h" | 28 #include "media/base/cdm_context.h" |
29 #include "media/base/demuxer_stream.h" | 29 #include "media/base/demuxer_stream.h" |
30 #include "media/base/media_keys.h" | 30 #include "media/base/media_keys.h" |
31 #include "media/base/time_delta_interpolator.h" | 31 #include "media/base/time_delta_interpolator.h" |
32 #include "media/blink/webmediaplayer_params.h" | 32 #include "media/blink/webmediaplayer_params.h" |
33 #include "media/cdm/proxy_decryptor.h" | 33 #include "media/cdm/proxy_decryptor.h" |
34 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 34 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 class RendererCdmManager; | 74 class RendererCdmManager; |
75 class RendererMediaPlayerManager; | 75 class RendererMediaPlayerManager; |
76 | 76 |
77 // This class implements blink::WebMediaPlayer by keeping the android | 77 // This class implements blink::WebMediaPlayer by keeping the android |
78 // media player in the browser process. It listens to all the status changes | 78 // media player in the browser process. It listens to all the status changes |
79 // sent from the browser process and sends playback controls to the media | 79 // sent from the browser process and sends playback controls to the media |
80 // player. | 80 // player. |
81 class WebMediaPlayerAndroid : public blink::WebMediaPlayer, | 81 class WebMediaPlayerAndroid : public blink::WebMediaPlayer, |
82 public cc::VideoFrameProvider, | 82 public cc::VideoFrameProvider, |
83 public RenderFrameObserver, | 83 public RenderFrameObserver, |
84 public StreamTextureFactoryContextObserver { | 84 public StreamTextureFactoryContextObserver, |
| 85 public content::RendererMediaPlayerInterface { |
85 public: | 86 public: |
86 // Construct a WebMediaPlayerAndroid object. This class communicates with the | 87 // Construct a WebMediaPlayerAndroid object. This class communicates with the |
87 // MediaPlayerAndroid object in the browser process through |proxy|. | 88 // MediaPlayerAndroid object in the browser process through |proxy|. |
88 // TODO(qinmin): |frame| argument is used to determine whether the current | 89 // TODO(qinmin): |frame| argument is used to determine whether the current |
89 // player can enter fullscreen. This logic should probably be moved into | 90 // player can enter fullscreen. This logic should probably be moved into |
90 // blink, so that enterFullscreen() will not be called if another video is | 91 // blink, so that enterFullscreen() will not be called if another video is |
91 // already in fullscreen. | 92 // already in fullscreen. |
92 WebMediaPlayerAndroid( | 93 WebMediaPlayerAndroid( |
93 blink::WebFrame* frame, | 94 blink::WebFrame* frame, |
94 blink::WebMediaPlayerClient* client, | 95 blink::WebMediaPlayerClient* client, |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 | 215 |
215 // StreamTextureFactoryContextObserver implementation. | 216 // StreamTextureFactoryContextObserver implementation. |
216 void ResetStreamTextureProxy() override; | 217 void ResetStreamTextureProxy() override; |
217 | 218 |
218 // Called when the player is released. | 219 // Called when the player is released. |
219 virtual void OnPlayerReleased(); | 220 virtual void OnPlayerReleased(); |
220 | 221 |
221 // This function is called by the RendererMediaPlayerManager to pause the | 222 // This function is called by the RendererMediaPlayerManager to pause the |
222 // video and release the media player and surface texture when we switch tabs. | 223 // video and release the media player and surface texture when we switch tabs. |
223 // However, the actual GlTexture is not released to keep the video screenshot. | 224 // However, the actual GlTexture is not released to keep the video screenshot. |
224 void SuspendAndReleaseResources(); | 225 void SuspendAndReleaseResources() override; |
225 | 226 |
226 // RenderFrameObserver implementation. | 227 // RenderFrameObserver implementation. |
227 void OnDestruct() override; | 228 void OnDestruct() override; |
228 | 229 |
229 #if defined(VIDEO_HOLE) | 230 #if defined(VIDEO_HOLE) |
230 // Calculate the boundary rectangle of the media player (i.e. location and | 231 // Calculate the boundary rectangle of the media player (i.e. location and |
231 // size of the video frame). | 232 // size of the video frame). |
232 // Returns true if the geometry has been changed since the last call. | 233 // Returns true if the geometry has been changed since the last call. |
233 bool UpdateBoundaryRectangle(); | 234 bool UpdateBoundaryRectangle(); |
234 | 235 |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 | 540 |
540 // NOTE: Weak pointers must be invalidated before all other member variables. | 541 // NOTE: Weak pointers must be invalidated before all other member variables. |
541 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; | 542 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; |
542 | 543 |
543 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); | 544 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); |
544 }; | 545 }; |
545 | 546 |
546 } // namespace content | 547 } // namespace content |
547 | 548 |
548 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 549 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
OLD | NEW |