diff options
author | wolenetz@chromium.org <wolenetz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-18 07:45:25 +0000 |
---|---|---|
committer | wolenetz@chromium.org <wolenetz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-18 07:45:25 +0000 |
commit | 04e3518822fbb323c4b92162af3e83f41d595fc9 (patch) | |
tree | 0597c468a5d65f36ad52e72bf1cd6c7bbc2804f7 /media/filters | |
parent | e7e0234539cd621fe87654dbdc65267edf9253c4 (diff) | |
download | chromium_src-04e3518822fbb323c4b92162af3e83f41d595fc9.zip chromium_src-04e3518822fbb323c4b92162af3e83f41d595fc9.tar.gz chromium_src-04e3518822fbb323c4b92162af3e83f41d595fc9.tar.bz2 |
MSE: Reduce spurious discontinuities caused by partial append window start overlaps
If a frame overlaps appendWindowStart, partial append window filtering
is supported for the track, and the frame is appended to the track
buffer, this change updates the track buffer's last frame duration with
the frame's original duration instead of the possibly trimmed duration.
If the trimmed duration were used, then the discontinuity detection
logic could detect a discontinuity on the next frame for the track where
there would otherwise not be a discontinuity.
BUG=381114
R=acolwell@chromium.org
TEST=FrameProcessorTest.PartialAppendWindowFilterNoDiscontinuity
Review URL: https://codereview.chromium.org/344513002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277976 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/filters')
-rw-r--r-- | media/filters/frame_processor.cc | 8 | ||||
-rw-r--r-- | media/filters/frame_processor_unittest.cc | 19 |
2 files changed, 24 insertions, 3 deletions
diff --git a/media/filters/frame_processor.cc b/media/filters/frame_processor.cc index 3071439..68f4c61 100644 --- a/media/filters/frame_processor.cc +++ b/media/filters/frame_processor.cc @@ -261,13 +261,15 @@ bool FrameProcessor::ProcessFrame( if (frame->timestamp() != presentation_timestamp && !sequence_mode_) *new_media_segment = true; - // |frame| has been partially trimmed or had preroll added. + // |frame| has been partially trimmed or had preroll added. Though + // |frame|'s duration may have changed, do not update |frame_duration| + // here, so |track_buffer|'s last frame duration update uses original + // frame duration and reduces spurious discontinuity detection. decode_timestamp = frame->GetDecodeTimestamp(); presentation_timestamp = frame->timestamp(); - frame_duration = frame->duration(); // The end timestamp of the frame should be unchanged. - DCHECK(frame_end_timestamp == presentation_timestamp + frame_duration); + DCHECK(frame_end_timestamp == presentation_timestamp + frame->duration()); } if (presentation_timestamp < append_window_start || diff --git a/media/filters/frame_processor_unittest.cc b/media/filters/frame_processor_unittest.cc index b6f5d2f..f4cde5a 100644 --- a/media/filters/frame_processor_unittest.cc +++ b/media/filters/frame_processor_unittest.cc @@ -633,6 +633,25 @@ TEST_P(FrameProcessorTest, AllowNegativeFramePTSAndDTSBeforeOffsetAdjustment) { } } +TEST_P(FrameProcessorTest, PartialAppendWindowFilterNoDiscontinuity) { + // Tests that spurious discontinuity is not introduced by a partially + // trimmed frame. + InSequence s; + AddTestTracks(HAS_AUDIO); + new_media_segment_ = true; + if (GetParam()) + frame_processor_->SetSequenceMode(true); + EXPECT_CALL(callbacks_, + PossibleDurationIncrease(base::TimeDelta::FromMilliseconds(29))); + + append_window_start_ = base::TimeDelta::FromMilliseconds(7); + ProcessFrames("0K 19K", ""); + + EXPECT_EQ(base::TimeDelta(), timestamp_offset_); + CheckExpectedRangesByTimestamp(audio_.get(), "{ [7,29) }"); + CheckReadsThenReadStalls(audio_.get(), "7:0 19"); +} + INSTANTIATE_TEST_CASE_P(SequenceMode, FrameProcessorTest, Values(true)); INSTANTIATE_TEST_CASE_P(SegmentsMode, FrameProcessorTest, Values(false)); |