Commit 818bcf44 authored by wolenetz@chromium.org's avatar wolenetz@chromium.org

MSE: Allow negative parsed frame PTS/DTS in FrameProcessor

r274473 did not remove sanity checks for negative PTS/DTS that occur
prior to any adjustment based on timestampOffset. Current MSE spec does
not call for issuing decode error if PTS or DTS are negative at the top
of the coded frame processing loop. This change removes the sanity
checks that are not spec-compliant.

R=acolwell@chromium.org
BUG=381114
TEST=FrameProcessorTest.AllowNegativeFramePTSAndDTSBeforeOffsetAdjustment

Review URL: https://codereview.chromium.org/334363006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277903 0039d316-1c4b-4281-b951-d872f2087c98
parent 1e015df3
...@@ -107,14 +107,12 @@ bool FrameProcessor::ProcessFrame( ...@@ -107,14 +107,12 @@ bool FrameProcessor::ProcessFrame(
<< ", DUR=" << frame_duration.InSecondsF(); << ", DUR=" << frame_duration.InSecondsF();
// Sanity check the timestamps. // Sanity check the timestamps.
if (presentation_timestamp < base::TimeDelta()) { if (presentation_timestamp == kNoTimestamp()) {
DVLOG(2) << __FUNCTION__ << ": Negative or unknown frame PTS: " DVLOG(2) << __FUNCTION__ << ": Unknown frame PTS";
<< presentation_timestamp.InSecondsF();
return false; return false;
} }
if (decode_timestamp < base::TimeDelta()) { if (decode_timestamp == kNoTimestamp()) {
DVLOG(2) << __FUNCTION__ << ": Negative or unknown frame DTS: " DVLOG(2) << __FUNCTION__ << ": Unknown frame DTS";
<< decode_timestamp.InSecondsF();
return false; return false;
} }
if (decode_timestamp > presentation_timestamp) { if (decode_timestamp > presentation_timestamp) {
......
...@@ -607,6 +607,32 @@ TEST_P(FrameProcessorTest, AppendWindowFilterWithInexactPreroll) { ...@@ -607,6 +607,32 @@ TEST_P(FrameProcessorTest, AppendWindowFilterWithInexactPreroll) {
CheckReadsThenReadStalls(audio_.get(), "0P 0:9.75 10:20"); CheckReadsThenReadStalls(audio_.get(), "0P 0:9.75 10:20");
} }
TEST_P(FrameProcessorTest, AllowNegativeFramePTSAndDTSBeforeOffsetAdjustment) {
InSequence s;
AddTestTracks(HAS_AUDIO);
new_media_segment_ = true;
bool using_sequence_mode = GetParam();
if (using_sequence_mode) {
frame_processor_->SetSequenceMode(true);
EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 3));
} else {
EXPECT_CALL(callbacks_,
PossibleDurationIncrease((frame_duration_ * 5) / 2));
}
ProcessFrames("-5K 5K 15K", "");
if (using_sequence_mode) {
EXPECT_EQ(frame_duration_ / 2, timestamp_offset_);
CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,30) }");
CheckReadsThenReadStalls(audio_.get(), "0:-5 10:5 20:15");
} else {
EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,25) }");
CheckReadsThenReadStalls(audio_.get(), "0:-5 5 15");
}
}
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