Reviewers: chcunningham, DaleCurtis,
Message:
Please take a look.
Using the repro steps from the bug with the unfragmented mp4,
chrome://media-internals shows the following with PS1 applied:
Timestamp Property Value
00:00:00 00 pipeline_state kCreated
00:00:00 00 EVENT PIPELINE_CREATED
00:00:00 00 EVENT WEBMEDIAPLAYER_CREATED
00:00:00
03 url blob:http%3A//
fiddle.jshell.net/31cbd5c4-4c82-4b38-af79-a781d5ec4866
00:00:00 04 pipeline_state kInitDemuxer
00:00:00 39 debug Skipping unrecognized top-level box: ftyp
00:00:00 41 info Video codec: avc1.4d401e
00:00:00 44 info Audio codec: mp4a.40.2
00:00:00 45 error Failure parsing MP4: Detected unfragmented MP4. Media
Source
Extensions requires ISO BMFF moov to contain mvex to indicate that Movie
Fragments are to be expected.
00:00:00 45 error Append: stream parsing failed. Data size=131072
append_window_start=0 append_window_end=inf
00:00:00 45 pipeline_error pipeline: decode error
00:00:00 46 pipeline_state kStopping
00:00:00 46 pipeline_state kStopped
Description:
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.
Please review this at
https://codereview.chromium.org/1147453002/
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Affected files (+34, -14 lines):
M media/formats/mp4/box_definitions.h
M media/formats/mp4/box_definitions.cc
M media/formats/mp4/box_reader.h
M media/formats/mp4/box_reader.cc
M media/formats/mp4/rcheck.h
Index: media/formats/mp4/box_definitions.cc
diff --git a/media/formats/mp4/box_definitions.cc
b/media/formats/mp4/box_definitions.cc
index
a08cb26d560ca1b5e99ce066a269017af5d90a9e..93c1dd20266676ab2abdb7db5edd8e777cf34a74
100644
--- a/media/formats/mp4/box_definitions.cc
+++ b/media/formats/mp4/box_definitions.cc
@@ -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 "
+ "requires ISO BMFF moov to contain mvex to indicate
that "
+ "Movie Fragments are to be expected.");
+
+ return reader->MaybeReadChildren(&pssh);
}
TrackFragmentDecodeTime::TrackFragmentDecodeTime() : decode_time(0) {}
Index: media/formats/mp4/box_definitions.h
diff --git a/media/formats/mp4/box_definitions.h
b/media/formats/mp4/box_definitions.h
index
127140368985bfc83af94c556df7363a984dfce4..026effe6b5fbd3fe036e63426400c03f288802a5
100644
--- a/media/formats/mp4/box_definitions.h
+++ b/media/formats/mp4/box_definitions.h
@@ -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"
Index: media/formats/mp4/box_reader.cc
diff --git a/media/formats/mp4/box_reader.cc
b/media/formats/mp4/box_reader.cc
index
925859d20bda820f31caf76f7949d106cb432f33..978f17d68737a3d27a0cca0d703bc05e75ad4948
100644
--- a/media/formats/mp4/box_reader.cc
+++ b/media/formats/mp4/box_reader.cc
@@ -222,7 +222,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) {
Index: media/formats/mp4/box_reader.h
diff --git a/media/formats/mp4/box_reader.h b/media/formats/mp4/box_reader.h
index
3360204ed5424a05d0a552633dfc076e22e2f713..6b59361612459d84e29448c3b19b43595ab98cce
100644
--- a/media/formats/mp4/box_reader.h
+++ b/media/formats/mp4/box_reader.h
@@ -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;
};
Index: media/formats/mp4/rcheck.h
diff --git a/media/formats/mp4/rcheck.h b/media/formats/mp4/rcheck.h
index
fb0f8f27d4ec66f965f18609bcbaacd50186c7bf..c1ff7c36e0341dcc2521efd1c1f0f96ec44e1a18
100644
--- a/media/formats/mp4/rcheck.h
+++ b/media/formats/mp4/rcheck.h
@@ -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): Eliminate 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_