Commit 4d8bd581 authored by wolenetz's avatar wolenetz Committed by Commit bot

MSE: Increase log visibility when unfragmented MP4 causes parse failure

Adds an error log entry to chrome://media-internals when MSE's
MP4 stream parser detects an unfragmented MP4. This error log should
help make it more clear why the parse fails in this unfortunately common
case.

BUG=487410
R=dalecurtis,chcunningham
TEST=Manually verified the log entry occurs for the repro in bug 487410.

Review URL: https://codereview.chromium.org/1147453002

Cr-Commit-Position: refs/heads/master@{#330178}
parent 2e03e11f
......@@ -657,12 +657,15 @@ Movie::~Movie() {}
FourCC Movie::BoxType() const { return FOURCC_MOOV; }
bool Movie::Parse(BoxReader* reader) {
return reader->ScanChildren() &&
reader->ReadChild(&header) &&
reader->ReadChildren(&tracks) &&
// Media Source specific: 'mvex' required
reader->ReadChild(&extends) &&
reader->MaybeReadChildren(&pssh);
RCHECK(reader->ScanChildren() && reader->ReadChild(&header) &&
reader->ReadChildren(&tracks));
RCHECK_MEDIA_LOGGED(reader->ReadChild(&extends), reader->log_cb(),
"Detected unfragmented MP4. Media Source Extensions "
"require ISO BMFF moov to contain mvex to indicate that "
"Movie Fragments are to be expected.");
return reader->MaybeReadChildren(&pssh);
}
TrackFragmentDecodeTime::TrackFragmentDecodeTime() : decode_time(0) {}
......
......@@ -11,6 +11,7 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "media/base/media_export.h"
#include "media/base/media_log.h"
#include "media/formats/mp4/aac.h"
#include "media/formats/mp4/avc.h"
#include "media/formats/mp4/box_reader.h"
......
......@@ -219,7 +219,8 @@ bool BoxReader::ReadHeader(bool* err) {
CHECK(Read4Into8(&size) && ReadFourCC(&type_));
if (size == 0) {
// Media Source specific: we do not support boxes that run to EOS.
MEDIA_LOG(DEBUG, log_cb_) << "Media Source Extensions do not support ISO "
"BMFF boxes that run to EOS";
*err = true;
return false;
} else if (size == 1) {
......
......@@ -22,7 +22,10 @@ class BoxReader;
struct MEDIA_EXPORT Box {
virtual ~Box();
// Parse errors may be logged using the BoxReader's log callback.
virtual bool Parse(BoxReader* reader) = 0;
virtual FourCC BoxType() const = 0;
};
......
......@@ -6,13 +6,25 @@
#define MEDIA_FORMATS_MP4_RCHECK_H_
#include "base/logging.h"
#include "media/base/media_log.h"
#define RCHECK(x) \
do { \
if (!(x)) { \
DLOG(ERROR) << "Failure while parsing MP4: " << #x; \
return false; \
} \
} while (0)
#define RCHECK_MEDIA_LOGGED(condition, log_cb, msg) \
do { \
if (!(condition)) { \
DLOG(ERROR) << "Failure while parsing MP4: " #condition; \
MEDIA_LOG(ERROR, log_cb) << "Failure parsing MP4: " << (msg); \
return false; \
} \
} while (0)
// TODO(wolenetz,chcunningham): Where appropriate, replace usage of this macro
// in favor of RCHECK_MEDIA_LOGGED. See https://crbug.com/487410.
#define RCHECK(condition) \
do { \
if (!(condition)) { \
DLOG(ERROR) << "Failure while parsing MP4: " #condition; \
return false; \
} \
} while (0)
#endif // MEDIA_FORMATS_MP4_RCHECK_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment