Commit 04e35188 authored by wolenetz@chromium.org's avatar wolenetz@chromium.org

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
parent e7e02345
...@@ -261,13 +261,15 @@ bool FrameProcessor::ProcessFrame( ...@@ -261,13 +261,15 @@ bool FrameProcessor::ProcessFrame(
if (frame->timestamp() != presentation_timestamp && !sequence_mode_) if (frame->timestamp() != presentation_timestamp && !sequence_mode_)
*new_media_segment = true; *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(); decode_timestamp = frame->GetDecodeTimestamp();
presentation_timestamp = frame->timestamp(); presentation_timestamp = frame->timestamp();
frame_duration = frame->duration();
// The end timestamp of the frame should be unchanged. // 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 || if (presentation_timestamp < append_window_start ||
......
...@@ -633,6 +633,25 @@ TEST_P(FrameProcessorTest, AllowNegativeFramePTSAndDTSBeforeOffsetAdjustment) { ...@@ -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(SequenceMode, FrameProcessorTest, Values(true));
INSTANTIATE_TEST_CASE_P(SegmentsMode, FrameProcessorTest, Values(false)); INSTANTIATE_TEST_CASE_P(SegmentsMode, FrameProcessorTest, Values(false));
......
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