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

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: 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
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::OnWaitingForEncryptionKey() {
682 client_->waitingForKey();
683 }
684
681 void WebMediaPlayerImpl::SetCdm(CdmContext* cdm_context, 685 void WebMediaPlayerImpl::SetCdm(CdmContext* cdm_context,
682 const CdmAttachedCB& cdm_attached_cb) { 686 const CdmAttachedCB& cdm_attached_cb) {
683 pipeline_.SetCdm(cdm_context, cdm_attached_cb); 687 pipeline_.SetCdm(cdm_context, cdm_attached_cb);
684 } 688 }
685 689
686 void WebMediaPlayerImpl::OnCdmAttached( 690 void WebMediaPlayerImpl::OnCdmAttached(
687 blink::WebContentDecryptionModuleResult result, 691 blink::WebContentDecryptionModuleResult result,
688 bool success) { 692 bool success) {
689 if (success) { 693 if (success) {
690 result.complete(); 694 result.complete();
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 chunk_demuxer_ = new ChunkDemuxer( 876 chunk_demuxer_ = new ChunkDemuxer(
873 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnDemuxerOpened), 877 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnDemuxerOpened),
874 encrypted_media_init_data_cb, mse_log_cb, media_log_, true); 878 encrypted_media_init_data_cb, mse_log_cb, media_log_, true);
875 demuxer_.reset(chunk_demuxer_); 879 demuxer_.reset(chunk_demuxer_);
876 } 880 }
877 881
878 // ... and we're ready to go! 882 // ... and we're ready to go!
879 seeking_ = true; 883 seeking_ = true;
880 884
881 pipeline_.Start( 885 pipeline_.Start(
882 demuxer_.get(), 886 demuxer_.get(), renderer_factory_->CreateRenderer(
883 renderer_factory_->CreateRenderer(media_task_runner_, 887 media_task_runner_, audio_source_provider_.get()),
884 audio_source_provider_.get()),
885 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnPipelineEnded), 888 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnPipelineEnded),
886 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnPipelineError), 889 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnPipelineError),
887 BIND_TO_RENDER_LOOP1(&WebMediaPlayerImpl::OnPipelineSeeked, false), 890 BIND_TO_RENDER_LOOP1(&WebMediaPlayerImpl::OnPipelineSeeked, false),
888 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnPipelineMetadata), 891 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnPipelineMetadata),
889 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnPipelineBufferingStateChanged), 892 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnPipelineBufferingStateChanged),
890 base::Bind(&WebMediaPlayerImpl::FrameReady, base::Unretained(this)), 893 base::Bind(&WebMediaPlayerImpl::FrameReady, base::Unretained(this)),
891 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnDurationChanged), 894 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnDurationChanged),
892 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnAddTextTrack)); 895 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnAddTextTrack),
896 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnWaitingForEncryptionKey));
893 } 897 }
894 898
895 void WebMediaPlayerImpl::SetNetworkState(WebMediaPlayer::NetworkState state) { 899 void WebMediaPlayerImpl::SetNetworkState(WebMediaPlayer::NetworkState state) {
896 DVLOG(1) << __FUNCTION__ << "(" << state << ")"; 900 DVLOG(1) << __FUNCTION__ << "(" << state << ")";
897 DCHECK(main_task_runner_->BelongsToCurrentThread()); 901 DCHECK(main_task_runner_->BelongsToCurrentThread());
898 network_state_ = state; 902 network_state_ = state;
899 // Always notify to ensure client has the latest value. 903 // Always notify to ensure client has the latest value.
900 client_->networkStateChanged(); 904 client_->networkStateChanged();
901 } 905 }
902 906
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 1003
1000 // pause() may be called after playback has ended and the HTMLMediaElement 1004 // pause() may be called after playback has ended and the HTMLMediaElement
1001 // requires that currentTime() == duration() after ending. We want to ensure 1005 // requires that currentTime() == duration() after ending. We want to ensure
1002 // |paused_time_| matches currentTime() in this case or a future seek() may 1006 // |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. 1007 // incorrectly discard what it thinks is a seek to the existing time.
1004 paused_time_ = 1008 paused_time_ =
1005 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime(); 1009 ended_ ? pipeline_.GetMediaDuration() : pipeline_.GetMediaTime();
1006 } 1010 }
1007 1011
1008 } // namespace media 1012 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698