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

Unified Diff: webkit/renderer/media/android/media_source_delegate.cc

Issue 17449020: Call NotifyDemuxerReady() only once while keys are added. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: webkit/renderer/media/android/media_source_delegate.cc
diff --git a/webkit/renderer/media/android/media_source_delegate.cc b/webkit/renderer/media/android/media_source_delegate.cc
index ada609c293b811a55491c6a289b3d5d1ab8b7d58..1319fe9198b0877a56cf45eff3d07ed2831d2888 100644
--- a/webkit/renderer/media/android/media_source_delegate.cc
+++ b/webkit/renderer/media/android/media_source_delegate.cc
@@ -69,6 +69,7 @@ MediaSourceDelegate::MediaSourceDelegate(WebMediaPlayerProxyAndroid* proxy,
audio_params_(new MediaPlayerHostMsg_ReadFromDemuxerAck_Params),
video_params_(new MediaPlayerHostMsg_ReadFromDemuxerAck_Params),
seeking_(false),
+ can_start_decrypt_(false),
access_unit_size_(0) {
}
@@ -331,7 +332,7 @@ void MediaSourceDelegate::OnDemuxerInitDone(
OnDemuxerError(status);
return;
}
- NotifyDemuxerReady("");
+ NotifyDemuxerReady();
xhwang 2013/06/20 17:30:50 It appears that we NotifyDemuxerReady() multiple t
kjyoun 2013/06/21 00:05:39 Done.
}
void MediaSourceDelegate::OnDemuxerStopDone() {
@@ -341,11 +342,35 @@ void MediaSourceDelegate::OnDemuxerStopDone() {
}
void MediaSourceDelegate::OnMediaConfigRequest() {
- NotifyDemuxerReady("");
+ NotifyDemuxerReady();
+}
+
+void MediaSourceDelegate::NotifyKeyAdded(
+ const std::string& key_system,
+ const std::string& session_id) {
+ // TODO(kjyoun): Change this logic to call NotifyDemuxerReady() when
+ // keys for both of audio and video are loaded, if both are encrypted.
+ // Currently, we notifies when the first key is loaded.
+ if (!can_start_decrypt_) {
+ can_start_decrypt_ = true;
+ NotifyDemuxerReady(key_system);
+ }
+}
+
+bool MediaSourceDelegate::CanNotifyDemuxerReady() {
+ if (can_start_decrypt_)
+ return true;
+ DemuxerStream* audio_stream = demuxer_->GetStream(DemuxerStream::AUDIO);
+ if (audio_stream && audio_stream->audio_decoder_config().is_encrypted())
+ return false;
+ DemuxerStream* video_stream = demuxer_->GetStream(DemuxerStream::VIDEO);
+ if (video_stream && video_stream->video_decoder_config().is_encrypted())
+ return false;
+ return true;
}
void MediaSourceDelegate::NotifyDemuxerReady(const std::string& key_system) {
- if (!demuxer_)
+ if (!demuxer_ || !CanNotifyDemuxerReady())
xhwang 2013/06/20 17:30:50 I prefer DCHECK to "if". Can |demuxer| be NULL her
kjyoun 2013/06/21 00:05:39 Done.
return;
MediaPlayerHostMsg_DemuxerReady_Params params;
DemuxerStream* audio_stream = demuxer_->GetStream(DemuxerStream::AUDIO);
@@ -373,9 +398,7 @@ void MediaSourceDelegate::NotifyDemuxerReady(const std::string& key_system) {
params.duration_ms = GetDurationMs();
params.key_system = key_system;
- bool ready_to_send = (!params.is_audio_encrypted &&
- !params.is_video_encrypted) || !key_system.empty();
- if (proxy_ && ready_to_send)
+ if (proxy_)
proxy_->DemuxerReady(player_id_, params);
}

Powered by Google App Engine
This is Rietveld 408576698