summaryrefslogtreecommitdiffstats
path: root/media/mp4
diff options
context:
space:
mode:
authorstrobe@google.com <strobe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-28 16:28:34 +0000
committerstrobe@google.com <strobe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-28 16:28:34 +0000
commit14f5ad85471a9bf1606c0d264f52ffb8a5e161f1 (patch)
tree96da1f5dded7527dd3cbc7e7a3acc010c5bb6b9a /media/mp4
parent25d9f43a159c195e39f70cb8d7c4ce1da74766f5 (diff)
downloadchromium_src-14f5ad85471a9bf1606c0d264f52ffb8a5e161f1.zip
chromium_src-14f5ad85471a9bf1606c0d264f52ffb8a5e161f1.tar.gz
chromium_src-14f5ad85471a9bf1606c0d264f52ffb8a5e161f1.tar.bz2
The ISO BMFF Media Source parser supplied decode timestamps instead of presentation timestamps, resulting in incorrect playback. This patch makes the source buffer explicitly reference only decode timestamps as an intermediate step toward making it aware of buffer reordering.
Additionally, FFmpegVideoDecoder will attempt to recover a framerate from the first sample duration it sees if the decoder config has a framerate of zero. BUG=134262 TEST=SourceBufferStreamTest, manual playback tests Review URL: https://chromiumcodereview.appspot.com/10669005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144724 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/mp4')
-rw-r--r--media/mp4/box_definitions.cc2
-rw-r--r--media/mp4/box_definitions.h2
-rw-r--r--media/mp4/mp4_stream_parser.cc12
-rw-r--r--media/mp4/track_run_iterator.cc2
-rw-r--r--media/mp4/track_run_iterator.h2
5 files changed, 10 insertions, 10 deletions
diff --git a/media/mp4/box_definitions.cc b/media/mp4/box_definitions.cc
index c4e14e9..ff86372 100644
--- a/media/mp4/box_definitions.cc
+++ b/media/mp4/box_definitions.cc
@@ -660,7 +660,7 @@ bool TrackFragmentRun::Parse(BoxReader* reader) {
if (sample_flags_present)
RCHECK(reader->Read4(&sample_flags[i]));
if (sample_composition_time_offsets_present)
- RCHECK(reader->Read4(&sample_composition_time_offsets[i]));
+ RCHECK(reader->Read4s(&sample_composition_time_offsets[i]));
}
if (first_sample_flags_present) {
diff --git a/media/mp4/box_definitions.h b/media/mp4/box_definitions.h
index 53e6b67..52a0e86 100644
--- a/media/mp4/box_definitions.h
+++ b/media/mp4/box_definitions.h
@@ -309,7 +309,7 @@ struct TrackFragmentRun : Box {
std::vector<uint32> sample_flags;
std::vector<uint32> sample_sizes;
std::vector<uint32> sample_durations;
- std::vector<uint32> sample_composition_time_offsets;
+ std::vector<int32> sample_composition_time_offsets;
};
struct TrackFragment : Box {
diff --git a/media/mp4/mp4_stream_parser.cc b/media/mp4/mp4_stream_parser.cc
index 4996905..bb2a95c 100644
--- a/media/mp4/mp4_stream_parser.cc
+++ b/media/mp4/mp4_stream_parser.cc
@@ -181,9 +181,9 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) {
video_config.Initialize(kCodecH264, H264PROFILE_MAIN, VideoFrame::YV12,
gfx::Size(entry.width, entry.height),
gfx::Rect(0, 0, entry.width, entry.height),
- // Bogus duration used for framerate, since real
- // framerate may be variable
- 1000, track->media.header.timescale,
+ // Framerate of zero is provided to signal that
+ // the decoder should trust demuxer timestamps
+ 0, 1,
entry.pixel_aspect.h_spacing,
entry.pixel_aspect.v_spacing,
// No decoder-specific buffer needed for AVC;
@@ -296,14 +296,14 @@ bool MP4StreamParser::EnqueueSample(BufferQueue* audio_buffers,
runs_.is_keyframe());
stream_buf->SetDuration(runs_.duration());
- // We depend on the decoder performing frame reordering without reordering
- // timestamps, and only provide the decode timestamp in the buffer.
- stream_buf->SetTimestamp(runs_.dts());
+ stream_buf->SetTimestamp(runs_.cts());
+ stream_buf->SetDecodeTimestamp(runs_.dts());
DVLOG(3) << "Pushing frame: aud=" << audio
<< ", key=" << runs_.is_keyframe()
<< ", dur=" << runs_.duration().InMilliseconds()
<< ", dts=" << runs_.dts().InMilliseconds()
+ << ", cts=" << runs_.cts().InMilliseconds()
<< ", size=" << runs_.size();
if (audio) {
diff --git a/media/mp4/track_run_iterator.cc b/media/mp4/track_run_iterator.cc
index 73bb435..74bef99 100644
--- a/media/mp4/track_run_iterator.cc
+++ b/media/mp4/track_run_iterator.cc
@@ -12,7 +12,7 @@
namespace media {
namespace mp4 {
-base::TimeDelta TimeDeltaFromFrac(int64 numer, uint64 denom) {
+base::TimeDelta TimeDeltaFromFrac(int64 numer, int64 denom) {
DCHECK_LT((numer > 0 ? numer : -numer),
kint64max / base::Time::kMicrosecondsPerSecond);
return base::TimeDelta::FromMicroseconds(
diff --git a/media/mp4/track_run_iterator.h b/media/mp4/track_run_iterator.h
index c1f61c3..9e9b6a1 100644
--- a/media/mp4/track_run_iterator.h
+++ b/media/mp4/track_run_iterator.h
@@ -16,7 +16,7 @@ namespace mp4 {
using base::TimeDelta;
-base::TimeDelta TimeDeltaFromFrac(int64 numer, uint64 denom);
+base::TimeDelta TimeDeltaFromFrac(int64 numer, int64 denom);
struct SampleInfo {
int size;