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

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

Issue 1655083002: Enable SurfaceView fullscreen video on Android with WebMediaPlayerImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@avda-sv
Patch Set: Adressed comments; moved blink parts to another CL Created 4 years, 10 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 <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/linked_ptr.h" 15 #include "base/memory/linked_ptr.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "base/threading/thread.h" 19 #include "base/threading/thread.h"
20 #include "build/build_config.h" 20 #include "build/build_config.h"
21 #include "media/base/cdm_factory.h" 21 #include "media/base/cdm_factory.h"
22 #include "media/base/pipeline.h" 22 #include "media/base/pipeline.h"
23 #include "media/base/renderer_factory.h" 23 #include "media/base/renderer_factory.h"
24 #include "media/base/surface_manager.h"
24 #include "media/base/text_track.h" 25 #include "media/base/text_track.h"
25 #include "media/blink/buffered_data_source.h" 26 #include "media/blink/buffered_data_source.h"
26 #include "media/blink/buffered_data_source_host_impl.h" 27 #include "media/blink/buffered_data_source_host_impl.h"
27 #include "media/blink/encrypted_media_player_support.h" 28 #include "media/blink/encrypted_media_player_support.h"
28 #include "media/blink/media_blink_export.h" 29 #include "media/blink/media_blink_export.h"
29 #include "media/blink/multibuffer_data_source.h" 30 #include "media/blink/multibuffer_data_source.h"
30 #include "media/blink/video_frame_compositor.h" 31 #include "media/blink/video_frame_compositor.h"
31 #include "media/blink/webmediaplayer_delegate.h" 32 #include "media/blink/webmediaplayer_delegate.h"
32 #include "media/blink/webmediaplayer_params.h" 33 #include "media/blink/webmediaplayer_params.h"
33 #include "media/blink/webmediaplayer_util.h" 34 #include "media/blink/webmediaplayer_util.h"
(...skipping 18 matching lines...) Expand all
52 namespace base { 53 namespace base {
53 class SingleThreadTaskRunner; 54 class SingleThreadTaskRunner;
54 class TaskRunner; 55 class TaskRunner;
55 } 56 }
56 57
57 namespace cc_blink { 58 namespace cc_blink {
58 class WebLayerImpl; 59 class WebLayerImpl;
59 } 60 }
60 61
61 namespace media { 62 namespace media {
62
63 class AudioHardwareConfig; 63 class AudioHardwareConfig;
64 class ChunkDemuxer; 64 class ChunkDemuxer;
65 class GpuVideoAcceleratorFactories; 65 class GpuVideoAcceleratorFactories;
66 class MediaLog; 66 class MediaLog;
67 class UrlIndex; 67 class UrlIndex;
68 class VideoFrameCompositor; 68 class VideoFrameCompositor;
69 class WebAudioSourceProviderImpl; 69 class WebAudioSourceProviderImpl;
70 class WebMediaPlayerDelegate; 70 class WebMediaPlayerDelegate;
71 class WebTextTrackImpl; 71 class WebTextTrackImpl;
72 72
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 const blink::WebString& session_id) override; 174 const blink::WebString& session_id) override;
175 175
176 MediaKeyException cancelKeyRequest( 176 MediaKeyException cancelKeyRequest(
177 const blink::WebString& key_system, 177 const blink::WebString& key_system,
178 const blink::WebString& session_id) override; 178 const blink::WebString& session_id) override;
179 179
180 void setContentDecryptionModule( 180 void setContentDecryptionModule(
181 blink::WebContentDecryptionModule* cdm, 181 blink::WebContentDecryptionModule* cdm,
182 blink::WebContentDecryptionModuleResult result) override; 182 blink::WebContentDecryptionModuleResult result) override;
183 183
184 void enteredFullscreen() override;
185 void exitedFullscreen() override;
186
184 void OnPipelineSeeked(bool time_changed, PipelineStatus status); 187 void OnPipelineSeeked(bool time_changed, PipelineStatus status);
185 void OnPipelineSuspended(PipelineStatus status); 188 void OnPipelineSuspended(PipelineStatus status);
186 void OnPipelineEnded(); 189 void OnPipelineEnded();
187 void OnPipelineError(PipelineStatus error); 190 void OnPipelineError(PipelineStatus error);
188 void OnPipelineMetadata(PipelineMetadata metadata); 191 void OnPipelineMetadata(PipelineMetadata metadata);
189 void OnPipelineBufferingStateChanged(BufferingState buffering_state); 192 void OnPipelineBufferingStateChanged(BufferingState buffering_state);
190 void OnDemuxerOpened(); 193 void OnDemuxerOpened();
191 void OnAddTextTrack(const TextTrackConfig& config, 194 void OnAddTextTrack(const TextTrackConfig& config,
192 const AddTextTrackDoneCB& done_cb); 195 const AddTextTrackDoneCB& done_cb);
193 196
(...skipping 28 matching lines...) Expand all
222 // Initiate suspending the pipeline. 225 // Initiate suspending the pipeline.
223 void Suspend(); 226 void Suspend();
224 227
225 // Ask for the pipeline to be resumed, will call Resume() when ready. 228 // Ask for the pipeline to be resumed, will call Resume() when ready.
226 // (Possibly immediately.) 229 // (Possibly immediately.)
227 void ScheduleResume(); 230 void ScheduleResume();
228 231
229 // Initiate resuming the pipeline. 232 // Initiate resuming the pipeline.
230 void Resume(); 233 void Resume();
231 234
235 // Ask for the renderer to be restarted (destructed and recreated).
236 void ScheduleRestart();
237
232 // Called after |defer_load_cb_| has decided to allow the load. If 238 // Called after |defer_load_cb_| has decided to allow the load. If
233 // |defer_load_cb_| is null this is called immediately. 239 // |defer_load_cb_| is null this is called immediately.
234 void DoLoad(LoadType load_type, 240 void DoLoad(LoadType load_type,
235 const blink::WebURL& url, 241 const blink::WebURL& url,
236 CORSMode cors_mode); 242 CORSMode cors_mode);
237 243
238 // Called after asynchronous initialization of a data source completed. 244 // Called after asynchronous initialization of a data source completed.
239 void DataSourceInitialized(bool success); 245 void DataSourceInitialized(bool success);
240 246
241 // Called when the data source is downloading or paused. 247 // Called when the data source is downloading or paused.
242 void NotifyDownloading(bool is_downloading); 248 void NotifyDownloading(bool is_downloading);
243 249
250 void OnSurfaceRequested(const SurfaceCreatedCB& surface_created_cb);
251
244 // Creates a Renderer via the |renderer_factory_|. 252 // Creates a Renderer via the |renderer_factory_|.
245 scoped_ptr<Renderer> CreateRenderer(); 253 scoped_ptr<Renderer> CreateRenderer();
246 254
247 // Finishes starting the pipeline due to a call to load(). 255 // Finishes starting the pipeline due to a call to load().
248 void StartPipeline(); 256 void StartPipeline();
249 257
250 // Helpers that set the network/ready state and notifies the client if 258 // Helpers that set the network/ready state and notifies the client if
251 // they've changed. 259 // they've changed.
252 void SetNetworkState(blink::WebMediaPlayer::NetworkState state); 260 void SetNetworkState(blink::WebMediaPlayer::NetworkState state);
253 void SetReadyState(blink::WebMediaPlayer::ReadyState state); 261 void SetReadyState(blink::WebMediaPlayer::ReadyState state);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 370
363 // Set for the entire period between suspend starting and resume completing. 371 // Set for the entire period between suspend starting and resume completing.
364 bool suspending_; 372 bool suspending_;
365 373
366 // Set while suspending to detect double-suspend. 374 // Set while suspending to detect double-suspend.
367 bool suspended_; 375 bool suspended_;
368 376
369 // Set while resuming to detect double-resume. 377 // Set while resuming to detect double-resume.
370 bool resuming_; 378 bool resuming_;
371 379
380 // Set when doing a restart (a suspend and resume in sequence) of the pipeline
381 // in order to destruct and reinitialize the decoders. This is separate from
382 // |pending_resume_| and |pending_suspend_| because they can be elided in
383 // certain cases, whereas for a restart they must happen.
384 // TODO(sandersd,watk): Create a simpler interface for a pipeline restart.
385 bool pending_suspend_resume_cycle_;
386
372 // TODO(scherkus): Replace with an explicit ended signal to HTMLMediaElement, 387 // TODO(scherkus): Replace with an explicit ended signal to HTMLMediaElement,
373 // see http://crbug.com/409280 388 // see http://crbug.com/409280
374 bool ended_; 389 bool ended_;
375 390
376 // Indicates that a seek is queued after the current seek completes or, if the 391 // Indicates that a seek is queued after the current seek completes or, if the
377 // pipeline is suspended, after it resumes. Only the last queued seek will 392 // pipeline is suspended, after it resumes. Only the last queued seek will
378 // have any effect. 393 // have any effect.
379 bool pending_seek_; 394 bool pending_seek_;
380 395
381 // |pending_seek_time_| is meaningless when |pending_seek_| is false. 396 // |pending_seek_time_| is meaningless when |pending_seek_| is false.
382 base::TimeDelta pending_seek_time_; 397 base::TimeDelta pending_seek_time_;
383 398
384 // Tracks whether to issue time changed notifications during buffering state 399 // Tracks whether to issue time changed notifications during buffering state
385 // changes. 400 // changes.
386 bool should_notify_time_changed_; 401 bool should_notify_time_changed_;
387 402
403 bool fullscreen_;
404
405 // Whether the current decoder requires a restart on fullscreen transitions.
406 bool decoder_requires_restart_for_fullscreen_;
407
388 blink::WebMediaPlayerClient* client_; 408 blink::WebMediaPlayerClient* client_;
389 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client_; 409 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client_;
390 410
391 // WebMediaPlayer notifies the |delegate_| of playback state changes using 411 // WebMediaPlayer notifies the |delegate_| of playback state changes using
392 // |delegate_id_|; an id provided after registering with the delegate. The 412 // |delegate_id_|; an id provided after registering with the delegate. The
393 // WebMediaPlayer may also receive directives (play, pause) from the delegate 413 // WebMediaPlayer may also receive directives (play, pause) from the delegate
394 // via the WebMediaPlayerDelegate::Observer interface after registration. 414 // via the WebMediaPlayerDelegate::Observer interface after registration.
395 base::WeakPtr<WebMediaPlayerDelegate> delegate_; 415 base::WeakPtr<WebMediaPlayerDelegate> delegate_;
396 int delegate_id_; 416 int delegate_id_;
397 417
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 464
445 // The last volume received by setVolume() and the last volume multiplier from 465 // The last volume received by setVolume() and the last volume multiplier from
446 // OnVolumeMultiplierUpdate(). The multiplier is typical 1.0, but may be less 466 // OnVolumeMultiplierUpdate(). The multiplier is typical 1.0, but may be less
447 // if the WebMediaPlayerDelegate has requested a volume reduction (ducking) 467 // if the WebMediaPlayerDelegate has requested a volume reduction (ducking)
448 // for a transient sound. Playout volume is derived by volume * multiplier. 468 // for a transient sound. Playout volume is derived by volume * multiplier.
449 double volume_; 469 double volume_;
450 double volume_multiplier_; 470 double volume_multiplier_;
451 471
452 scoped_ptr<RendererFactory> renderer_factory_; 472 scoped_ptr<RendererFactory> renderer_factory_;
453 473
474 // For requesting surfaces on behalf of the Android H/W decoder in fullscreen.
475 // This will be null everywhere but Android.
476 SurfaceManager* surface_manager_;
477
454 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); 478 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl);
455 }; 479 };
456 480
457 } // namespace media 481 } // namespace media
458 482
459 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ 483 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698