Chromium Code Reviews| Index: media/base/audio_splicer_unittest.cc |
| diff --git a/media/base/audio_splicer_unittest.cc b/media/base/audio_splicer_unittest.cc |
| index 2e46b9fb12753ecaef1b55fdb8bef1534fc829ac..89e5aa3bb0392266d68668480d6e8c270dc8fbfd 100644 |
| --- a/media/base/audio_splicer_unittest.cc |
| +++ b/media/base/audio_splicer_unittest.cc |
| @@ -682,4 +682,42 @@ TEST_F(AudioSplicerTest, IncorrectlyMarkedSpliceWithGap) { |
| EXPECT_FALSE(splicer_.HasNextBuffer()); |
| } |
| +// Test behavior when a splice frame is incorrectly marked and there is a gap |
| +// between whats in the pre splice and post splice that is too large to recover |
|
acolwell GONE FROM CHROMIUM
2014/06/25 16:27:55
nit: s/whats/what's/
DaleCurtis
2014/06/25 18:30:10
Done.
|
| +// from. |
| +// +--------+ |
| +// |11111111| |
| +// +--------+ |
| +// +------+ |
| +// |222222| |
| +// +------+ |
| +// Results in an error and not a crash. |
| +TEST_F(AudioSplicerTest, IncorrectlyMarkedSpliceWithBadGap) { |
| + const int kBufferSize = |
| + input_timestamp_helper_.GetFramesToTarget(max_crossfade_duration()) * 2; |
| + const int kGapSize = kBufferSize + |
| + input_timestamp_helper_.GetFramesToTarget( |
| + base::TimeDelta::FromMilliseconds( |
| + AudioSplicer::kMaxTimeDeltaInMilliseconds + 1)); |
| + |
| + scoped_refptr<AudioBuffer> first_buffer = |
| + GetNextInputBuffer(1.0f, kBufferSize); |
| + scoped_refptr<AudioBuffer> gap_buffer = |
| + GetNextInputBuffer(0.0f, kGapSize); |
| + splicer_.SetSpliceTimestamp(input_timestamp_helper_.GetTimestamp()); |
| + scoped_refptr<AudioBuffer> second_buffer = |
| + GetNextInputBuffer(0.0f, kBufferSize); |
| + |
| + // The splicer should pass through the first buffer since it's not part of the |
| + // splice. |
| + EXPECT_TRUE(AddInput(first_buffer)); |
| + VerifyNextBuffer(first_buffer); |
| + |
| + // Do not add |gap_buffer|. |
| + |
| + // |second_buffer| will complete the supposed splice. |
| + splicer_.SetSpliceTimestamp(kNoTimestamp()); |
| + EXPECT_FALSE(AddInput(second_buffer)); |
| +} |
| + |
| } // namespace media |