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

Side by Side Diff: media/blink/webmediaplayer_impl.h

Issue 2389473002: Media Remoting: Add RemotingController. (Closed)
Patch Set: Rebased. Created 4 years, 2 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 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 MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ 5 #ifndef MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_
6 #define MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ 6 #define MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/cancelable_callback.h" 14 #include "base/cancelable_callback.h"
15 #include "base/compiler_specific.h" 15 #include "base/compiler_specific.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/linked_ptr.h" 17 #include "base/memory/linked_ptr.h"
18 #include "base/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
19 #include "base/memory/weak_ptr.h" 19 #include "base/memory/weak_ptr.h"
20 #include "base/threading/thread.h" 20 #include "base/threading/thread.h"
21 #include "base/timer/elapsed_timer.h" 21 #include "base/timer/elapsed_timer.h"
22 #include "base/timer/timer.h" 22 #include "base/timer/timer.h"
23 #include "build/build_config.h" 23 #include "build/build_config.h"
24 #include "media/base/media_observer.h"
24 #include "media/base/media_tracks.h" 25 #include "media/base/media_tracks.h"
25 #include "media/base/pipeline_impl.h" 26 #include "media/base/pipeline_impl.h"
26 #include "media/base/renderer_factory.h" 27 #include "media/base/renderer_factory.h"
27 #include "media/base/surface_manager.h" 28 #include "media/base/surface_manager.h"
28 #include "media/base/text_track.h" 29 #include "media/base/text_track.h"
29 #include "media/blink/buffered_data_source_host_impl.h" 30 #include "media/blink/buffered_data_source_host_impl.h"
30 #include "media/blink/media_blink_export.h" 31 #include "media/blink/media_blink_export.h"
31 #include "media/blink/multibuffer_data_source.h" 32 #include "media/blink/multibuffer_data_source.h"
32 #include "media/blink/video_frame_compositor.h" 33 #include "media/blink/video_frame_compositor.h"
33 #include "media/blink/webmediaplayer_delegate.h" 34 #include "media/blink/webmediaplayer_delegate.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 blink::WebAudioSourceProvider* getAudioSourceProvider() override; 175 blink::WebAudioSourceProvider* getAudioSourceProvider() override;
175 176
176 void setContentDecryptionModule( 177 void setContentDecryptionModule(
177 blink::WebContentDecryptionModule* cdm, 178 blink::WebContentDecryptionModule* cdm,
178 blink::WebContentDecryptionModuleResult result) override; 179 blink::WebContentDecryptionModuleResult result) override;
179 180
180 bool supportsOverlayFullscreenVideo() override; 181 bool supportsOverlayFullscreenVideo() override;
181 void enteredFullscreen() override; 182 void enteredFullscreen() override;
182 void exitedFullscreen() override; 183 void exitedFullscreen() override;
183 184
185 // These are called when any ancestor enters/exits full screen.
186 void ancestorEnteredFullscreen() override;
187 void ancestorExitedFullscreen() override;
188
184 // WebMediaPlayerDelegate::Observer implementation. 189 // WebMediaPlayerDelegate::Observer implementation.
185 void OnHidden() override; 190 void OnHidden() override;
186 void OnShown() override; 191 void OnShown() override;
187 void OnSuspendRequested(bool must_suspend) override; 192 void OnSuspendRequested(bool must_suspend) override;
188 void OnPlay() override; 193 void OnPlay() override;
189 void OnPause() override; 194 void OnPause() override;
190 void OnVolumeMultiplierUpdate(double multiplier) override; 195 void OnVolumeMultiplierUpdate(double multiplier) override;
191 196
192 #if defined(OS_ANDROID) // WMPI_CAST 197 #if defined(OS_ANDROID) // WMPI_CAST
193 bool isRemote() const override; 198 bool isRemote() const override;
194 void requestRemotePlayback() override; 199 void requestRemotePlayback() override;
195 void requestRemotePlaybackControl() override; 200 void requestRemotePlaybackControl() override;
196 201
197 void SetMediaPlayerManager( 202 void SetMediaPlayerManager(
198 RendererMediaPlayerManagerInterface* media_player_manager); 203 RendererMediaPlayerManagerInterface* media_player_manager);
199 void OnRemotePlaybackEnded(); 204 void OnRemotePlaybackEnded();
200 void OnDisconnectedFromRemoteDevice(double t); 205 void OnDisconnectedFromRemoteDevice(double t);
201 void SuspendForRemote(); 206 void SuspendForRemote();
202 void DisplayCastFrameAfterSuspend(const scoped_refptr<VideoFrame>& new_frame, 207 void DisplayCastFrameAfterSuspend(const scoped_refptr<VideoFrame>& new_frame,
203 PipelineStatus status); 208 PipelineStatus status);
204 gfx::Size GetCanvasSize() const; 209 gfx::Size GetCanvasSize() const;
205 void SetDeviceScaleFactor(float scale_factor); 210 void SetDeviceScaleFactor(float scale_factor);
206 void setPoster(const blink::WebURL& poster) override; 211 void setPoster(const blink::WebURL& poster) override;
207 #endif 212 #endif
208 213
209 // Called from WebMediaPlayerCast. 214 // Called from WebMediaPlayerCast.
210 // TODO(hubbe): WMPI_CAST make private. 215 // TODO(hubbe): WMPI_CAST make private.
211 void OnPipelineSeeked(bool time_updated); 216 void OnPipelineSeeked(bool time_updated);
212 217
218 // Restart the player/pipeline as soon as possible. This will destroy the
219 // current renderer, if any, and create a new one via the RendererFactory; and
220 // then seek to resume playback at the current position.
221 void ScheduleRestart();
222
213 // Distinct states that |delegate_| can be in. 223 // Distinct states that |delegate_| can be in.
214 // TODO(sandersd): This should move into WebMediaPlayerDelegate. 224 // TODO(sandersd): This should move into WebMediaPlayerDelegate.
215 // (Public for testing.) 225 // (Public for testing.)
216 enum class DelegateState { 226 enum class DelegateState {
217 GONE, 227 GONE,
218 PLAYING, 228 PLAYING,
219 PAUSED, 229 PAUSED,
220 ENDED, 230 ENDED,
221 }; 231 };
222 232
(...skipping 23 matching lines...) Expand all
246 void OnAddTextTrack(const TextTrackConfig& config, 256 void OnAddTextTrack(const TextTrackConfig& config,
247 const AddTextTrackDoneCB& done_cb) override; 257 const AddTextTrackDoneCB& done_cb) override;
248 void OnWaitingForDecryptionKey() override; 258 void OnWaitingForDecryptionKey() override;
249 void OnVideoNaturalSizeChange(const gfx::Size& size) override; 259 void OnVideoNaturalSizeChange(const gfx::Size& size) override;
250 void OnVideoOpacityChange(bool opaque) override; 260 void OnVideoOpacityChange(bool opaque) override;
251 261
252 // Actually seek. Avoids causing |should_notify_time_changed_| to be set when 262 // Actually seek. Avoids causing |should_notify_time_changed_| to be set when
253 // |time_updated| is false. 263 // |time_updated| is false.
254 void DoSeek(base::TimeDelta time, bool time_updated); 264 void DoSeek(base::TimeDelta time, bool time_updated);
255 265
256 // Ask for the renderer to be restarted (destructed and recreated).
257 void ScheduleRestart();
258
259 // Called after |defer_load_cb_| has decided to allow the load. If 266 // Called after |defer_load_cb_| has decided to allow the load. If
260 // |defer_load_cb_| is null this is called immediately. 267 // |defer_load_cb_| is null this is called immediately.
261 void DoLoad(LoadType load_type, 268 void DoLoad(LoadType load_type,
262 const blink::WebURL& url, 269 const blink::WebURL& url,
263 CORSMode cors_mode); 270 CORSMode cors_mode);
264 271
265 // Called after asynchronous initialization of a data source completed. 272 // Called after asynchronous initialization of a data source completed.
266 void DataSourceInitialized(bool success); 273 void DataSourceInitialized(bool success);
267 274
268 // Called when the data source is downloading or paused. 275 // Called when the data source is downloading or paused.
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 base::OneShotTimer background_pause_timer_; 548 base::OneShotTimer background_pause_timer_;
542 549
543 // Monitors the watch time of the played content. 550 // Monitors the watch time of the played content.
544 std::unique_ptr<WatchTimeReporter> watch_time_reporter_; 551 std::unique_ptr<WatchTimeReporter> watch_time_reporter_;
545 bool is_encrypted_; 552 bool is_encrypted_;
546 553
547 // Number of times we've reached BUFFERING_HAVE_NOTHING during playback. 554 // Number of times we've reached BUFFERING_HAVE_NOTHING during playback.
548 int underflow_count_; 555 int underflow_count_;
549 std::unique_ptr<base::ElapsedTimer> underflow_timer_; 556 std::unique_ptr<base::ElapsedTimer> underflow_timer_;
550 557
558 // Monitors the player events.
559 base::WeakPtr<MediaObserver> observer_;
560
551 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); 561 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl);
552 }; 562 };
553 563
554 } // namespace media 564 } // namespace media
555 565
556 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ 566 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698