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

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: Android changes Created 5 years, 9 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 #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 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 // TODO(xhwang): Update this UMA name. 685 // TODO(xhwang): Update this UMA name.
686 UMA_HISTOGRAM_COUNTS("Media.EME.NeedKey", 1); 686 UMA_HISTOGRAM_COUNTS("Media.EME.NeedKey", 1);
687 687
688 encrypted_media_support_.SetInitDataType(init_data_type); 688 encrypted_media_support_.SetInitDataType(init_data_type);
689 689
690 client_->encrypted(ConvertInitDataType(init_data_type), 690 client_->encrypted(ConvertInitDataType(init_data_type),
691 vector_as_array(&init_data), 691 vector_as_array(&init_data),
692 base::saturated_cast<unsigned int>(init_data.size())); 692 base::saturated_cast<unsigned int>(init_data.size()));
693 } 693 }
694 694
695 void WebMediaPlayerImpl::OnWaitingForDecryptionKey() {
696 client_->didBlockPlaybackWaitingForKey();
697
698 // TODO(jrummell): didResumePlaybackBlockedForKey() should only be called
699 // when a key has been successfully added (e.g. OnSessionKeysChange() with
700 // |has_additional_usable_key| = true). http://crbug.com/461903
701 client_->didResumePlaybackBlockedForKey();
702 }
703
695 void WebMediaPlayerImpl::SetCdm(CdmContext* cdm_context, 704 void WebMediaPlayerImpl::SetCdm(CdmContext* cdm_context,
696 const CdmAttachedCB& cdm_attached_cb) { 705 const CdmAttachedCB& cdm_attached_cb) {
697 pipeline_.SetCdm(cdm_context, cdm_attached_cb); 706 pipeline_.SetCdm(cdm_context, cdm_attached_cb);
698 } 707 }
699 708
700 void WebMediaPlayerImpl::OnCdmAttached( 709 void WebMediaPlayerImpl::OnCdmAttached(
701 blink::WebContentDecryptionModuleResult result, 710 blink::WebContentDecryptionModuleResult result,
702 bool success) { 711 bool success) {
703 if (success) { 712 if (success) {
704 result.complete(); 713 result.complete();
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 demuxer_.get(), 905 demuxer_.get(),
897 renderer_factory_->CreateRenderer(media_task_runner_, 906 renderer_factory_->CreateRenderer(media_task_runner_,
898 audio_source_provider_.get()), 907 audio_source_provider_.get()),
899 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnPipelineEnded), 908 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnPipelineEnded),
900 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnPipelineError), 909 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnPipelineError),
901 BIND_TO_RENDER_LOOP1(&WebMediaPlayerImpl::OnPipelineSeeked, false), 910 BIND_TO_RENDER_LOOP1(&WebMediaPlayerImpl::OnPipelineSeeked, false),
902 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnPipelineMetadata), 911 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnPipelineMetadata),
903 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnPipelineBufferingStateChanged), 912 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnPipelineBufferingStateChanged),
904 base::Bind(&WebMediaPlayerImpl::FrameReady, base::Unretained(this)), 913 base::Bind(&WebMediaPlayerImpl::FrameReady, base::Unretained(this)),
905 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnDurationChanged), 914 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnDurationChanged),
906 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnAddTextTrack)); 915 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnAddTextTrack),
916 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnWaitingForDecryptionKey));
907 } 917 }
908 918
909 void WebMediaPlayerImpl::SetNetworkState(WebMediaPlayer::NetworkState state) { 919 void WebMediaPlayerImpl::SetNetworkState(WebMediaPlayer::NetworkState state) {
910 DVLOG(1) << __FUNCTION__ << "(" << state << ")"; 920 DVLOG(1) << __FUNCTION__ << "(" << state << ")";
911 DCHECK(main_task_runner_->BelongsToCurrentThread()); 921 DCHECK(main_task_runner_->BelongsToCurrentThread());
912 network_state_ = state; 922 network_state_ = state;
913 // Always notify to ensure client has the latest value. 923 // Always notify to ensure client has the latest value.
914 client_->networkStateChanged(); 924 client_->networkStateChanged();
915 } 925 }
916 926
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 1023
1014 // pause() may be called after playback has ended and the HTMLMediaElement 1024 // pause() may be called after playback has ended and the HTMLMediaElement
1015 // requires that currentTime() == duration() after ending. We want to ensure 1025 // requires that currentTime() == duration() after ending. We want to ensure
1016 // |paused_time_| matches currentTime() in this case or a future seek() may 1026 // |paused_time_| matches currentTime() in this case or a future seek() may
1017 // incorrectly discard what it thinks is a seek to the existing time. 1027 // incorrectly discard what it thinks is a seek to the existing time.
1018 paused_time_ = 1028 paused_time_ =
1019 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime(); 1029 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime();
1020 } 1030 }
1021 1031
1022 } // namespace media 1032 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698