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

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

Issue 2402563002: Keep reference to CDM to avoid it's premature destruction (Closed)
Patch Set: nits 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
« no previous file with comments | « media/blink/webcontentdecryptionmodule_impl.cc ('k') | media/blink/webmediaplayer_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 ChunkDemuxer; 70 class ChunkDemuxer;
71 class GpuVideoAcceleratorFactories; 71 class GpuVideoAcceleratorFactories;
72 class MediaKeys;
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;
77 class WebMediaPlayerDelegate; 78 class WebMediaPlayerDelegate;
78 class WebTextTrackImpl; 79 class WebTextTrackImpl;
79 80
80 // The canonical implementation of blink::WebMediaPlayer that's backed by 81 // The canonical implementation of blink::WebMediaPlayer that's backed by
81 // Pipeline. Handles normal resource loading, Media Source, and 82 // Pipeline. Handles normal resource loading, Media Source, and
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 300
300 // Called when the demuxer encounters encrypted streams. 301 // Called when the demuxer encounters encrypted streams.
301 void OnEncryptedMediaInitData(EmeInitDataType init_data_type, 302 void OnEncryptedMediaInitData(EmeInitDataType init_data_type,
302 const std::vector<uint8_t>& init_data); 303 const std::vector<uint8_t>& init_data);
303 304
304 // Called when the FFmpegDemuxer encounters new media tracks. This is only 305 // Called when the FFmpegDemuxer encounters new media tracks. This is only
305 // invoked when using FFmpegDemuxer, since MSE/ChunkDemuxer handle media 306 // invoked when using FFmpegDemuxer, since MSE/ChunkDemuxer handle media
306 // tracks separately in WebSourceBufferImpl. 307 // tracks separately in WebSourceBufferImpl.
307 void OnFFmpegMediaTracksUpdated(std::unique_ptr<MediaTracks> tracks); 308 void OnFFmpegMediaTracksUpdated(std::unique_ptr<MediaTracks> tracks);
308 309
309 // Sets |cdm_context| on the pipeline and fires |cdm_attached_cb| when done. 310 // Sets CdmContext from |cdm| on the pipeline and calls OnCdmAttached()
310 // Parameter order is reversed for easy binding. 311 // when done.
311 void SetCdm(const CdmAttachedCB& cdm_attached_cb, CdmContext* cdm_context); 312 void SetCdm(blink::WebContentDecryptionModule* cdm);
312 313
313 // Called when a CDM has been attached to the |pipeline_|. 314 // Called when a CDM has been attached to the |pipeline_|.
314 void OnCdmAttached(bool success); 315 void OnCdmAttached(bool success);
315 316
316 // Inspects the current playback state and: 317 // Inspects the current playback state and:
317 // - notifies |delegate_|, 318 // - notifies |delegate_|,
318 // - toggles the memory usage reporting timer, and 319 // - toggles the memory usage reporting timer, and
319 // - toggles suspend/resume as necessary. 320 // - toggles suspend/resume as necessary.
320 // 321 //
321 // This method should be called any time its dependent values change. These 322 // This method should be called any time its dependent values change. These
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; 480 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_;
480 VideoFrameCompositor* compositor_; // Deleted on |compositor_task_runner_|. 481 VideoFrameCompositor* compositor_; // Deleted on |compositor_task_runner_|.
481 SkCanvasVideoRenderer skcanvas_video_renderer_; 482 SkCanvasVideoRenderer skcanvas_video_renderer_;
482 483
483 // The compositor layer for displaying the video content when using composited 484 // The compositor layer for displaying the video content when using composited
484 // playback. 485 // playback.
485 std::unique_ptr<cc_blink::WebLayerImpl> video_weblayer_; 486 std::unique_ptr<cc_blink::WebLayerImpl> video_weblayer_;
486 487
487 std::unique_ptr<blink::WebContentDecryptionModuleResult> set_cdm_result_; 488 std::unique_ptr<blink::WebContentDecryptionModuleResult> set_cdm_result_;
488 489
489 // Whether a CDM has been successfully attached. 490 // If a CDM is attached keep a reference to it, so that it is not destroyed
490 bool is_cdm_attached_; 491 // until after the pipeline is done with it.
492 scoped_refptr<MediaKeys> cdm_;
493
494 // Keep track of the CDM while it is in the process of attaching to the
495 // pipeline.
496 scoped_refptr<MediaKeys> pending_cdm_;
491 497
492 #if defined(OS_ANDROID) // WMPI_CAST 498 #if defined(OS_ANDROID) // WMPI_CAST
493 WebMediaPlayerCast cast_impl_; 499 WebMediaPlayerCast cast_impl_;
494 #endif 500 #endif
495 501
496 // The last volume received by setVolume() and the last volume multiplier from 502 // The last volume received by setVolume() and the last volume multiplier from
497 // OnVolumeMultiplierUpdate(). The multiplier is typical 1.0, but may be less 503 // OnVolumeMultiplierUpdate(). The multiplier is typical 1.0, but may be less
498 // if the WebMediaPlayerDelegate has requested a volume reduction (ducking) 504 // if the WebMediaPlayerDelegate has requested a volume reduction (ducking)
499 // for a transient sound. Playout volume is derived by volume * multiplier. 505 // for a transient sound. Playout volume is derived by volume * multiplier.
500 double volume_; 506 double volume_;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 // Number of times we've reached BUFFERING_HAVE_NOTHING during playback. 553 // Number of times we've reached BUFFERING_HAVE_NOTHING during playback.
548 int underflow_count_; 554 int underflow_count_;
549 std::unique_ptr<base::ElapsedTimer> underflow_timer_; 555 std::unique_ptr<base::ElapsedTimer> underflow_timer_;
550 556
551 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); 557 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl);
552 }; 558 };
553 559
554 } // namespace media 560 } // namespace media
555 561
556 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ 562 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_
OLDNEW
« no previous file with comments | « media/blink/webcontentdecryptionmodule_impl.cc ('k') | media/blink/webmediaplayer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698