OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/renderer/media/crypto/encrypted_media_player_support_impl.h" | 5 #include "content/renderer/media/crypto/encrypted_media_player_support_impl.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
365 | 365 |
366 media::Demuxer::NeedKeyCB | 366 media::Demuxer::NeedKeyCB |
367 EncryptedMediaPlayerSupportImpl::CreateNeedKeyCB() { | 367 EncryptedMediaPlayerSupportImpl::CreateNeedKeyCB() { |
368 return BIND_TO_RENDER_LOOP(&EncryptedMediaPlayerSupportImpl::OnNeedKey); | 368 return BIND_TO_RENDER_LOOP(&EncryptedMediaPlayerSupportImpl::OnNeedKey); |
369 } | 369 } |
370 | 370 |
371 void EncryptedMediaPlayerSupportImpl::OnPipelineDecryptError() { | 371 void EncryptedMediaPlayerSupportImpl::OnPipelineDecryptError() { |
372 EmeUMAHistogramCounts(current_key_system_, "DecryptError", 1); | 372 EmeUMAHistogramCounts(current_key_system_, "DecryptError", 1); |
373 } | 373 } |
374 | 374 |
375 void EncryptedMediaPlayerSupportImpl::OnNeedKey(const std::string& type, | 375 void EncryptedMediaPlayerSupportImpl::OnNeedKey(const std::string& type, |
ddorwin
2014/10/14 18:54:40
|type| is a bit ambiguous.
ddorwin
2014/10/14 18:54:40
We should update this too sometime.
Note that we h
| |
376 const std::vector<uint8>& init_data) { | 376 const std::vector<uint8>& init_data) { |
377 // Do not fire NeedKey event if encrypted media is not enabled. | 377 // Do not fire NeedKey event if encrypted media is not enabled. |
378 if (!blink::WebRuntimeFeatures::isPrefixedEncryptedMediaEnabled() && | 378 if (!blink::WebRuntimeFeatures::isPrefixedEncryptedMediaEnabled() && |
379 !blink::WebRuntimeFeatures::isEncryptedMediaEnabled()) { | 379 !blink::WebRuntimeFeatures::isEncryptedMediaEnabled()) { |
380 return; | 380 return; |
381 } | 381 } |
382 | 382 |
383 UMA_HISTOGRAM_COUNTS(kMediaEme + std::string("NeedKey"), 1); | 383 UMA_HISTOGRAM_COUNTS(kMediaEme + std::string("NeedKey"), 1); |
384 | 384 |
385 DCHECK(init_data_type_.empty() || type.empty() || type == init_data_type_); | 385 DCHECK(init_data_type_.empty() || type.empty() || type == init_data_type_); |
386 if (init_data_type_.empty()) | 386 if (init_data_type_.empty()) |
387 init_data_type_ = type; | 387 init_data_type_ = type; |
388 | 388 |
389 const uint8* init_data_ptr = init_data.empty() ? NULL : &init_data[0]; | 389 const uint8* init_data_ptr = init_data.empty() ? NULL : &init_data[0]; |
390 client_->keyNeeded( | 390 client_->encrypted( |
391 WebString::fromUTF8(type), init_data_ptr, init_data.size()); | 391 WebString::fromUTF8(type), init_data_ptr, init_data.size()); |
392 } | 392 } |
393 | 393 |
394 void EncryptedMediaPlayerSupportImpl::OnKeyAdded( | 394 void EncryptedMediaPlayerSupportImpl::OnKeyAdded( |
395 const std::string& session_id) { | 395 const std::string& session_id) { |
396 EmeUMAHistogramCounts(current_key_system_, "KeyAdded", 1); | 396 EmeUMAHistogramCounts(current_key_system_, "KeyAdded", 1); |
397 client_->keyAdded( | 397 client_->keyAdded( |
398 WebString::fromUTF8(GetPrefixedKeySystemName(current_key_system_)), | 398 WebString::fromUTF8(GetPrefixedKeySystemName(current_key_system_)), |
399 WebString::fromUTF8(session_id)); | 399 WebString::fromUTF8(session_id)); |
400 } | 400 } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
463 | 463 |
464 if (web_cdm_) { | 464 if (web_cdm_) { |
465 decryptor_ready_cb.Run(web_cdm_->GetDecryptor(), base::Bind(DoNothing)); | 465 decryptor_ready_cb.Run(web_cdm_->GetDecryptor(), base::Bind(DoNothing)); |
466 return; | 466 return; |
467 } | 467 } |
468 | 468 |
469 decryptor_ready_cb_ = decryptor_ready_cb; | 469 decryptor_ready_cb_ = decryptor_ready_cb; |
470 } | 470 } |
471 | 471 |
472 } // namespace content | 472 } // namespace content |
OLD | NEW |