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

Unified Diff: media/webm/webm_content_encodings_client.cc

Issue 11471006: Log MediaSource parsing errors to the MediaLog so they can appear in chrome:media-internals. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nit. Created 8 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
« no previous file with comments | « media/webm/webm_content_encodings_client.h ('k') | media/webm/webm_content_encodings_client_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..bcf964ed319017908faa892e30414c5e63819a77 100644
--- a/media/webm/webm_content_encodings_client.cc
+++ b/media/webm/webm_content_encodings_client.cc
@@ -10,8 +10,9 @@
namespace media {
-WebMContentEncodingsClient::WebMContentEncodingsClient()
- : content_encryption_encountered_(false),
+WebMContentEncodingsClient::WebMContentEncodingsClient(const LogCB& log_cb)
+ : log_cb_(log_cb),
+ content_encryption_encountered_(false),
content_encodings_ready_(false) {
}
@@ -43,7 +44,7 @@ WebMParserClient* WebMContentEncodingsClient::OnListStart(int id) {
if (id == kWebMIdContentEncryption) {
DCHECK(cur_content_encoding_.get());
if (content_encryption_encountered_) {
- DVLOG(1) << "Unexpected multiple ContentEncryption.";
+ MEDIA_LOG(log_cb_) << "Unexpected multiple ContentEncryption.";
return NULL;
}
content_encryption_encountered_ = true;
@@ -66,7 +67,7 @@ bool WebMContentEncodingsClient::OnListEnd(int id) {
if (id == kWebMIdContentEncodings) {
// ContentEncoding element is mandatory. Check this!
if (content_encodings_.empty()) {
- DVLOG(1) << "Missing ContentEncoding.";
+ MEDIA_LOG(log_cb_) << "Missing ContentEncoding.";
return false;
}
content_encodings_ready_ = true;
@@ -84,7 +85,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.";
+ MEDIA_LOG(log_cb_) << "Missing ContentEncodingOrder.";
return false;
}
cur_content_encoding_->set_order(0);
@@ -98,15 +99,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.";
+ MEDIA_LOG(log_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.";
+ MEDIA_LOG(log_cb_) << "ContentEncodingType is encryption but"
+ << " ContentEncryption is missing.";
return false;
}
@@ -145,13 +146,13 @@ bool WebMContentEncodingsClient::OnUInt(int id, int64 val) {
if (id == kWebMIdContentEncodingOrder) {
if (cur_content_encoding_->order() != ContentEncoding::kOrderInvalid) {
- DVLOG(1) << "Unexpected multiple ContentEncodingOrder.";
+ MEDIA_LOG(log_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.";
+ MEDIA_LOG(log_cb_) << "Unexpected ContentEncodingOrder.";
return false;
}
@@ -161,18 +162,18 @@ bool WebMContentEncodingsClient::OnUInt(int id, int64 val) {
if (id == kWebMIdContentEncodingScope) {
if (cur_content_encoding_->scope() != ContentEncoding::kScopeInvalid) {
- DVLOG(1) << "Unexpected multiple ContentEncodingScope.";
+ MEDIA_LOG(log_cb_) << "Unexpected multiple ContentEncodingScope.";
return false;
}
if (val == ContentEncoding::kScopeInvalid ||
val > ContentEncoding::kScopeMax) {
- DVLOG(1) << "Unexpected ContentEncodingScope.";
+ MEDIA_LOG(log_cb_) << "Unexpected ContentEncodingScope.";
return false;
}
if (val & ContentEncoding::kScopeNextContentEncodingData) {
- DVLOG(1) << "Encoded next ContentEncoding is not supported.";
+ MEDIA_LOG(log_cb_) << "Encoded next ContentEncoding is not supported.";
return false;
}
@@ -182,17 +183,17 @@ bool WebMContentEncodingsClient::OnUInt(int id, int64 val) {
if (id == kWebMIdContentEncodingType) {
if (cur_content_encoding_->type() != ContentEncoding::kTypeInvalid) {
- DVLOG(1) << "Unexpected multiple ContentEncodingType.";
+ MEDIA_LOG(log_cb_) << "Unexpected multiple ContentEncodingType.";
return false;
}
if (val == ContentEncoding::kTypeCompression) {
- DVLOG(1) << "ContentCompression not supported.";
+ MEDIA_LOG(log_cb_) << "ContentCompression not supported.";
return false;
}
if (val != ContentEncoding::kTypeEncryption) {
- DVLOG(1) << "Unexpected ContentEncodingType " << val << ".";
+ MEDIA_LOG(log_cb_) << "Unexpected ContentEncodingType " << val << ".";
return false;
}
@@ -203,13 +204,13 @@ bool WebMContentEncodingsClient::OnUInt(int id, int64 val) {
if (id == kWebMIdContentEncAlgo) {
if (cur_content_encoding_->encryption_algo() !=
ContentEncoding::kEncAlgoInvalid) {
- DVLOG(1) << "Unexpected multiple ContentEncAlgo.";
+ MEDIA_LOG(log_cb_) << "Unexpected multiple ContentEncAlgo.";
return false;
}
if (val < ContentEncoding::kEncAlgoNotEncrypted ||
val > ContentEncoding::kEncAlgoAes) {
- DVLOG(1) << "Unexpected ContentEncAlgo " << val << ".";
+ MEDIA_LOG(log_cb_) << "Unexpected ContentEncAlgo " << val << ".";
return false;
}
@@ -221,12 +222,12 @@ bool WebMContentEncodingsClient::OnUInt(int id, int64 val) {
if (id == kWebMIdAESSettingsCipherMode) {
if (cur_content_encoding_->cipher_mode() !=
ContentEncoding::kCipherModeInvalid) {
- DVLOG(1) << "Unexpected multiple AESSettingsCipherMode.";
+ MEDIA_LOG(log_cb_) << "Unexpected multiple AESSettingsCipherMode.";
return false;
}
if (val != ContentEncoding::kCipherModeCtr) {
- DVLOG(1) << "Unexpected AESSettingsCipherMode " << val << ".";
+ MEDIA_LOG(log_cb_) << "Unexpected AESSettingsCipherMode " << val << ".";
return false;
}
@@ -249,7 +250,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";
+ MEDIA_LOG(log_cb_) << "Unexpected multiple ContentEncKeyID";
return false;
}
cur_content_encoding_->SetEncryptionKeyId(data, size);
« no previous file with comments | « media/webm/webm_content_encodings_client.h ('k') | media/webm/webm_content_encodings_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698