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

Unified Diff: media/filters/frame_processor_unittest.cc

Issue 1637213002: Revert of MSE: Relax the 'media segment must begin with keyframe' requirement (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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/filters/frame_processor.cc ('k') | media/filters/media_source_state.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/frame_processor_unittest.cc
diff --git a/media/filters/frame_processor_unittest.cc b/media/filters/frame_processor_unittest.cc
index 289ca8e8c89c7427923fac64ee8c0a23905134db..b7fc48d3240089fbc73a299199c86244ad245b2d 100644
--- a/media/filters/frame_processor_unittest.cc
+++ b/media/filters/frame_processor_unittest.cc
@@ -67,6 +67,7 @@
base::Unretained(&callbacks_)),
new MediaLog())),
append_window_end_(kInfiniteDuration()),
+ new_media_segment_(false),
audio_id_(FrameProcessor::kAudioTrackId),
video_id_(FrameProcessor::kVideoTrackId),
frame_duration_(base::TimeDelta::FromMilliseconds(10)) {}
@@ -156,8 +157,9 @@
ASSERT_TRUE(frame_processor_->ProcessFrames(
StringToBufferQueue(audio_timestamps, audio_id_, DemuxerStream::AUDIO),
StringToBufferQueue(video_timestamps, video_id_, DemuxerStream::VIDEO),
- empty_text_buffers_, append_window_start_, append_window_end_,
- &timestamp_offset_));
+ empty_text_buffers_,
+ append_window_start_, append_window_end_,
+ &new_media_segment_, &timestamp_offset_));
}
void CheckExpectedRangesByTimestamp(ChunkDemuxerStream* stream,
@@ -244,19 +246,13 @@
CheckReadStalls(stream);
}
- // TODO(wolenetz): Refactor to instead verify the expected signalling or lack
- // thereof of new coded frame group by the FrameProcessor. See
- // https://crbug.com/580613.
- bool in_coded_frame_group() {
- return frame_processor_->in_coded_frame_group_;
- }
-
base::MessageLoop message_loop_;
StrictMock<FrameProcessorTestCallbackHelper> callbacks_;
scoped_ptr<FrameProcessor> frame_processor_;
base::TimeDelta append_window_start_;
base::TimeDelta append_window_end_;
+ bool new_media_segment_;
base::TimeDelta timestamp_offset_;
scoped_ptr<ChunkDemuxerStream> audio_;
scoped_ptr<ChunkDemuxerStream> video_;
@@ -320,13 +316,15 @@
TEST_F(FrameProcessorTest, WrongTypeInAppendedBuffer) {
AddTestTracks(HAS_AUDIO);
- EXPECT_FALSE(in_coded_frame_group());
+ new_media_segment_ = true;
ASSERT_FALSE(frame_processor_->ProcessFrames(
- StringToBufferQueue("0K", audio_id_, DemuxerStream::VIDEO), empty_queue_,
- empty_text_buffers_, append_window_start_, append_window_end_,
- &timestamp_offset_));
- EXPECT_FALSE(in_coded_frame_group());
+ StringToBufferQueue("0K", audio_id_, DemuxerStream::VIDEO),
+ empty_queue_,
+ empty_text_buffers_,
+ append_window_start_, append_window_end_,
+ &new_media_segment_, &timestamp_offset_));
+ EXPECT_TRUE(new_media_segment_);
EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
CheckExpectedRangesByTimestamp(audio_.get(), "{ }");
CheckReadStalls(audio_.get());
@@ -334,12 +332,15 @@
TEST_F(FrameProcessorTest, NonMonotonicallyIncreasingTimestampInOneCall) {
AddTestTracks(HAS_AUDIO);
+ new_media_segment_ = true;
ASSERT_FALSE(frame_processor_->ProcessFrames(
StringToBufferQueue("10K 0K", audio_id_, DemuxerStream::AUDIO),
- empty_queue_, empty_text_buffers_, append_window_start_,
- append_window_end_, &timestamp_offset_));
- EXPECT_FALSE(in_coded_frame_group());
+ empty_queue_,
+ empty_text_buffers_,
+ append_window_start_, append_window_end_,
+ &new_media_segment_, &timestamp_offset_));
+ EXPECT_TRUE(new_media_segment_);
EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
CheckExpectedRangesByTimestamp(audio_.get(), "{ }");
CheckReadStalls(audio_.get());
@@ -349,12 +350,13 @@
// Tests A: P(A) -> (a)
InSequence s;
AddTestTracks(HAS_AUDIO);
+ new_media_segment_ = true;
if (GetParam())
frame_processor_->SetSequenceMode(true);
EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_));
ProcessFrames("0K", "");
- EXPECT_TRUE(in_coded_frame_group());
+ EXPECT_FALSE(new_media_segment_);
EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,10) }");
CheckReadsThenReadStalls(audio_.get(), "0");
@@ -364,12 +366,13 @@
// Tests V: P(V) -> (v)
InSequence s;
AddTestTracks(HAS_VIDEO);
+ new_media_segment_ = true;
if (GetParam())
frame_processor_->SetSequenceMode(true);
EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_));
ProcessFrames("", "0K");
- EXPECT_TRUE(in_coded_frame_group());
+ EXPECT_FALSE(new_media_segment_);
EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
CheckExpectedRangesByTimestamp(video_.get(), "{ [0,10) }");
CheckReadsThenReadStalls(video_.get(), "0");
@@ -379,12 +382,13 @@
// Tests A: P(A0, A10) -> (a0, a10)
InSequence s;
AddTestTracks(HAS_AUDIO);
+ new_media_segment_ = true;
if (GetParam())
frame_processor_->SetSequenceMode(true);
EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 2));
ProcessFrames("0K 10K", "");
- EXPECT_TRUE(in_coded_frame_group());
+ EXPECT_FALSE(new_media_segment_);
EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,20) }");
CheckReadsThenReadStalls(audio_.get(), "0 10");
@@ -394,6 +398,7 @@
// Tests A: STSO(50)+P(A0) -> TSO==50,(a0@50)
InSequence s;
AddTestTracks(HAS_AUDIO);
+ new_media_segment_ = true;
if (GetParam())
frame_processor_->SetSequenceMode(true);
@@ -401,7 +406,7 @@
SetTimestampOffset(fifty_ms);
EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ + fifty_ms));
ProcessFrames("0K", "");
- EXPECT_TRUE(in_coded_frame_group());
+ EXPECT_FALSE(new_media_segment_);
EXPECT_EQ(fifty_ms, timestamp_offset_);
CheckExpectedRangesByTimestamp(audio_.get(), "{ [50,60) }");
@@ -416,6 +421,7 @@
// if segments mode: TSO==50,(a20@70)
InSequence s;
AddTestTracks(HAS_AUDIO);
+ new_media_segment_ = true;
bool using_sequence_mode = GetParam();
if (using_sequence_mode)
frame_processor_->SetSequenceMode(true);
@@ -433,7 +439,7 @@
}
ProcessFrames("20K", "");
- EXPECT_TRUE(in_coded_frame_group());
+ EXPECT_FALSE(new_media_segment_);
// We do not stall on reading without seeking to 50ms / 70ms due to
// SourceBufferStream::kSeekToStartFudgeRoom().
@@ -452,18 +458,19 @@
// Tests A: P(A0,A10)+P(A20,A30) -> (a0,a10,a20,a30)
InSequence s;
AddTestTracks(HAS_AUDIO);
+ new_media_segment_ = true;
if (GetParam())
frame_processor_->SetSequenceMode(true);
EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 2));
ProcessFrames("0K 10K", "");
- EXPECT_TRUE(in_coded_frame_group());
+ EXPECT_FALSE(new_media_segment_);
EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,20) }");
EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 4));
ProcessFrames("20K 30K", "");
- EXPECT_TRUE(in_coded_frame_group());
+ EXPECT_FALSE(new_media_segment_);
EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,40) }");
@@ -477,6 +484,7 @@
// if segments mode: TSO==0,(a0,a10,a20,a30)
InSequence s;
AddTestTracks(HAS_AUDIO);
+ new_media_segment_ = true;
bool using_sequence_mode = GetParam();
if (using_sequence_mode) {
frame_processor_->SetSequenceMode(true);
@@ -486,7 +494,7 @@
}
ProcessFrames("20K 30K", "");
- EXPECT_TRUE(in_coded_frame_group());
+ EXPECT_FALSE(new_media_segment_);
if (using_sequence_mode) {
CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,20) }");
@@ -499,7 +507,7 @@
}
ProcessFrames("0K 10K", "");
- EXPECT_TRUE(in_coded_frame_group());
+ EXPECT_FALSE(new_media_segment_);
if (using_sequence_mode) {
CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,40) }");
@@ -523,19 +531,20 @@
// (a0,a10,a20,a30,a40);(v0,v10,v20,v30)
InSequence s;
AddTestTracks(HAS_AUDIO | HAS_VIDEO);
+ new_media_segment_ = true;
if (GetParam())
frame_processor_->SetSequenceMode(true);
EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 3));
ProcessFrames("0K 10K", "0K 10 20");
- EXPECT_TRUE(in_coded_frame_group());
+ EXPECT_FALSE(new_media_segment_);
EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,20) }");
CheckExpectedRangesByTimestamp(video_.get(), "{ [0,30) }");
EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_ * 5));
ProcessFrames("20K 30K 40K", "30");
- EXPECT_TRUE(in_coded_frame_group());
+ EXPECT_FALSE(new_media_segment_);
EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,50) }");
CheckExpectedRangesByTimestamp(video_.get(), "{ [0,40) }");
@@ -552,6 +561,7 @@
// MergeBufferQueues() behavior.
InSequence s;
AddTestTracks(HAS_AUDIO | HAS_VIDEO);
+ new_media_segment_ = true;
bool using_sequence_mode = GetParam();
if (using_sequence_mode) {
frame_processor_->SetSequenceMode(true);
@@ -561,7 +571,7 @@
}
ProcessFrames("0K 10K 30K 40K 50K", "0K 10 40 50K");
- EXPECT_TRUE(in_coded_frame_group());
+ EXPECT_FALSE(new_media_segment_);
if (using_sequence_mode) {
EXPECT_EQ(frame_duration_, timestamp_offset_);
@@ -586,13 +596,14 @@
AppendWindowFilterOfNegativeBufferTimestampsWithPrerollDiscard) {
InSequence s;
AddTestTracks(HAS_AUDIO);
+ new_media_segment_ = true;
if (GetParam())
frame_processor_->SetSequenceMode(true);
SetTimestampOffset(frame_duration_ * -2);
EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_));
ProcessFrames("0K 10K 20K", "");
- EXPECT_TRUE(in_coded_frame_group());
+ EXPECT_FALSE(new_media_segment_);
EXPECT_EQ(frame_duration_ * -2, timestamp_offset_);
CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,10) }");
CheckReadsThenReadStalls(audio_.get(), "0:10P 0:20");
@@ -601,6 +612,7 @@
TEST_P(FrameProcessorTest, AppendWindowFilterWithInexactPreroll) {
InSequence s;
AddTestTracks(HAS_AUDIO);
+ new_media_segment_ = true;
if (GetParam())
frame_processor_->SetSequenceMode(true);
SetTimestampOffset(-frame_duration_);
@@ -613,6 +625,7 @@
TEST_P(FrameProcessorTest, AppendWindowFilterWithInexactPreroll_2) {
InSequence s;
AddTestTracks(HAS_AUDIO);
+ new_media_segment_ = true;
if (GetParam())
frame_processor_->SetSequenceMode(true);
SetTimestampOffset(-frame_duration_);
@@ -625,6 +638,7 @@
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);
@@ -652,6 +666,7 @@
// trimmed frame.
InSequence s;
AddTestTracks(HAS_AUDIO);
+ new_media_segment_ = true;
if (GetParam())
frame_processor_->SetSequenceMode(true);
EXPECT_CALL(callbacks_,
@@ -671,6 +686,7 @@
// frame that originally had DTS > PTS.
InSequence s;
AddTestTracks(HAS_AUDIO);
+ new_media_segment_ = true;
bool using_sequence_mode = GetParam();
if (using_sequence_mode) {
frame_processor_->SetSequenceMode(true);
@@ -709,6 +725,7 @@
// discontinuity.
InSequence s;
AddTestTracks(HAS_AUDIO | HAS_VIDEO);
+ new_media_segment_ = true;
frame_processor_->SetSequenceMode(GetParam());
EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_));
ProcessFrames("", "0K");
@@ -718,7 +735,7 @@
ProcessFrames("", "10");
EXPECT_EQ(base::TimeDelta(), timestamp_offset_);
- EXPECT_TRUE(in_coded_frame_group());
+ EXPECT_FALSE(new_media_segment_);
CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,5) }");
CheckExpectedRangesByTimestamp(video_.get(), "{ [0,20) }");
CheckReadsThenReadStalls(audio_.get(), "0:-5");
@@ -728,6 +745,7 @@
TEST_F(FrameProcessorTest, AudioOnly_SequenceModeContinuityAcrossReset) {
InSequence s;
AddTestTracks(HAS_AUDIO);
+ new_media_segment_ = true;
frame_processor_->SetSequenceMode(true);
EXPECT_CALL(callbacks_, PossibleDurationIncrease(frame_duration_));
ProcessFrames("0K", "");
@@ -736,7 +754,7 @@
ProcessFrames("100K", "");
EXPECT_EQ(frame_duration_ * -9, timestamp_offset_);
- EXPECT_TRUE(in_coded_frame_group());
+ EXPECT_FALSE(new_media_segment_);
CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,20) }");
CheckReadsThenReadStalls(audio_.get(), "0 10:100");
}
« no previous file with comments | « media/filters/frame_processor.cc ('k') | media/filters/media_source_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698