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

Unified Diff: media/mp4/box_reader.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/mp4/box_reader.h ('k') | media/mp4/box_reader_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/mp4/box_reader.cc
diff --git a/media/mp4/box_reader.cc b/media/mp4/box_reader.cc
index 1285ebfdb412297c17d95b67bf626a96ed28f81e..71d93a0bcf7cee308676ec62cb04216ecc654f30 100644
--- a/media/mp4/box_reader.cc
+++ b/media/mp4/box_reader.cc
@@ -79,8 +79,10 @@ bool BufferReader::Read4sInto8s(int64* v) {
}
-BoxReader::BoxReader(const uint8* buf, const int size)
+BoxReader::BoxReader(const uint8* buf, const int size,
+ const LogCB& log_cb)
: BufferReader(buf, size),
+ log_cb_(log_cb),
type_(FOURCC_NULL),
version_(0),
flags_(0),
@@ -99,12 +101,13 @@ BoxReader::~BoxReader() {
// static
BoxReader* BoxReader::ReadTopLevelBox(const uint8* buf,
const int buf_size,
+ const LogCB& log_cb,
bool* err) {
- scoped_ptr<BoxReader> reader(new BoxReader(buf, buf_size));
+ scoped_ptr<BoxReader> reader(new BoxReader(buf, buf_size, log_cb));
if (!reader->ReadHeader(err))
return NULL;
- if (!IsValidTopLevelBox(reader->type())) {
+ if (!IsValidTopLevelBox(reader->type(), log_cb)) {
*err = true;
return NULL;
}
@@ -118,12 +121,13 @@ BoxReader* BoxReader::ReadTopLevelBox(const uint8* buf,
// static
bool BoxReader::StartTopLevelBox(const uint8* buf,
const int buf_size,
+ const LogCB& log_cb,
FourCC* type,
int* box_size,
bool* err) {
- BoxReader reader(buf, buf_size);
+ BoxReader reader(buf, buf_size, log_cb);
if (!reader.ReadHeader(err)) return false;
- if (!IsValidTopLevelBox(reader.type())) {
+ if (!IsValidTopLevelBox(reader.type(), log_cb)) {
*err = true;
return false;
}
@@ -133,7 +137,8 @@ bool BoxReader::StartTopLevelBox(const uint8* buf,
}
// static
-bool BoxReader::IsValidTopLevelBox(const FourCC& type) {
+bool BoxReader::IsValidTopLevelBox(const FourCC& type,
+ const LogCB& log_cb) {
switch (type) {
case FOURCC_FTYP:
case FOURCC_PDIN:
@@ -152,8 +157,8 @@ bool BoxReader::IsValidTopLevelBox(const FourCC& type) {
return true;
default:
// Hex is used to show nonprintable characters and aid in debugging
- LOG(WARNING) << "Unrecognized top-level box type 0x"
- << std::hex << type;
+ MEDIA_LOG(log_cb) << "Unrecognized top-level box type 0x"
+ << std::hex << type;
return false;
}
}
@@ -164,7 +169,7 @@ bool BoxReader::ScanChildren() {
bool err = false;
while (pos() < size()) {
- BoxReader child(&buf_[pos_], size_ - pos_);
+ BoxReader child(&buf_[pos_], size_ - pos_, log_cb_);
if (!child.ReadHeader(&err)) break;
children_.insert(std::pair<FourCC, BoxReader>(child.type(), child));
« no previous file with comments | « media/mp4/box_reader.h ('k') | media/mp4/box_reader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698