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

Unified Diff: media/formats/mp4/mp4_stream_parser.cc

Issue 2368773002: MSE: Recognize "unknown duration" in ISOBMFF mvhd version 0, duration max uint32 case (Closed)
Patch Set: Address review comments Created 4 years, 3 months 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/formats/mp4/box_definitions.cc ('k') | media/formats/mp4/mp4_stream_parser_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/formats/mp4/mp4_stream_parser.cc
diff --git a/media/formats/mp4/mp4_stream_parser.cc b/media/formats/mp4/mp4_stream_parser.cc
index 60a8e7eb04dd493aa3ca35f578bc5817fdadad35..2d76816cc1355ea1ff8ff982580ed46374bedc3b 100644
--- a/media/formats/mp4/mp4_stream_parser.cc
+++ b/media/formats/mp4/mp4_stream_parser.cc
@@ -421,7 +421,17 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) {
moov_->extends.header.fragment_duration, moov_->header.timescale);
params.liveness = DemuxerStream::LIVENESS_RECORDED;
} else if (moov_->header.duration > 0 &&
- moov_->header.duration != std::numeric_limits<uint64_t>::max()) {
+ ((moov_->header.version == 0 &&
+ moov_->header.duration !=
+ std::numeric_limits<uint32_t>::max()) ||
+ (moov_->header.version == 1 &&
+ moov_->header.duration !=
+ std::numeric_limits<uint64_t>::max()))) {
+ // In ISO/IEC 14496-12:2012, 8.2.2.3: "If the duration cannot be determined
+ // then duration is set to all 1s."
+ // The duration field is either 32-bit or 64-bit depending on the version in
+ // MovieHeaderBox. We interpret not 0 and not all 1's here as "known
+ // duration".
params.duration =
TimeDeltaFromRational(moov_->header.duration, moov_->header.timescale);
params.liveness = DemuxerStream::LIVENESS_RECORDED;
@@ -430,6 +440,10 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) {
// real-time, such as used in live streaming, it is not likely that the
// fragment_duration is known in advance and this (mehd) box may be
// omitted."
+
+ // We have an unknown duration (neither any mvex fragment_duration nor moov
+ // duration value indicated a known duration, above.)
+
// TODO(wolenetz): Investigate gating liveness detection on timeline_offset
// when it's populated. See http://crbug.com/312699
params.liveness = DemuxerStream::LIVENESS_LIVE;
« no previous file with comments | « media/formats/mp4/box_definitions.cc ('k') | media/formats/mp4/mp4_stream_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698