| Index: media/formats/webm/webm_content_encodings_client.cc
|
| diff --git a/media/formats/webm/webm_content_encodings_client.cc b/media/formats/webm/webm_content_encodings_client.cc
|
| index 7265df94f6e65c45ea75e7d9c88d9e2acbae3060..a9783ddf99d0add817533b272cf71015d058b31c 100644
|
| --- a/media/formats/webm/webm_content_encodings_client.cc
|
| +++ b/media/formats/webm/webm_content_encodings_client.cc
|
| @@ -10,8 +10,9 @@
|
|
|
| namespace media {
|
|
|
| -WebMContentEncodingsClient::WebMContentEncodingsClient(const LogCB& log_cb)
|
| - : log_cb_(log_cb),
|
| +WebMContentEncodingsClient::WebMContentEncodingsClient(
|
| + const scoped_refptr<MediaLog>& media_log)
|
| + : media_log_(media_log),
|
| content_encryption_encountered_(false),
|
| content_encodings_ready_(false) {
|
| }
|
| @@ -44,7 +45,7 @@ WebMParserClient* WebMContentEncodingsClient::OnListStart(int id) {
|
| if (id == kWebMIdContentEncryption) {
|
| DCHECK(cur_content_encoding_.get());
|
| if (content_encryption_encountered_) {
|
| - MEDIA_LOG(ERROR, log_cb_) << "Unexpected multiple ContentEncryption.";
|
| + MEDIA_LOG(ERROR, media_log_) << "Unexpected multiple ContentEncryption.";
|
| return NULL;
|
| }
|
| content_encryption_encountered_ = true;
|
| @@ -67,7 +68,7 @@ bool WebMContentEncodingsClient::OnListEnd(int id) {
|
| if (id == kWebMIdContentEncodings) {
|
| // ContentEncoding element is mandatory. Check this!
|
| if (content_encodings_.empty()) {
|
| - MEDIA_LOG(ERROR, log_cb_) << "Missing ContentEncoding.";
|
| + MEDIA_LOG(ERROR, media_log_) << "Missing ContentEncoding.";
|
| return false;
|
| }
|
| content_encodings_ready_ = true;
|
| @@ -85,7 +86,7 @@ bool WebMContentEncodingsClient::OnListEnd(int id) {
|
| // Default value of encoding order is 0, which should only be used on the
|
| // first ContentEncoding.
|
| if (!content_encodings_.empty()) {
|
| - MEDIA_LOG(ERROR, log_cb_) << "Missing ContentEncodingOrder.";
|
| + MEDIA_LOG(ERROR, media_log_) << "Missing ContentEncodingOrder.";
|
| return false;
|
| }
|
| cur_content_encoding_->set_order(0);
|
| @@ -99,15 +100,15 @@ bool WebMContentEncodingsClient::OnListEnd(int id) {
|
|
|
| // Check for elements valid in spec but not supported for now.
|
| if (cur_content_encoding_->type() == ContentEncoding::kTypeCompression) {
|
| - MEDIA_LOG(ERROR, log_cb_) << "ContentCompression not supported.";
|
| + MEDIA_LOG(ERROR, media_log_) << "ContentCompression not supported.";
|
| return false;
|
| }
|
|
|
| // Enforce mandatory elements without default values.
|
| DCHECK(cur_content_encoding_->type() == ContentEncoding::kTypeEncryption);
|
| if (!content_encryption_encountered_) {
|
| - MEDIA_LOG(ERROR, log_cb_) << "ContentEncodingType is encryption but"
|
| - << " ContentEncryption is missing.";
|
| + MEDIA_LOG(ERROR, media_log_) << "ContentEncodingType is encryption but"
|
| + << " ContentEncryption is missing.";
|
| return false;
|
| }
|
|
|
| @@ -146,13 +147,14 @@ bool WebMContentEncodingsClient::OnUInt(int id, int64 val) {
|
|
|
| if (id == kWebMIdContentEncodingOrder) {
|
| if (cur_content_encoding_->order() != ContentEncoding::kOrderInvalid) {
|
| - MEDIA_LOG(ERROR, log_cb_) << "Unexpected multiple ContentEncodingOrder.";
|
| + MEDIA_LOG(ERROR, media_log_)
|
| + << "Unexpected multiple ContentEncodingOrder.";
|
| return false;
|
| }
|
|
|
| if (val != static_cast<int64>(content_encodings_.size())) {
|
| // According to the spec, encoding order starts with 0 and counts upwards.
|
| - MEDIA_LOG(ERROR, log_cb_) << "Unexpected ContentEncodingOrder.";
|
| + MEDIA_LOG(ERROR, media_log_) << "Unexpected ContentEncodingOrder.";
|
| return false;
|
| }
|
|
|
| @@ -162,19 +164,20 @@ bool WebMContentEncodingsClient::OnUInt(int id, int64 val) {
|
|
|
| if (id == kWebMIdContentEncodingScope) {
|
| if (cur_content_encoding_->scope() != ContentEncoding::kScopeInvalid) {
|
| - MEDIA_LOG(ERROR, log_cb_) << "Unexpected multiple ContentEncodingScope.";
|
| + MEDIA_LOG(ERROR, media_log_)
|
| + << "Unexpected multiple ContentEncodingScope.";
|
| return false;
|
| }
|
|
|
| if (val == ContentEncoding::kScopeInvalid ||
|
| val > ContentEncoding::kScopeMax) {
|
| - MEDIA_LOG(ERROR, log_cb_) << "Unexpected ContentEncodingScope.";
|
| + MEDIA_LOG(ERROR, media_log_) << "Unexpected ContentEncodingScope.";
|
| return false;
|
| }
|
|
|
| if (val & ContentEncoding::kScopeNextContentEncodingData) {
|
| - MEDIA_LOG(ERROR, log_cb_) << "Encoded next ContentEncoding is not "
|
| - "supported.";
|
| + MEDIA_LOG(ERROR, media_log_) << "Encoded next ContentEncoding is not "
|
| + "supported.";
|
| return false;
|
| }
|
|
|
| @@ -184,18 +187,19 @@ bool WebMContentEncodingsClient::OnUInt(int id, int64 val) {
|
|
|
| if (id == kWebMIdContentEncodingType) {
|
| if (cur_content_encoding_->type() != ContentEncoding::kTypeInvalid) {
|
| - MEDIA_LOG(ERROR, log_cb_) << "Unexpected multiple ContentEncodingType.";
|
| + MEDIA_LOG(ERROR, media_log_)
|
| + << "Unexpected multiple ContentEncodingType.";
|
| return false;
|
| }
|
|
|
| if (val == ContentEncoding::kTypeCompression) {
|
| - MEDIA_LOG(ERROR, log_cb_) << "ContentCompression not supported.";
|
| + MEDIA_LOG(ERROR, media_log_) << "ContentCompression not supported.";
|
| return false;
|
| }
|
|
|
| if (val != ContentEncoding::kTypeEncryption) {
|
| - MEDIA_LOG(ERROR, log_cb_) << "Unexpected ContentEncodingType " << val
|
| - << ".";
|
| + MEDIA_LOG(ERROR, media_log_) << "Unexpected ContentEncodingType " << val
|
| + << ".";
|
| return false;
|
| }
|
|
|
| @@ -206,13 +210,14 @@ bool WebMContentEncodingsClient::OnUInt(int id, int64 val) {
|
| if (id == kWebMIdContentEncAlgo) {
|
| if (cur_content_encoding_->encryption_algo() !=
|
| ContentEncoding::kEncAlgoInvalid) {
|
| - MEDIA_LOG(ERROR, log_cb_) << "Unexpected multiple ContentEncAlgo.";
|
| + MEDIA_LOG(ERROR, media_log_) << "Unexpected multiple ContentEncAlgo.";
|
| return false;
|
| }
|
|
|
| if (val < ContentEncoding::kEncAlgoNotEncrypted ||
|
| val > ContentEncoding::kEncAlgoAes) {
|
| - MEDIA_LOG(ERROR, log_cb_) << "Unexpected ContentEncAlgo " << val << ".";
|
| + MEDIA_LOG(ERROR, media_log_) << "Unexpected ContentEncAlgo " << val
|
| + << ".";
|
| return false;
|
| }
|
|
|
| @@ -224,13 +229,14 @@ bool WebMContentEncodingsClient::OnUInt(int id, int64 val) {
|
| if (id == kWebMIdAESSettingsCipherMode) {
|
| if (cur_content_encoding_->cipher_mode() !=
|
| ContentEncoding::kCipherModeInvalid) {
|
| - MEDIA_LOG(ERROR, log_cb_) << "Unexpected multiple AESSettingsCipherMode.";
|
| + MEDIA_LOG(ERROR, media_log_)
|
| + << "Unexpected multiple AESSettingsCipherMode.";
|
| return false;
|
| }
|
|
|
| if (val != ContentEncoding::kCipherModeCtr) {
|
| - MEDIA_LOG(ERROR, log_cb_) << "Unexpected AESSettingsCipherMode " << val
|
| - << ".";
|
| + MEDIA_LOG(ERROR, media_log_) << "Unexpected AESSettingsCipherMode " << val
|
| + << ".";
|
| return false;
|
| }
|
|
|
| @@ -253,7 +259,7 @@ bool WebMContentEncodingsClient::OnBinary(int id, const uint8* data, int size) {
|
|
|
| if (id == kWebMIdContentEncKeyID) {
|
| if (!cur_content_encoding_->encryption_key_id().empty()) {
|
| - MEDIA_LOG(ERROR, log_cb_) << "Unexpected multiple ContentEncKeyID";
|
| + MEDIA_LOG(ERROR, media_log_) << "Unexpected multiple ContentEncKeyID";
|
| return false;
|
| }
|
| cur_content_encoding_->SetEncryptionKeyId(data, size);
|
|
|