This source file includes following definitions.
- input_timestamp_helper_
- GetNextInputBuffer
- GetNextInputBuffer
- GetValue
- VerifyData
- VerifyNextBuffer
- VerifyPreSpliceOutput
- VerifyCrossfadeOutput
- AddInput
- max_crossfade_duration
- TEST_F
- TEST_F
- TEST_F
- TEST_F
- TEST_F
- TEST_F
- TEST_F
- TEST_F
- TEST_F
- TEST_F
- TEST_F
- TEST_F
- TEST_F
- TEST_F
#include "base/memory/scoped_ptr.h"
#include "media/base/audio_buffer.h"
#include "media/base/audio_bus.h"
#include "media/base/audio_splicer.h"
#include "media/base/audio_timestamp_helper.h"
#include "media/base/buffers.h"
#include "media/base/test_helpers.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace media {
static const SampleFormat kSampleFormat = kSampleFormatF32;
COMPILE_ASSERT(kSampleFormat == kSampleFormatF32, invalid_splice_format);
static const int kChannels = 1;
static const ChannelLayout kChannelLayout = CHANNEL_LAYOUT_MONO;
static const int kDefaultSampleRate = 44100;
static const int kDefaultBufferSize = 100;
class AudioSplicerTest : public ::testing::Test {
public:
AudioSplicerTest()
: splicer_(kDefaultSampleRate),
input_timestamp_helper_(kDefaultSampleRate) {
input_timestamp_helper_.SetBaseTimestamp(base::TimeDelta());
}
scoped_refptr<AudioBuffer> GetNextInputBuffer(float value) {
return GetNextInputBuffer(value, kDefaultBufferSize);
}
scoped_refptr<AudioBuffer> GetNextInputBuffer(float value, int frame_size) {
scoped_refptr<AudioBuffer> buffer = MakeAudioBuffer<float>(
kSampleFormat,
kChannelLayout,
kChannels,
kDefaultSampleRate,
value,
0.0f,
frame_size,
input_timestamp_helper_.GetTimestamp(),
input_timestamp_helper_.GetFrameDuration(frame_size));
input_timestamp_helper_.AddFrames(frame_size);
return buffer;
}
float GetValue(const scoped_refptr<AudioBuffer>& buffer) {
return reinterpret_cast<const float*>(buffer->channel_data()[0])[0];
}
bool VerifyData(const scoped_refptr<AudioBuffer>& buffer, float value) {
int frames = buffer->frame_count();
scoped_ptr<AudioBus> bus = AudioBus::Create(kChannels, frames);
buffer->ReadFrames(frames, 0, 0, bus.get());
for (int ch = 0; ch < buffer->channel_count(); ++ch) {
for (int i = 0; i < frames; ++i) {
if (bus->channel(ch)[i] != value)
return false;
}
}
return true;
}
void VerifyNextBuffer(const scoped_refptr<AudioBuffer>& input) {
ASSERT_TRUE(splicer_.HasNextBuffer());
scoped_refptr<AudioBuffer> output = splicer_.GetNextBuffer();
EXPECT_EQ(input->timestamp(), output->timestamp());
EXPECT_EQ(input->duration(), output->duration());
EXPECT_EQ(input->frame_count(), output->frame_count());
EXPECT_TRUE(VerifyData(output, GetValue(input)));
}
void VerifyPreSpliceOutput(
const scoped_refptr<AudioBuffer>& overlapped_buffer,
const scoped_refptr<AudioBuffer>& overlapping_buffer,
int expected_pre_splice_size,
base::TimeDelta expected_pre_splice_duration) {
ASSERT_TRUE(splicer_.HasNextBuffer());
scoped_refptr<AudioBuffer> pre_splice_output = splicer_.GetNextBuffer();
EXPECT_EQ(overlapped_buffer->timestamp(), pre_splice_output->timestamp());
EXPECT_EQ(expected_pre_splice_size, pre_splice_output->frame_count());
EXPECT_EQ(expected_pre_splice_duration, pre_splice_output->duration());
EXPECT_TRUE(VerifyData(pre_splice_output, GetValue(overlapped_buffer)));
}
void VerifyCrossfadeOutput(
const scoped_refptr<AudioBuffer>& overlapped_buffer_1,
const scoped_refptr<AudioBuffer>& overlapped_buffer_2,
const scoped_refptr<AudioBuffer>& overlapping_buffer,
int second_overlap_index,
int expected_crossfade_size,
base::TimeDelta expected_crossfade_duration) {
ASSERT_TRUE(splicer_.HasNextBuffer());
scoped_refptr<AudioBuffer> crossfade_output = splicer_.GetNextBuffer();
EXPECT_EQ(expected_crossfade_size, crossfade_output->frame_count());
EXPECT_EQ(expected_crossfade_duration, crossfade_output->duration());
EXPECT_NEAR(overlapping_buffer->timestamp().InMicroseconds(),
crossfade_output->timestamp().InMicroseconds(),
1);
const int frames = crossfade_output->frame_count();
float overlapped_value = GetValue(overlapped_buffer_1);
const float overlapping_value = GetValue(overlapping_buffer);
scoped_ptr<AudioBus> bus = AudioBus::Create(kChannels, frames);
crossfade_output->ReadFrames(frames, 0, 0, bus.get());
for (int ch = 0; ch < crossfade_output->channel_count(); ++ch) {
float cf_ratio = 0;
const float cf_increment = 1.0f / frames;
for (int i = 0; i < frames; ++i, cf_ratio += cf_increment) {
if (overlapped_buffer_2 && i >= second_overlap_index)
overlapped_value = GetValue(overlapped_buffer_2);
const float actual = bus->channel(ch)[i];
const float expected =
(1.0f - cf_ratio) * overlapped_value + cf_ratio * overlapping_value;
ASSERT_FLOAT_EQ(expected, actual) << "i=" << i;
}
}
}
bool AddInput(const scoped_refptr<AudioBuffer>& input) {
scoped_refptr<AudioBuffer> buffer_copy =
input->end_of_stream()
? AudioBuffer::CreateEOSBuffer()
: AudioBuffer::CopyFrom(kSampleFormat,
input->channel_layout(),
input->channel_count(),
input->sample_rate(),
input->frame_count(),
&input->channel_data()[0],
input->timestamp(),
input->duration());
return splicer_.AddInput(buffer_copy);
}
base::TimeDelta max_crossfade_duration() {
return splicer_.max_crossfade_duration_;
}
protected:
AudioSplicer splicer_;
AudioTimestampHelper input_timestamp_helper_;
DISALLOW_COPY_AND_ASSIGN(AudioSplicerTest);
};
TEST_F(AudioSplicerTest, PassThru) {
EXPECT_FALSE(splicer_.HasNextBuffer());
scoped_refptr<AudioBuffer> input_1 = GetNextInputBuffer(0.1f);
EXPECT_TRUE(AddInput(input_1));
VerifyNextBuffer(input_1);
EXPECT_FALSE(splicer_.HasNextBuffer());
scoped_refptr<AudioBuffer> input_2 = GetNextInputBuffer(0.2f);
scoped_refptr<AudioBuffer> input_3 = GetNextInputBuffer(0.3f);
EXPECT_TRUE(AddInput(input_2));
EXPECT_TRUE(AddInput(input_3));
VerifyNextBuffer(input_2);
VerifyNextBuffer(input_3);
EXPECT_FALSE(splicer_.HasNextBuffer());
}
TEST_F(AudioSplicerTest, Reset) {
scoped_refptr<AudioBuffer> input_1 = GetNextInputBuffer(0.1f);
EXPECT_TRUE(AddInput(input_1));
ASSERT_TRUE(splicer_.HasNextBuffer());
splicer_.Reset();
EXPECT_FALSE(splicer_.HasNextBuffer());
input_timestamp_helper_.AddFrames(100);
scoped_refptr<AudioBuffer> input_2 = GetNextInputBuffer(0.2f);
EXPECT_TRUE(AddInput(input_2));
ASSERT_TRUE(splicer_.HasNextBuffer());
VerifyNextBuffer(input_2);
EXPECT_FALSE(splicer_.HasNextBuffer());
}
TEST_F(AudioSplicerTest, EndOfStream) {
scoped_refptr<AudioBuffer> input_1 = GetNextInputBuffer(0.1f);
scoped_refptr<AudioBuffer> input_2 = AudioBuffer::CreateEOSBuffer();
scoped_refptr<AudioBuffer> input_3 = GetNextInputBuffer(0.2f);
EXPECT_TRUE(input_2->end_of_stream());
EXPECT_TRUE(AddInput(input_1));
EXPECT_TRUE(AddInput(input_2));
VerifyNextBuffer(input_1);
scoped_refptr<AudioBuffer> output_2 = splicer_.GetNextBuffer();
EXPECT_FALSE(splicer_.HasNextBuffer());
EXPECT_TRUE(output_2->end_of_stream());
splicer_.Reset();
EXPECT_TRUE(AddInput(input_3));
VerifyNextBuffer(input_3);
EXPECT_FALSE(splicer_.HasNextBuffer());
}
TEST_F(AudioSplicerTest, GapInsertion) {
scoped_refptr<AudioBuffer> input_1 = GetNextInputBuffer(0.1f);
const int kGapSize = 7;
input_timestamp_helper_.AddFrames(kGapSize);
scoped_refptr<AudioBuffer> input_2 = GetNextInputBuffer(0.2f);
EXPECT_TRUE(AddInput(input_1));
EXPECT_TRUE(AddInput(input_2));
VerifyNextBuffer(input_1);
scoped_refptr<AudioBuffer> output_2 = splicer_.GetNextBuffer();
base::TimeDelta gap_timestamp =
input_1->timestamp() + input_1->duration();
base::TimeDelta gap_duration = input_2->timestamp() - gap_timestamp;
EXPECT_GT(gap_duration, base::TimeDelta());
EXPECT_EQ(gap_timestamp, output_2->timestamp());
EXPECT_EQ(gap_duration, output_2->duration());
EXPECT_EQ(kGapSize, output_2->frame_count());
EXPECT_TRUE(VerifyData(output_2, 0.0f));
VerifyNextBuffer(input_2);
EXPECT_FALSE(splicer_.HasNextBuffer());
}
TEST_F(AudioSplicerTest, GapTooLarge) {
scoped_refptr<AudioBuffer> input_1 = GetNextInputBuffer(0.1f);
const int kGapSize = kDefaultSampleRate;
input_timestamp_helper_.AddFrames(kGapSize);
scoped_refptr<AudioBuffer> input_2 = GetNextInputBuffer(0.2f);
EXPECT_TRUE(AddInput(input_1));
EXPECT_FALSE(AddInput(input_2));
VerifyNextBuffer(input_1);
EXPECT_FALSE(splicer_.HasNextBuffer());
input_timestamp_helper_.SetBaseTimestamp(
input_1->timestamp() + input_1->duration());
scoped_refptr<AudioBuffer> input_3 = GetNextInputBuffer(0.3f);
EXPECT_TRUE(AddInput(input_3));
VerifyNextBuffer(input_3);
EXPECT_FALSE(splicer_.HasNextBuffer());
}
TEST_F(AudioSplicerTest, BufferAddedBeforeBase) {
input_timestamp_helper_.SetBaseTimestamp(
base::TimeDelta::FromMicroseconds(10));
scoped_refptr<AudioBuffer> input_1 = GetNextInputBuffer(0.1f);
input_timestamp_helper_.SetBaseTimestamp(base::TimeDelta::FromSeconds(0));
scoped_refptr<AudioBuffer> input_2 = GetNextInputBuffer(0.1f);
EXPECT_GT(input_1->timestamp(), input_2->timestamp());
EXPECT_TRUE(AddInput(input_1));
EXPECT_FALSE(AddInput(input_2));
}
TEST_F(AudioSplicerTest, PartialOverlap) {
scoped_refptr<AudioBuffer> input_1 = GetNextInputBuffer(0.1f);
const int kOverlapSize = input_1->frame_count() / 4;
input_timestamp_helper_.SetBaseTimestamp(input_1->timestamp());
input_timestamp_helper_.AddFrames(input_1->frame_count() - kOverlapSize);
scoped_refptr<AudioBuffer> input_2 = GetNextInputBuffer(0.2f);
EXPECT_TRUE(AddInput(input_1));
EXPECT_TRUE(AddInput(input_2));
VerifyNextBuffer(input_1);
ASSERT_TRUE(splicer_.HasNextBuffer());
scoped_refptr<AudioBuffer> output_2 = splicer_.GetNextBuffer();
EXPECT_FALSE(splicer_.HasNextBuffer());
base::TimeDelta expected_timestamp =
input_1->timestamp() + input_1->duration();
base::TimeDelta expected_duration =
(input_2->timestamp() + input_2->duration()) - expected_timestamp;
EXPECT_EQ(expected_timestamp, output_2->timestamp());
EXPECT_EQ(expected_duration, output_2->duration());
EXPECT_TRUE(VerifyData(output_2, GetValue(input_2)));
}
TEST_F(AudioSplicerTest, DropBuffer) {
scoped_refptr<AudioBuffer> input_1 = GetNextInputBuffer(0.1f);
const int kOverlapOffset = input_1->frame_count() / 2;
const int kOverlapSize = input_1->frame_count() / 4;
input_timestamp_helper_.SetBaseTimestamp(input_1->timestamp());
input_timestamp_helper_.AddFrames(kOverlapOffset);
scoped_refptr<AudioBuffer> input_2 = GetNextInputBuffer(0.2f, kOverlapSize);
input_timestamp_helper_.SetBaseTimestamp(input_1->timestamp());
input_timestamp_helper_.AddFrames(input_1->frame_count());
scoped_refptr<AudioBuffer> input_3 = GetNextInputBuffer(0.3f);
EXPECT_TRUE(AddInput(input_1));
EXPECT_TRUE(AddInput(input_2));
EXPECT_TRUE(AddInput(input_3));
VerifyNextBuffer(input_1);
VerifyNextBuffer(input_3);
EXPECT_FALSE(splicer_.HasNextBuffer());
}
TEST_F(AudioSplicerTest, PartialOverlapCrossfade) {
const int kCrossfadeSize =
input_timestamp_helper_.GetFramesToTarget(max_crossfade_duration());
const int kBufferSize = kCrossfadeSize * 2;
scoped_refptr<AudioBuffer> extra_pre_splice_buffer =
GetNextInputBuffer(0.2f, kBufferSize);
scoped_refptr<AudioBuffer> overlapped_buffer =
GetNextInputBuffer(1.0f, kBufferSize);
input_timestamp_helper_.SetBaseTimestamp(overlapped_buffer->timestamp());
input_timestamp_helper_.AddFrames(overlapped_buffer->frame_count() -
kCrossfadeSize);
splicer_.SetSpliceTimestamp(input_timestamp_helper_.GetTimestamp());
scoped_refptr<AudioBuffer> overlapping_buffer =
GetNextInputBuffer(0.0f, kBufferSize);
EXPECT_TRUE(AddInput(extra_pre_splice_buffer));
VerifyNextBuffer(extra_pre_splice_buffer);
EXPECT_TRUE(AddInput(overlapped_buffer));
EXPECT_FALSE(splicer_.HasNextBuffer());
EXPECT_TRUE(AddInput(overlapping_buffer));
EXPECT_FALSE(splicer_.HasNextBuffer());
scoped_refptr<AudioBuffer> extra_post_splice_buffer =
GetNextInputBuffer(0.5f, kBufferSize);
EXPECT_TRUE(AddInput(extra_post_splice_buffer));
VerifyPreSpliceOutput(overlapped_buffer,
overlapping_buffer,
221,
base::TimeDelta::FromMicroseconds(5012));
const int kExpectedCrossfadeSize = 220;
EXPECT_NEAR(kExpectedCrossfadeSize, kCrossfadeSize, 1);
VerifyCrossfadeOutput(overlapped_buffer,
NULL,
overlapping_buffer,
0,
kExpectedCrossfadeSize,
base::TimeDelta::FromMicroseconds(4988));
ASSERT_TRUE(splicer_.HasNextBuffer());
scoped_refptr<AudioBuffer> post_splice_output = splicer_.GetNextBuffer();
EXPECT_EQ(base::TimeDelta::FromMicroseconds(20022),
post_splice_output->timestamp());
EXPECT_EQ(overlapping_buffer->frame_count() - kExpectedCrossfadeSize,
post_splice_output->frame_count());
EXPECT_EQ(base::TimeDelta::FromMicroseconds(5034),
post_splice_output->duration());
EXPECT_TRUE(VerifyData(post_splice_output, GetValue(overlapping_buffer)));
VerifyNextBuffer(extra_post_splice_buffer);
EXPECT_FALSE(splicer_.HasNextBuffer());
}
TEST_F(AudioSplicerTest, PartialOverlapCrossfadeEndOfStream) {
const int kCrossfadeSize =
input_timestamp_helper_.GetFramesToTarget(max_crossfade_duration());
scoped_refptr<AudioBuffer> overlapped_buffer =
GetNextInputBuffer(1.0f, kCrossfadeSize * 2);
input_timestamp_helper_.SetBaseTimestamp(overlapped_buffer->timestamp());
input_timestamp_helper_.AddFrames(3 * overlapped_buffer->frame_count() / 4);
splicer_.SetSpliceTimestamp(input_timestamp_helper_.GetTimestamp());
scoped_refptr<AudioBuffer> overlapping_buffer =
GetNextInputBuffer(0.0f, kCrossfadeSize / 3);
EXPECT_TRUE(AddInput(overlapped_buffer));
EXPECT_FALSE(splicer_.HasNextBuffer());
EXPECT_TRUE(AddInput(overlapping_buffer));
EXPECT_FALSE(splicer_.HasNextBuffer());
EXPECT_TRUE(AddInput(AudioBuffer::CreateEOSBuffer()));
ASSERT_TRUE(splicer_.HasNextBuffer());
VerifyPreSpliceOutput(overlapped_buffer,
overlapping_buffer,
331,
base::TimeDelta::FromMicroseconds(7505));
VerifyCrossfadeOutput(overlapped_buffer,
NULL,
overlapping_buffer,
0,
overlapping_buffer->frame_count(),
overlapping_buffer->duration());
ASSERT_TRUE(splicer_.HasNextBuffer());
scoped_refptr<AudioBuffer> post_splice_output = splicer_.GetNextBuffer();
EXPECT_TRUE(post_splice_output->end_of_stream());
EXPECT_FALSE(splicer_.HasNextBuffer());
}
TEST_F(AudioSplicerTest, PartialOverlapCrossfadeShortPreSplice) {
const int kCrossfadeSize =
input_timestamp_helper_.GetFramesToTarget(max_crossfade_duration());
scoped_refptr<AudioBuffer> overlapped_buffer =
GetNextInputBuffer(1.0f, kCrossfadeSize / 2);
input_timestamp_helper_.SetBaseTimestamp(overlapped_buffer->timestamp());
input_timestamp_helper_.AddFrames(overlapped_buffer->frame_count() / 2);
splicer_.SetSpliceTimestamp(input_timestamp_helper_.GetTimestamp());
scoped_refptr<AudioBuffer> overlapping_buffer =
GetNextInputBuffer(0.0f, kCrossfadeSize * 2);
EXPECT_TRUE(AddInput(overlapped_buffer));
EXPECT_FALSE(splicer_.HasNextBuffer());
EXPECT_TRUE(AddInput(overlapping_buffer));
EXPECT_FALSE(splicer_.HasNextBuffer());
EXPECT_TRUE(AddInput(AudioBuffer::CreateEOSBuffer()));
ASSERT_TRUE(splicer_.HasNextBuffer());
const int kExpectedPreSpliceSize = 55;
const base::TimeDelta kExpectedPreSpliceDuration =
base::TimeDelta::FromMicroseconds(1247);
VerifyPreSpliceOutput(overlapped_buffer,
overlapping_buffer,
kExpectedPreSpliceSize,
kExpectedPreSpliceDuration);
VerifyCrossfadeOutput(overlapped_buffer,
NULL,
overlapping_buffer,
0,
kExpectedPreSpliceSize,
kExpectedPreSpliceDuration);
ASSERT_TRUE(splicer_.HasNextBuffer());
scoped_refptr<AudioBuffer> post_splice_output = splicer_.GetNextBuffer();
EXPECT_EQ(overlapping_buffer->timestamp() + kExpectedPreSpliceDuration,
post_splice_output->timestamp());
EXPECT_EQ(overlapping_buffer->frame_count() - kExpectedPreSpliceSize,
post_splice_output->frame_count());
EXPECT_EQ(overlapping_buffer->duration() - kExpectedPreSpliceDuration,
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());
}
TEST_F(AudioSplicerTest, IncorrectlyMarkedSplice) {
const int kBufferSize =
input_timestamp_helper_.GetFramesToTarget(max_crossfade_duration()) * 2;
scoped_refptr<AudioBuffer> first_buffer =
GetNextInputBuffer(1.0f, kBufferSize);
first_buffer->set_duration(first_buffer->duration() +
base::TimeDelta::FromMicroseconds(1));
splicer_.SetSpliceTimestamp(input_timestamp_helper_.GetTimestamp());
scoped_refptr<AudioBuffer> second_buffer =
GetNextInputBuffer(0.0f, kBufferSize);
EXPECT_TRUE(AddInput(first_buffer));
EXPECT_FALSE(splicer_.HasNextBuffer());
EXPECT_TRUE(AddInput(second_buffer));
ASSERT_TRUE(splicer_.HasNextBuffer());
VerifyNextBuffer(first_buffer);
VerifyNextBuffer(second_buffer);
EXPECT_FALSE(splicer_.HasNextBuffer());
}
TEST_F(AudioSplicerTest, IncorrectlyMarkedSpliceWithGap) {
const int kBufferSize =
input_timestamp_helper_.GetFramesToTarget(max_crossfade_duration()) * 2;
const int kGapSize = 2;
scoped_refptr<AudioBuffer> first_buffer =
GetNextInputBuffer(1.0f, kBufferSize - kGapSize);
scoped_refptr<AudioBuffer> gap_buffer =
GetNextInputBuffer(0.0f, kGapSize);
splicer_.SetSpliceTimestamp(input_timestamp_helper_.GetTimestamp());
scoped_refptr<AudioBuffer> second_buffer =
GetNextInputBuffer(0.0f, kBufferSize);
EXPECT_TRUE(AddInput(first_buffer));
EXPECT_TRUE(splicer_.HasNextBuffer());
VerifyNextBuffer(first_buffer);
EXPECT_TRUE(AddInput(second_buffer));
EXPECT_FALSE(splicer_.HasNextBuffer());
EXPECT_TRUE(AddInput(AudioBuffer::CreateEOSBuffer()));
ASSERT_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_F(AudioSplicerTest, SpliceIncorrectlySlotted) {
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);
input_timestamp_helper_.SetBaseTimestamp(splice_timestamp);
scoped_refptr<AudioBuffer> buffer_3 =
GetNextInputBuffer(0.0f, kBufferSize - kOverlapSize);
EXPECT_TRUE(AddInput(buffer_1));
EXPECT_FALSE(splicer_.HasNextBuffer());
EXPECT_TRUE(AddInput(buffer_2));
EXPECT_FALSE(splicer_.HasNextBuffer());
EXPECT_TRUE(AddInput(buffer_3));
EXPECT_FALSE(splicer_.HasNextBuffer());
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());
}
}