| Index: media/webm/webm_content_encodings_client.cc
|
| diff --git a/media/webm/webm_content_encodings_client.cc b/media/webm/webm_content_encodings_client.cc
|
| index 2541e0b84eadd599dbc22350b5c1d87ca74475fe..77b3d0798f14326639c77dd1330d8d5f9e1ddb31 100644
|
| --- a/media/webm/webm_content_encodings_client.cc
|
| +++ b/media/webm/webm_content_encodings_client.cc
|
| @@ -10,8 +10,10 @@
|
|
|
| namespace media {
|
|
|
| -WebMContentEncodingsClient::WebMContentEncodingsClient()
|
| - : content_encryption_encountered_(false),
|
| +WebMContentEncodingsClient::WebMContentEncodingsClient(
|
| + const ErrorLogCB& error_cb)
|
| + : error_cb_(error_cb),
|
| + content_encryption_encountered_(false),
|
| content_encodings_ready_(false) {
|
| }
|
|
|
| @@ -43,7 +45,7 @@ WebMParserClient* WebMContentEncodingsClient::OnListStart(int id) {
|
| if (id == kWebMIdContentEncryption) {
|
| DCHECK(cur_content_encoding_.get());
|
| if (content_encryption_encountered_) {
|
| - DVLOG(1) << "Unexpected multiple ContentEncryption.";
|
| + ERROR_LOG(error_cb_) << "Unexpected multiple ContentEncryption.";
|
| return NULL;
|
| }
|
| content_encryption_encountered_ = true;
|
| @@ -66,7 +68,7 @@ bool WebMContentEncodingsClient::OnListEnd(int id) {
|
| if (id == kWebMIdContentEncodings) {
|
| // ContentEncoding element is mandatory. Check this!
|
| if (content_encodings_.empty()) {
|
| - DVLOG(1) << "Missing ContentEncoding.";
|
| + ERROR_LOG(error_cb_) << "Missing ContentEncoding.";
|
| return false;
|
| }
|
| content_encodings_ready_ = true;
|
| @@ -84,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()) {
|
| - DVLOG(1) << "Missing ContentEncodingOrder.";
|
| + ERROR_LOG(error_cb_) << "Missing ContentEncodingOrder.";
|
| return false;
|
| }
|
| cur_content_encoding_->set_order(0);
|
| @@ -98,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) {
|
| - DVLOG(1) << "ContentCompression not supported.";
|
| + ERROR_LOG(error_cb_) << "ContentCompression not supported.";
|
| return false;
|
| }
|
|
|
| // Enforce mandatory elements without default values.
|
| DCHECK(cur_content_encoding_->type() == ContentEncoding::kTypeEncryption);
|
| if (!content_encryption_encountered_) {
|
| - DVLOG(1) << "ContentEncodingType is encryption but ContentEncryption "
|
| - "is missing.";
|
| + ERROR_LOG(error_cb_) << "ContentEncodingType is encryption but"
|
| + << " ContentEncryption is missing.";
|
| return false;
|
| }
|
|
|
| @@ -145,13 +147,13 @@ bool WebMContentEncodingsClient::OnUInt(int id, int64 val) {
|
|
|
| if (id == kWebMIdContentEncodingOrder) {
|
| if (cur_content_encoding_->order() != ContentEncoding::kOrderInvalid) {
|
| - DVLOG(1) << "Unexpected multiple ContentEncodingOrder.";
|
| + ERROR_LOG(error_cb_) << "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.
|
| - DVLOG(1) << "Unexpected ContentEncodingOrder.";
|
| + ERROR_LOG(error_cb_) << "Unexpected ContentEncodingOrder.";
|
| return false;
|
| }
|
|
|
| @@ -161,18 +163,18 @@ bool WebMContentEncodingsClient::OnUInt(int id, int64 val) {
|
|
|
| if (id == kWebMIdContentEncodingScope) {
|
| if (cur_content_encoding_->scope() != ContentEncoding::kScopeInvalid) {
|
| - DVLOG(1) << "Unexpected multiple ContentEncodingScope.";
|
| + ERROR_LOG(error_cb_) << "Unexpected multiple ContentEncodingScope.";
|
| return false;
|
| }
|
|
|
| if (val == ContentEncoding::kScopeInvalid ||
|
| val > ContentEncoding::kScopeMax) {
|
| - DVLOG(1) << "Unexpected ContentEncodingScope.";
|
| + ERROR_LOG(error_cb_) << "Unexpected ContentEncodingScope.";
|
| return false;
|
| }
|
|
|
| if (val & ContentEncoding::kScopeNextContentEncodingData) {
|
| - DVLOG(1) << "Encoded next ContentEncoding is not supported.";
|
| + ERROR_LOG(error_cb_) << "Encoded next ContentEncoding is not supported.";
|
| return false;
|
| }
|
|
|
| @@ -182,17 +184,17 @@ bool WebMContentEncodingsClient::OnUInt(int id, int64 val) {
|
|
|
| if (id == kWebMIdContentEncodingType) {
|
| if (cur_content_encoding_->type() != ContentEncoding::kTypeInvalid) {
|
| - DVLOG(1) << "Unexpected multiple ContentEncodingType.";
|
| + ERROR_LOG(error_cb_) << "Unexpected multiple ContentEncodingType.";
|
| return false;
|
| }
|
|
|
| if (val == ContentEncoding::kTypeCompression) {
|
| - DVLOG(1) << "ContentCompression not supported.";
|
| + ERROR_LOG(error_cb_) << "ContentCompression not supported.";
|
| return false;
|
| }
|
|
|
| if (val != ContentEncoding::kTypeEncryption) {
|
| - DVLOG(1) << "Unexpected ContentEncodingType " << val << ".";
|
| + ERROR_LOG(error_cb_) << "Unexpected ContentEncodingType " << val << ".";
|
| return false;
|
| }
|
|
|
| @@ -203,13 +205,13 @@ bool WebMContentEncodingsClient::OnUInt(int id, int64 val) {
|
| if (id == kWebMIdContentEncAlgo) {
|
| if (cur_content_encoding_->encryption_algo() !=
|
| ContentEncoding::kEncAlgoInvalid) {
|
| - DVLOG(1) << "Unexpected multiple ContentEncAlgo.";
|
| + ERROR_LOG(error_cb_) << "Unexpected multiple ContentEncAlgo.";
|
| return false;
|
| }
|
|
|
| if (val < ContentEncoding::kEncAlgoNotEncrypted ||
|
| val > ContentEncoding::kEncAlgoAes) {
|
| - DVLOG(1) << "Unexpected ContentEncAlgo " << val << ".";
|
| + ERROR_LOG(error_cb_) << "Unexpected ContentEncAlgo " << val << ".";
|
| return false;
|
| }
|
|
|
| @@ -221,12 +223,12 @@ bool WebMContentEncodingsClient::OnUInt(int id, int64 val) {
|
| if (id == kWebMIdAESSettingsCipherMode) {
|
| if (cur_content_encoding_->cipher_mode() !=
|
| ContentEncoding::kCipherModeInvalid) {
|
| - DVLOG(1) << "Unexpected multiple AESSettingsCipherMode.";
|
| + ERROR_LOG(error_cb_) << "Unexpected multiple AESSettingsCipherMode.";
|
| return false;
|
| }
|
|
|
| if (val != ContentEncoding::kCipherModeCtr) {
|
| - DVLOG(1) << "Unexpected AESSettingsCipherMode " << val << ".";
|
| + ERROR_LOG(error_cb_) << "Unexpected AESSettingsCipherMode " << val << ".";
|
| return false;
|
| }
|
|
|
| @@ -249,7 +251,7 @@ bool WebMContentEncodingsClient::OnBinary(int id, const uint8* data, int size) {
|
|
|
| if (id == kWebMIdContentEncKeyID) {
|
| if (!cur_content_encoding_->encryption_key_id().empty()) {
|
| - DVLOG(1) << "Unexpected multiple ContentEncKeyID";
|
| + ERROR_LOG(error_cb_) << "Unexpected multiple ContentEncKeyID";
|
| return false;
|
| }
|
| cur_content_encoding_->SetEncryptionKeyId(data, size);
|
|
|