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

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: 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 enterFullscreen() 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 25 matching lines...) Expand all
219 // Initiate suspending the pipeline. 222 // Initiate suspending the pipeline.
220 void Suspend(); 223 void Suspend();
221 224
222 // Ask for the pipeline to be resumed, will call Resume() when ready. 225 // Ask for the pipeline to be resumed, will call Resume() when ready.
223 // (Possibly immediately.) 226 // (Possibly immediately.)
224 void ScheduleResume(); 227 void ScheduleResume();
225 228
226 // Initiate resuming the pipeline. 229 // Initiate resuming the pipeline.
227 void Resume(); 230 void Resume();
228 231
232 // Ask for the renderer to be restarted (destructed and recreated).
233 void ScheduleRestart();
234
229 // Called after |defer_load_cb_| has decided to allow the load. If 235 // Called after |defer_load_cb_| has decided to allow the load. If
230 // |defer_load_cb_| is null this is called immediately. 236 // |defer_load_cb_| is null this is called immediately.
231 void DoLoad(LoadType load_type, 237 void DoLoad(LoadType load_type,
232 const blink::WebURL& url, 238 const blink::WebURL& url,
233 CORSMode cors_mode); 239 CORSMode cors_mode);
234 240
235 // Called after asynchronous initialization of a data source completed. 241 // Called after asynchronous initialization of a data source completed.
236 void DataSourceInitialized(bool success); 242 void DataSourceInitialized(bool success);
237 243
238 // Called when the data source is downloading or paused. 244 // Called when the data source is downloading or paused.
239 void NotifyDownloading(bool is_downloading); 245 void NotifyDownloading(bool is_downloading);
240 246
247 void OnSurfaceRequested(const SurfaceCreatedCB& surface_created_cb);
248
241 // Creates a Renderer via the |renderer_factory_|. 249 // Creates a Renderer via the |renderer_factory_|.
242 scoped_ptr<Renderer> CreateRenderer(); 250 scoped_ptr<Renderer> CreateRenderer();
243 251
244 // Finishes starting the pipeline due to a call to load(). 252 // Finishes starting the pipeline due to a call to load().
245 void StartPipeline(); 253 void StartPipeline();
246 254
247 // Helpers that set the network/ready state and notifies the client if 255 // Helpers that set the network/ready state and notifies the client if
248 // they've changed. 256 // they've changed.
249 void SetNetworkState(blink::WebMediaPlayer::NetworkState state); 257 void SetNetworkState(blink::WebMediaPlayer::NetworkState state);
250 void SetReadyState(blink::WebMediaPlayer::ReadyState state); 258 void SetReadyState(blink::WebMediaPlayer::ReadyState state);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 367
360 // Set for the entire period between suspend starting and resume completing. 368 // Set for the entire period between suspend starting and resume completing.
361 bool suspending_; 369 bool suspending_;
362 370
363 // Set while suspending to detect double-suspend. 371 // Set while suspending to detect double-suspend.
364 bool suspended_; 372 bool suspended_;
365 373
366 // Set while resuming to detect double-resume. 374 // Set while resuming to detect double-resume.
367 bool resuming_; 375 bool resuming_;
368 376
377 // Set when doing both a suspend and resume in sequence in order to restart
378 // the pipeline, and specifically the decoders.
379 bool pending_suspend_resume_cycle_;
380
369 // TODO(scherkus): Replace with an explicit ended signal to HTMLMediaElement, 381 // TODO(scherkus): Replace with an explicit ended signal to HTMLMediaElement,
370 // see http://crbug.com/409280 382 // see http://crbug.com/409280
371 bool ended_; 383 bool ended_;
372 384
373 // Indicates that a seek is queued after the current seek completes or, if the 385 // Indicates that a seek is queued after the current seek completes or, if the
374 // pipeline is suspended, after it resumes. Only the last queued seek will 386 // pipeline is suspended, after it resumes. Only the last queued seek will
375 // have any effect. 387 // have any effect.
376 bool pending_seek_; 388 bool pending_seek_;
377 389
378 // |pending_seek_time_| is meaningless when |pending_seek_| is false. 390 // |pending_seek_time_| is meaningless when |pending_seek_| is false.
379 base::TimeDelta pending_seek_time_; 391 base::TimeDelta pending_seek_time_;
380 392
381 // Tracks whether to issue time changed notifications during buffering state 393 // Tracks whether to issue time changed notifications during buffering state
382 // changes. 394 // changes.
383 bool should_notify_time_changed_; 395 bool should_notify_time_changed_;
384 396
397 bool fullscreen_;
398
399 // Whether the current decoder requires a restart on fullscreen transitions.
400 bool decoder_requires_restart_for_fullscreen_;
401
385 blink::WebMediaPlayerClient* client_; 402 blink::WebMediaPlayerClient* client_;
386 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client_; 403 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client_;
387 404
388 base::WeakPtr<WebMediaPlayerDelegate> delegate_; 405 base::WeakPtr<WebMediaPlayerDelegate> delegate_;
389 406
390 WebMediaPlayerParams::DeferLoadCB defer_load_cb_; 407 WebMediaPlayerParams::DeferLoadCB defer_load_cb_;
391 WebMediaPlayerParams::Context3DCB context_3d_cb_; 408 WebMediaPlayerParams::Context3DCB context_3d_cb_;
392 409
393 // Members for notifying upstream clients about internal memory usage. The 410 // Members for notifying upstream clients about internal memory usage. The
394 // |adjust_allocated_memory_cb_| must only be called on |main_task_runner_|. 411 // |adjust_allocated_memory_cb_| must only be called on |main_task_runner_|.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 446
430 // Whether a CDM has been successfully attached. 447 // Whether a CDM has been successfully attached.
431 bool is_cdm_attached_; 448 bool is_cdm_attached_;
432 449
433 #if defined(OS_ANDROID) // WMPI_CAST 450 #if defined(OS_ANDROID) // WMPI_CAST
434 WebMediaPlayerCast cast_impl_; 451 WebMediaPlayerCast cast_impl_;
435 #endif 452 #endif
436 453
437 scoped_ptr<RendererFactory> renderer_factory_; 454 scoped_ptr<RendererFactory> renderer_factory_;
438 455
456 SurfaceManager* surface_manager_;
457
439 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); 458 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl);
440 }; 459 };
441 460
442 } // namespace media 461 } // namespace media
443 462
444 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ 463 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698