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

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

Issue 935243002: Decryptors can report kNoKey to WebMediaPlayer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: change + rebase Created 5 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
« no previous file with comments | « media/blink/webmediaplayer_impl.h ('k') | media/filters/audio_decoder_selector_unittest.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 #include "media/blink/webmediaplayer_impl.h" 5 #include "media/blink/webmediaplayer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 // TODO(xhwang): Update this UMA name. 671 // TODO(xhwang): Update this UMA name.
672 UMA_HISTOGRAM_COUNTS("Media.EME.NeedKey", 1); 672 UMA_HISTOGRAM_COUNTS("Media.EME.NeedKey", 1);
673 673
674 encrypted_media_support_.SetInitDataType(init_data_type); 674 encrypted_media_support_.SetInitDataType(init_data_type);
675 675
676 const uint8* init_data_ptr = init_data.empty() ? nullptr : &init_data[0]; 676 const uint8* init_data_ptr = init_data.empty() ? nullptr : &init_data[0];
677 client_->encrypted(WebString::fromUTF8(init_data_type), init_data_ptr, 677 client_->encrypted(WebString::fromUTF8(init_data_type), init_data_ptr,
678 base::saturated_cast<unsigned int>(init_data.size())); 678 base::saturated_cast<unsigned int>(init_data.size()));
679 } 679 }
680 680
681 void WebMediaPlayerImpl::OnWaitingForDecryptionKey() {
682 client_->didBlockPlaybackWaitingForKey();
683
684 // TODO(jrummell): didResumePlaybackBlockedForKey() should only be called
ddorwin 2015/02/24 01:36:52 Bug? We should probably add a separate one and clo
jrummell 2015/02/25 19:06:39 Done.
685 // when a key has been successfully added (e.g. OnSessionKeysChange() with
686 // |has_additional_usable_key| = true).
687 client_->didResumePlaybackBlockedForKey();
688 }
689
681 void WebMediaPlayerImpl::SetCdm(CdmContext* cdm_context, 690 void WebMediaPlayerImpl::SetCdm(CdmContext* cdm_context,
682 const CdmAttachedCB& cdm_attached_cb) { 691 const CdmAttachedCB& cdm_attached_cb) {
683 pipeline_.SetCdm(cdm_context, cdm_attached_cb); 692 pipeline_.SetCdm(cdm_context, cdm_attached_cb);
684 } 693 }
685 694
686 void WebMediaPlayerImpl::OnCdmAttached( 695 void WebMediaPlayerImpl::OnCdmAttached(
687 blink::WebContentDecryptionModuleResult result, 696 blink::WebContentDecryptionModuleResult result,
688 bool success) { 697 bool success) {
689 if (success) { 698 if (success) {
690 result.complete(); 699 result.complete();
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 demuxer_.get(), 891 demuxer_.get(),
883 renderer_factory_->CreateRenderer(media_task_runner_, 892 renderer_factory_->CreateRenderer(media_task_runner_,
884 audio_source_provider_.get()), 893 audio_source_provider_.get()),
885 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnPipelineEnded), 894 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnPipelineEnded),
886 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnPipelineError), 895 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnPipelineError),
887 BIND_TO_RENDER_LOOP1(&WebMediaPlayerImpl::OnPipelineSeeked, false), 896 BIND_TO_RENDER_LOOP1(&WebMediaPlayerImpl::OnPipelineSeeked, false),
888 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnPipelineMetadata), 897 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnPipelineMetadata),
889 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnPipelineBufferingStateChanged), 898 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnPipelineBufferingStateChanged),
890 base::Bind(&WebMediaPlayerImpl::FrameReady, base::Unretained(this)), 899 base::Bind(&WebMediaPlayerImpl::FrameReady, base::Unretained(this)),
891 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnDurationChanged), 900 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnDurationChanged),
892 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnAddTextTrack)); 901 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnAddTextTrack),
902 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnWaitingForDecryptionKey));
893 } 903 }
894 904
895 void WebMediaPlayerImpl::SetNetworkState(WebMediaPlayer::NetworkState state) { 905 void WebMediaPlayerImpl::SetNetworkState(WebMediaPlayer::NetworkState state) {
896 DVLOG(1) << __FUNCTION__ << "(" << state << ")"; 906 DVLOG(1) << __FUNCTION__ << "(" << state << ")";
897 DCHECK(main_task_runner_->BelongsToCurrentThread()); 907 DCHECK(main_task_runner_->BelongsToCurrentThread());
898 network_state_ = state; 908 network_state_ = state;
899 // Always notify to ensure client has the latest value. 909 // Always notify to ensure client has the latest value.
900 client_->networkStateChanged(); 910 client_->networkStateChanged();
901 } 911 }
902 912
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 1009
1000 // pause() may be called after playback has ended and the HTMLMediaElement 1010 // pause() may be called after playback has ended and the HTMLMediaElement
1001 // requires that currentTime() == duration() after ending. We want to ensure 1011 // requires that currentTime() == duration() after ending. We want to ensure
1002 // |paused_time_| matches currentTime() in this case or a future seek() may 1012 // |paused_time_| matches currentTime() in this case or a future seek() may
1003 // incorrectly discard what it thinks is a seek to the existing time. 1013 // incorrectly discard what it thinks is a seek to the existing time.
1004 paused_time_ = 1014 paused_time_ =
1005 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime(); 1015 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime();
1006 } 1016 }
1007 1017
1008 } // namespace media 1018 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/webmediaplayer_impl.h ('k') | media/filters/audio_decoder_selector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698