Chromium Code Reviews| 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 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> |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 class WebLayerImpl; | 60 class WebLayerImpl; |
| 61 } | 61 } |
| 62 | 62 |
| 63 namespace gpu { | 63 namespace gpu { |
| 64 namespace gles2 { | 64 namespace gles2 { |
| 65 class GLES2Interface; | 65 class GLES2Interface; |
| 66 } | 66 } |
| 67 } | 67 } |
| 68 | 68 |
| 69 namespace media { | 69 namespace media { |
| 70 class CdmSessionAdapter; | |
| 70 class ChunkDemuxer; | 71 class ChunkDemuxer; |
| 71 class GpuVideoAcceleratorFactories; | 72 class GpuVideoAcceleratorFactories; |
| 72 class MediaLog; | 73 class MediaLog; |
| 73 class UrlIndex; | 74 class UrlIndex; |
| 74 class VideoFrameCompositor; | 75 class VideoFrameCompositor; |
| 75 class WatchTimeReporter; | 76 class WatchTimeReporter; |
| 76 class WebAudioSourceProviderImpl; | 77 class WebAudioSourceProviderImpl; |
| 78 class WebContentDecryptionModuleImpl; | |
| 77 class WebMediaPlayerDelegate; | 79 class WebMediaPlayerDelegate; |
| 78 class WebTextTrackImpl; | 80 class WebTextTrackImpl; |
| 79 | 81 |
| 80 // The canonical implementation of blink::WebMediaPlayer that's backed by | 82 // The canonical implementation of blink::WebMediaPlayer that's backed by |
| 81 // Pipeline. Handles normal resource loading, Media Source, and | 83 // Pipeline. Handles normal resource loading, Media Source, and |
| 82 // Encrypted Media. | 84 // Encrypted Media. |
| 83 class MEDIA_BLINK_EXPORT WebMediaPlayerImpl | 85 class MEDIA_BLINK_EXPORT WebMediaPlayerImpl |
| 84 : public NON_EXPORTED_BASE(blink::WebMediaPlayer), | 86 : public NON_EXPORTED_BASE(blink::WebMediaPlayer), |
| 85 public NON_EXPORTED_BASE(WebMediaPlayerDelegate::Observer), | 87 public NON_EXPORTED_BASE(WebMediaPlayerDelegate::Observer), |
| 86 public NON_EXPORTED_BASE(Pipeline::Client), | 88 public NON_EXPORTED_BASE(Pipeline::Client), |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 299 | 301 |
| 300 // Called when the demuxer encounters encrypted streams. | 302 // Called when the demuxer encounters encrypted streams. |
| 301 void OnEncryptedMediaInitData(EmeInitDataType init_data_type, | 303 void OnEncryptedMediaInitData(EmeInitDataType init_data_type, |
| 302 const std::vector<uint8_t>& init_data); | 304 const std::vector<uint8_t>& init_data); |
| 303 | 305 |
| 304 // Called when the FFmpegDemuxer encounters new media tracks. This is only | 306 // Called when the FFmpegDemuxer encounters new media tracks. This is only |
| 305 // invoked when using FFmpegDemuxer, since MSE/ChunkDemuxer handle media | 307 // invoked when using FFmpegDemuxer, since MSE/ChunkDemuxer handle media |
| 306 // tracks separately in WebSourceBufferImpl. | 308 // tracks separately in WebSourceBufferImpl. |
| 307 void OnFFmpegMediaTracksUpdated(std::unique_ptr<MediaTracks> tracks); | 309 void OnFFmpegMediaTracksUpdated(std::unique_ptr<MediaTracks> tracks); |
| 308 | 310 |
| 309 // Sets |cdm_context| on the pipeline and fires |cdm_attached_cb| when done. | 311 // Sets CdmContext from |cdm| on the pipeline and fires |cdm_attached_cb| |
| 310 // Parameter order is reversed for easy binding. | 312 // when done. |
| 311 void SetCdm(const CdmAttachedCB& cdm_attached_cb, CdmContext* cdm_context); | 313 void SetCdm(WebContentDecryptionModuleImpl* cdm, |
| 314 const CdmAttachedCB& cdm_attached_cb); | |
| 312 | 315 |
| 313 // Called when a CDM has been attached to the |pipeline_|. | 316 // Called when a CDM has been attached to the |pipeline_|. |
| 314 void OnCdmAttached(bool success); | 317 void OnCdmAttached(bool success); |
| 315 | 318 |
| 316 // Inspects the current playback state and: | 319 // Inspects the current playback state and: |
| 317 // - notifies |delegate_|, | 320 // - notifies |delegate_|, |
| 318 // - toggles the memory usage reporting timer, and | 321 // - toggles the memory usage reporting timer, and |
| 319 // - toggles suspend/resume as necessary. | 322 // - toggles suspend/resume as necessary. |
| 320 // | 323 // |
| 321 // This method should be called any time its dependent values change. These | 324 // This method should be called any time its dependent values change. These |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 482 | 485 |
| 483 // The compositor layer for displaying the video content when using composited | 486 // The compositor layer for displaying the video content when using composited |
| 484 // playback. | 487 // playback. |
| 485 std::unique_ptr<cc_blink::WebLayerImpl> video_weblayer_; | 488 std::unique_ptr<cc_blink::WebLayerImpl> video_weblayer_; |
| 486 | 489 |
| 487 std::unique_ptr<blink::WebContentDecryptionModuleResult> set_cdm_result_; | 490 std::unique_ptr<blink::WebContentDecryptionModuleResult> set_cdm_result_; |
| 488 | 491 |
| 489 // Whether a CDM has been successfully attached. | 492 // Whether a CDM has been successfully attached. |
| 490 bool is_cdm_attached_; | 493 bool is_cdm_attached_; |
| 491 | 494 |
| 495 // If a CDM is attached keep a reference to it, so that it is not destroyed | |
| 496 // until after the pipeline is done with it. | |
| 497 scoped_refptr<CdmSessionAdapter> cdm_adapter_; | |
|
xhwang
2016/10/07 05:02:14
We have two cdm_adapter already, this variable nam
jrummell
2016/10/07 20:15:30
Changed.
| |
| 498 | |
| 492 #if defined(OS_ANDROID) // WMPI_CAST | 499 #if defined(OS_ANDROID) // WMPI_CAST |
| 493 WebMediaPlayerCast cast_impl_; | 500 WebMediaPlayerCast cast_impl_; |
| 494 #endif | 501 #endif |
| 495 | 502 |
| 496 // The last volume received by setVolume() and the last volume multiplier from | 503 // The last volume received by setVolume() and the last volume multiplier from |
| 497 // OnVolumeMultiplierUpdate(). The multiplier is typical 1.0, but may be less | 504 // OnVolumeMultiplierUpdate(). The multiplier is typical 1.0, but may be less |
| 498 // if the WebMediaPlayerDelegate has requested a volume reduction (ducking) | 505 // if the WebMediaPlayerDelegate has requested a volume reduction (ducking) |
| 499 // for a transient sound. Playout volume is derived by volume * multiplier. | 506 // for a transient sound. Playout volume is derived by volume * multiplier. |
| 500 double volume_; | 507 double volume_; |
| 501 double volume_multiplier_; | 508 double volume_multiplier_; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 |
| 551 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); | 558 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); |
| 552 }; | 559 }; |
| 553 | 560 |
| 554 } // namespace media | 561 } // namespace media |
| 555 | 562 |
| 556 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ | 563 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ |
| OLD | NEW |