OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 NetEqExternalDecoderTest::NetEqExternalDecoderTest(NetEqDecoder codec, | 21 NetEqExternalDecoderTest::NetEqExternalDecoderTest(NetEqDecoder codec, |
22 int sample_rate_hz, | 22 int sample_rate_hz, |
23 AudioDecoder* decoder) | 23 AudioDecoder* decoder) |
24 : codec_(codec), | 24 : codec_(codec), |
25 decoder_(decoder), | 25 decoder_(decoder), |
26 sample_rate_hz_(sample_rate_hz), | 26 sample_rate_hz_(sample_rate_hz), |
27 channels_(decoder_->Channels()) { | 27 channels_(decoder_->Channels()) { |
28 NetEq::Config config; | 28 NetEq::Config config; |
29 config.sample_rate_hz = sample_rate_hz_; | 29 config.sample_rate_hz = sample_rate_hz_; |
30 neteq_.reset(NetEq::Create(config, CreateBuiltinAudioDecoderFactory())); | 30 neteq_.reset(NetEq::Create(config, CreateBuiltinAudioDecoderFactory())); |
31 printf("%" PRIuS "\n", channels_); | |
32 } | 31 } |
33 | 32 |
34 void NetEqExternalDecoderTest::Init() { | 33 void NetEqExternalDecoderTest::Init() { |
35 ASSERT_EQ(NetEq::kOK, | 34 ASSERT_EQ(NetEq::kOK, |
36 neteq_->RegisterExternalDecoder(decoder_, codec_, name_, | 35 neteq_->RegisterExternalDecoder(decoder_, codec_, name_, |
37 kPayloadType)); | 36 kPayloadType)); |
38 } | 37 } |
39 | 38 |
40 void NetEqExternalDecoderTest::InsertPacket( | 39 void NetEqExternalDecoderTest::InsertPacket( |
41 WebRtcRTPHeader rtp_header, | 40 WebRtcRTPHeader rtp_header, |
42 rtc::ArrayView<const uint8_t> payload, | 41 rtc::ArrayView<const uint8_t> payload, |
43 uint32_t receive_timestamp) { | 42 uint32_t receive_timestamp) { |
44 ASSERT_EQ(NetEq::kOK, | 43 ASSERT_EQ(NetEq::kOK, |
45 neteq_->InsertPacket(rtp_header, payload, receive_timestamp)); | 44 neteq_->InsertPacket(rtp_header, payload, receive_timestamp)); |
46 } | 45 } |
47 | 46 |
48 void NetEqExternalDecoderTest::GetOutputAudio(AudioFrame* output) { | 47 void NetEqExternalDecoderTest::GetOutputAudio(AudioFrame* output) { |
49 // Get audio from regular instance. | 48 // Get audio from regular instance. |
50 bool muted; | 49 bool muted; |
51 EXPECT_EQ(NetEq::kOK, neteq_->GetAudio(output, &muted)); | 50 EXPECT_EQ(NetEq::kOK, neteq_->GetAudio(output, &muted)); |
52 ASSERT_FALSE(muted); | 51 ASSERT_FALSE(muted); |
53 EXPECT_EQ(channels_, output->num_channels_); | 52 EXPECT_EQ(channels_, output->num_channels_); |
54 EXPECT_EQ(static_cast<size_t>(kOutputLengthMs * sample_rate_hz_ / 1000), | 53 EXPECT_EQ(static_cast<size_t>(kOutputLengthMs * sample_rate_hz_ / 1000), |
55 output->samples_per_channel_); | 54 output->samples_per_channel_); |
56 EXPECT_EQ(sample_rate_hz_, neteq_->last_output_sample_rate_hz()); | 55 EXPECT_EQ(sample_rate_hz_, neteq_->last_output_sample_rate_hz()); |
57 } | 56 } |
58 | 57 |
59 } // namespace test | 58 } // namespace test |
60 } // namespace webrtc | 59 } // namespace webrtc |
OLD | NEW |