Index: media/base/audio_splicer_unittest.cc |
diff --git a/media/base/audio_splicer_unittest.cc b/media/base/audio_splicer_unittest.cc |
index 2f74a50fc9995e844deb1de94aeb03db3029bf5a..13c33071d6b65ab7dff9352ada5fc4f76837a397 100644 |
--- a/media/base/audio_splicer_unittest.cc |
+++ b/media/base/audio_splicer_unittest.cc |
@@ -432,10 +432,10 @@ TEST_F(AudioSplicerTest, PartialOverlapCrossfade) { |
EXPECT_TRUE(AddInput(overlapped_buffer)); |
EXPECT_FALSE(splicer_.HasNextBuffer()); |
- // Even though |overlapping_buffer| completes the splice, one extra buffer is |
- // required to confirm it's actually a splice. |
+ // |overlapping_buffer| completes the splice. |
+ splicer_.SetSpliceTimestamp(kNoTimestamp()); |
EXPECT_TRUE(AddInput(overlapping_buffer)); |
- EXPECT_FALSE(splicer_.HasNextBuffer()); |
+ EXPECT_TRUE(splicer_.HasNextBuffer()); |
// Add one more buffer to make sure it's passed through untouched. |
scoped_refptr<AudioBuffer> extra_post_splice_buffer = |
@@ -509,6 +509,7 @@ TEST_F(AudioSplicerTest, PartialOverlapCrossfadeEndOfStream) { |
// |overlapping_buffer| should not have enough data to complete the splice, so |
// ensure output is not available. |
+ splicer_.SetSpliceTimestamp(kNoTimestamp()); |
EXPECT_TRUE(AddInput(overlapping_buffer)); |
EXPECT_FALSE(splicer_.HasNextBuffer()); |
@@ -568,14 +569,10 @@ TEST_F(AudioSplicerTest, PartialOverlapCrossfadeShortPreSplice) { |
EXPECT_TRUE(AddInput(overlapped_buffer)); |
EXPECT_FALSE(splicer_.HasNextBuffer()); |
- // Even though |overlapping_buffer| completes the splice, one extra buffer is |
- // required to confirm it's actually a splice. |
+ // |overlapping_buffer| completes the splice. |
+ splicer_.SetSpliceTimestamp(kNoTimestamp()); |
EXPECT_TRUE(AddInput(overlapping_buffer)); |
- EXPECT_FALSE(splicer_.HasNextBuffer()); |
- |
- // Add an EOS buffer to complete the splice. |
- EXPECT_TRUE(AddInput(AudioBuffer::CreateEOSBuffer())); |
- ASSERT_TRUE(splicer_.HasNextBuffer()); |
+ EXPECT_TRUE(splicer_.HasNextBuffer()); |
const int kExpectedPreSpliceSize = 55; |
const base::TimeDelta kExpectedPreSpliceDuration = |
@@ -602,10 +599,6 @@ TEST_F(AudioSplicerTest, PartialOverlapCrossfadeShortPreSplice) { |
post_splice_output->duration()); |
EXPECT_TRUE(VerifyData(post_splice_output, GetValue(overlapping_buffer))); |
- |
- post_splice_output = splicer_.GetNextBuffer(); |
- EXPECT_TRUE(post_splice_output->end_of_stream()); |
- |
EXPECT_FALSE(splicer_.HasNextBuffer()); |
} |
@@ -642,6 +635,7 @@ TEST_F(AudioSplicerTest, IncorrectlyMarkedSplice) { |
// |second_buffer| should complete the supposed splice, so ensure output is |
// now available. |
+ splicer_.SetSpliceTimestamp(kNoTimestamp()); |
EXPECT_TRUE(AddInput(second_buffer)); |
ASSERT_TRUE(splicer_.HasNextBuffer()); |
@@ -683,95 +677,13 @@ TEST_F(AudioSplicerTest, IncorrectlyMarkedSpliceWithGap) { |
// Do not add |gap_buffer|. |
- // |second_buffer| will trigger an exact overlap splice check. |
+ // |second_buffer| will complete the supposed splice. |
+ splicer_.SetSpliceTimestamp(kNoTimestamp()); |
EXPECT_TRUE(AddInput(second_buffer)); |
- EXPECT_FALSE(splicer_.HasNextBuffer()); |
- |
- // When the next buffer is not an exact overlap, the bad splice detection code |
- // will kick in and release the buffers. |
- EXPECT_TRUE(AddInput(AudioBuffer::CreateEOSBuffer())); |
- ASSERT_TRUE(splicer_.HasNextBuffer()); |
+ EXPECT_TRUE(splicer_.HasNextBuffer()); |
VerifyNextBuffer(gap_buffer); |
VerifyNextBuffer(second_buffer); |
- scoped_refptr<AudioBuffer> eos_buffer = splicer_.GetNextBuffer(); |
- EXPECT_TRUE(eos_buffer->end_of_stream()); |
- EXPECT_FALSE(splicer_.HasNextBuffer()); |
-} |
- |
-// Test behavior when a splice frame gets fuzzed such that there is a pre splice |
-// buffer after the first which has a timestamp equal to the splice timestamp. |
-// +-----------+ |
-// |11111111111| |
-// +-----------+ |
-// +-------+ |
-// |2222222| |
-// +-------+ |
-// +--------------+ |
-// |33333333333333| |
-// +--------------+ |
-// Results in: |
-// +---------+--------------+ |
-// |111111111|xyyyyyy3333333| |
-// +---------+--------------+ |
-// Where x represents a crossfade between buffers 1 and 3; while y is a |
-// crossfade between buffers 2 and 3. |
-TEST_F(AudioSplicerTest, SpliceIncorrectlySlotted) { |
wolenetz
2014/04/17 18:24:03
I'm confused I think. Why is this test no longer a
DaleCurtis
2014/04/17 20:03:18
It was necessary because we relied on the checking
|
- const int kBufferSize = |
- input_timestamp_helper_.GetFramesToTarget(max_crossfade_duration()); |
- const int kOverlapSize = 2; |
- |
- scoped_refptr<AudioBuffer> buffer_1 = |
- GetNextInputBuffer(1.0f, kBufferSize + kOverlapSize); |
- input_timestamp_helper_.SetBaseTimestamp(buffer_1->timestamp()); |
- input_timestamp_helper_.AddFrames(kBufferSize); |
- |
- const base::TimeDelta splice_timestamp = |
- input_timestamp_helper_.GetTimestamp(); |
- splicer_.SetSpliceTimestamp(splice_timestamp); |
- |
- scoped_refptr<AudioBuffer> buffer_2 = GetNextInputBuffer(0.5f, kBufferSize); |
- |
- // Create an overlap buffer which is just short of the crossfade size. |
- input_timestamp_helper_.SetBaseTimestamp(splice_timestamp); |
- scoped_refptr<AudioBuffer> buffer_3 = |
- GetNextInputBuffer(0.0f, kBufferSize - kOverlapSize); |
- |
- // The splicer should be internally queuing input since |buffer_1| is part of |
- // the supposed splice. |
- EXPECT_TRUE(AddInput(buffer_1)); |
- EXPECT_FALSE(splicer_.HasNextBuffer()); |
- |
- // Adding |buffer_2| should look like a completion of the splice, but still no |
- // buffer should be handed out. |
- EXPECT_TRUE(AddInput(buffer_2)); |
- EXPECT_FALSE(splicer_.HasNextBuffer()); |
- |
- // Adding |buffer_3| should complete the splice correctly, but there is still |
- // not enough data for crossfade, so it shouldn't return yet. |
- EXPECT_TRUE(AddInput(buffer_3)); |
- EXPECT_FALSE(splicer_.HasNextBuffer()); |
- |
- // Add an EOS buffer which should trigger completion of the splice. |
- EXPECT_TRUE(AddInput(AudioBuffer::CreateEOSBuffer())); |
- ASSERT_TRUE(splicer_.HasNextBuffer()); |
- |
- const int kExpectedPreSpliceSize = kBufferSize; |
- const base::TimeDelta kExpectedPreSpliceDuration = splice_timestamp; |
- const base::TimeDelta kExpectedCrossfadeDuration = |
- base::TimeDelta::FromMicroseconds(4966); |
- VerifyPreSpliceOutput( |
- buffer_1, buffer_3, kExpectedPreSpliceSize, kExpectedPreSpliceDuration); |
- VerifyCrossfadeOutput(buffer_1, |
- buffer_2, |
- buffer_3, |
- kOverlapSize, |
- buffer_3->frame_count(), |
- kExpectedCrossfadeDuration); |
- |
- scoped_refptr<AudioBuffer> eos_buffer = splicer_.GetNextBuffer(); |
- EXPECT_TRUE(eos_buffer->end_of_stream()); |
- |
EXPECT_FALSE(splicer_.HasNextBuffer()); |
} |