upper_bound_ = upper_bound;
}
- void FrameEncoded(scoped_ptr<EncodedFrame> encoded_frame) {
+ void SetSamplesPerFrame(int samples_per_frame) {
+ samples_per_frame_ = samples_per_frame;
+ }
+
+ void FrameEncoded(scoped_ptr<EncodedFrame> encoded_frame,
+ int samples_skipped) {
EXPECT_EQ(encoded_frame->dependency, EncodedFrame::KEY);
EXPECT_EQ(static_cast<uint8>(frames_received_ & 0xff),
encoded_frame->frame_id);
// of the fixed frame size.
EXPECT_LE(rtp_lower_bound_, encoded_frame->rtp_timestamp);
rtp_lower_bound_ = encoded_frame->rtp_timestamp;
- // Note: In audio_encoder.cc, 100 is the fixed audio frame rate.
- const int kSamplesPerFrame = kDefaultAudioSamplingRate / 100;
- EXPECT_EQ(0u, encoded_frame->rtp_timestamp % kSamplesPerFrame);
+ EXPECT_EQ(0u, encoded_frame->rtp_timestamp % samples_per_frame_);
EXPECT_TRUE(!encoded_frame->data.empty());
EXPECT_LE(lower_bound_, encoded_frame->reference_time);
const Codec codec_;
int frames_received_;
uint32 rtp_lower_bound_;
+ int samples_per_frame_;
base::TimeTicks lower_bound_;
base::TimeTicks upper_bound_;
testing_clock_->Advance(base::TimeTicks::Now() - base::TimeTicks());
}
- virtual void SetUp() {
+ void SetUp() override {
task_runner_ = new test::FakeSingleThreadTaskRunner(testing_clock_);
cast_environment_ =
new CastEnvironment(scoped_ptr<base::TickClock>(testing_clock_).Pass(),
CreateObjectsForCodec(codec);
- // Note: In audio_encoder.cc, 10 ms is the fixed frame duration.
- const base::TimeDelta frame_duration =
- base::TimeDelta::FromMilliseconds(10);
+ const base::TimeDelta frame_duration = audio_encoder_->GetFrameDuration();
for (size_t i = 0; i < scenario.num_durations; ++i) {
const bool simulate_missing_data = scenario.durations_in_ms[i] < 0;
codec,
base::Bind(&TestEncodedAudioFrameReceiver::FrameEncoded,
base::Unretained(receiver_.get()))));
+
+ receiver_->SetSamplesPerFrame(audio_encoder_->GetSamplesPerFrame());
}
base::SimpleTestTickClock* testing_clock_; // Owned by CastEnvironment.
RunTestForCodec(CODEC_AUDIO_PCM16);
}
+#if defined(OS_MACOSX)
+TEST_P(AudioEncoderTest, EncodeAac) {
+ RunTestForCodec(CODEC_AUDIO_AAC);
+}
+#endif
+
static const int64 kOneCall_3Millis[] = {3};
static const int64 kOneCall_10Millis[] = {10};
static const int64 kOneCall_13Millis[] = {13};