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

Unified Diff: media/blink/encrypted_media_player_support.cc

Issue 759933003: Move OnNeedKey() to WebMediaPlayerImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed Created 6 years 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: media/blink/encrypted_media_player_support.cc
diff --git a/media/blink/encrypted_media_player_support.cc b/media/blink/encrypted_media_player_support.cc
index bfb6ed526fda120f54a1dbf0c3457ad69706f0b0..b74055f4889184917831a18c686ea0ea4fb74a57 100644
--- a/media/blink/encrypted_media_player_support.cc
+++ b/media/blink/encrypted_media_player_support.cc
@@ -20,7 +20,6 @@
#include "third_party/WebKit/public/platform/WebMediaPlayerClient.h"
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
-#include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
using blink::WebMediaPlayer;
using blink::WebMediaPlayerClient;
@@ -138,9 +137,8 @@ EncryptedMediaPlayerSupport::GenerateKeyRequest(
std::string ascii_key_system =
GetUnprefixedKeySystemName(ToASCIIOrEmpty(key_system));
- WebMediaPlayer::MediaKeyException e =
- GenerateKeyRequestInternal(frame, ascii_key_system, init_data,
- init_data_length);
+ WebMediaPlayer::MediaKeyException e = GenerateKeyRequestInternal(
+ frame, ascii_key_system, init_data, init_data_length);
ReportMediaKeyExceptionToUMA("generateKeyRequest", ascii_key_system, e);
return e;
}
@@ -185,11 +183,8 @@ EncryptedMediaPlayerSupport::GenerateKeyRequestInternal(
if (init_data_type.empty())
init_data_type = GuessInitDataType(init_data, init_data_length);
- // TODO(xhwang): We assume all streams are from the same container (thus have
- // the same "type") for now. In the future, the "type" should be passed down
- // from the application.
- if (!proxy_decryptor_->GenerateKeyRequest(
- init_data_type, init_data, init_data_length)) {
+ if (!proxy_decryptor_->GenerateKeyRequest(init_data_type, init_data,
ddorwin 2014/12/02 22:06:38 nit: IMO when grouping, we should group pointers w
xhwang 2014/12/02 22:31:27 I'am now totally on clang format and not doing any
+ init_data_length)) {
current_key_system_.clear();
return WebMediaPlayer::MediaKeyExceptionKeySystemNotSupported;
}
@@ -278,32 +273,18 @@ EncryptedMediaPlayerSupport::CancelKeyRequestInternal(
return WebMediaPlayer::MediaKeyExceptionNoError;
}
-Demuxer::NeedKeyCB EncryptedMediaPlayerSupport::CreateNeedKeyCB() {
- return BIND_TO_RENDER_LOOP(&EncryptedMediaPlayerSupport::OnNeedKey);
-}
-
void EncryptedMediaPlayerSupport::OnPipelineDecryptError() {
EmeUMAHistogramCounts(current_key_system_, "DecryptError", 1);
}
-void EncryptedMediaPlayerSupport::OnNeedKey(
- const std::string& type,
- const std::vector<uint8>& init_data) {
- // Do not fire NeedKey event if encrypted media is not enabled.
- if (!blink::WebRuntimeFeatures::isPrefixedEncryptedMediaEnabled() &&
- !blink::WebRuntimeFeatures::isEncryptedMediaEnabled()) {
- return;
- }
-
- UMA_HISTOGRAM_COUNTS(kMediaEme + std::string("NeedKey"), 1);
-
- DCHECK(init_data_type_.empty() || type.empty() || type == init_data_type_);
+void EncryptedMediaPlayerSupport::SetInitDataType(
+ const std::string& init_data_type) {
+ DCHECK(!init_data_type.empty());
+ DLOG_IF(WARNING,
+ !init_data_type_.empty() && init_data_type != init_data_type_)
+ << "Mixed init data type not supported. The new type is ignored.";
if (init_data_type_.empty())
- init_data_type_ = type;
-
- const uint8* init_data_ptr = init_data.empty() ? NULL : &init_data[0];
- client_->encrypted(WebString::fromUTF8(type), init_data_ptr,
- base::saturated_cast<unsigned int>(init_data.size()));
+ init_data_type_ = init_data_type;
}
void EncryptedMediaPlayerSupport::OnKeyAdded(const std::string& session_id) {

Powered by Google App Engine
This is Rietveld 408576698