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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 MediaKeyException result_id = MediaKeyExceptionForUMA(e); | 110 MediaKeyException result_id = MediaKeyExceptionForUMA(e); |
111 DCHECK_NE(result_id, kUnknownResultId) << e; | 111 DCHECK_NE(result_id, kUnknownResultId) << e; |
112 EmeUMAHistogramEnumeration( | 112 EmeUMAHistogramEnumeration( |
113 key_system, method, result_id, kMaxMediaKeyException); | 113 key_system, method, result_id, kMaxMediaKeyException); |
114 } | 114 } |
115 | 115 |
116 // Guess the type of |init_data|. This is only used to handle some corner cases | 116 // Guess the type of |init_data|. This is only used to handle some corner cases |
117 // so we keep it as simple as possible without breaking major use cases. | 117 // so we keep it as simple as possible without breaking major use cases. |
118 static std::string GuessInitDataType(const unsigned char* init_data, | 118 static std::string GuessInitDataType(const unsigned char* init_data, |
119 unsigned init_data_length) { | 119 unsigned init_data_length) { |
120 // Most WebM files use KeyId of 16 bytes. CENC init data is always >16 bytes. | 120 // Most WebM files use KeyId of 16 bytes. MP4 init data are always >16 bytes. |
121 if (init_data_length == 16) | 121 if (init_data_length == 16) |
122 return "webm"; | 122 return "video/webm"; |
123 | 123 |
124 return "cenc"; | 124 return "video/mp4"; |
125 } | 125 } |
126 | 126 |
127 scoped_ptr<media::EncryptedMediaPlayerSupport> | 127 scoped_ptr<media::EncryptedMediaPlayerSupport> |
128 EncryptedMediaPlayerSupportImpl::Create(blink::WebMediaPlayerClient* client) { | 128 EncryptedMediaPlayerSupportImpl::Create(blink::WebMediaPlayerClient* client) { |
129 return scoped_ptr<EncryptedMediaPlayerSupport>( | 129 return scoped_ptr<EncryptedMediaPlayerSupport>( |
130 new EncryptedMediaPlayerSupportImpl(client)); | 130 new EncryptedMediaPlayerSupportImpl(client)); |
131 } | 131 } |
132 | 132 |
133 EncryptedMediaPlayerSupportImpl::EncryptedMediaPlayerSupportImpl( | 133 EncryptedMediaPlayerSupportImpl::EncryptedMediaPlayerSupportImpl( |
134 blink::WebMediaPlayerClient* client) | 134 blink::WebMediaPlayerClient* client) |
(...skipping 328 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 |