| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 } | 86 } |
| 87 | 87 |
| 88 void TearDown() override {} | 88 void TearDown() override {} |
| 89 | 89 |
| 90 void InsertOnePacketOfSilence(int codec_id) { | 90 void InsertOnePacketOfSilence(int codec_id) { |
| 91 CodecInst codec; | 91 CodecInst codec; |
| 92 ACMCodecDB::Codec(codec_id, &codec); | 92 ACMCodecDB::Codec(codec_id, &codec); |
| 93 if (timestamp_ == 0) { // This is the first time inserting audio. | 93 if (timestamp_ == 0) { // This is the first time inserting audio. |
| 94 ASSERT_EQ(0, acm_->RegisterSendCodec(codec)); | 94 ASSERT_EQ(0, acm_->RegisterSendCodec(codec)); |
| 95 } else { | 95 } else { |
| 96 CodecInst current_codec; | 96 auto current_codec = acm_->SendCodec(); |
| 97 ASSERT_EQ(0, acm_->SendCodec(¤t_codec)); | 97 ASSERT_TRUE(current_codec); |
| 98 if (!CodecsEqual(codec, current_codec)) | 98 if (!CodecsEqual(codec, *current_codec)) |
| 99 ASSERT_EQ(0, acm_->RegisterSendCodec(codec)); | 99 ASSERT_EQ(0, acm_->RegisterSendCodec(codec)); |
| 100 } | 100 } |
| 101 AudioFrame frame; | 101 AudioFrame frame; |
| 102 // Frame setup according to the codec. | 102 // Frame setup according to the codec. |
| 103 frame.sample_rate_hz_ = codec.plfreq; | 103 frame.sample_rate_hz_ = codec.plfreq; |
| 104 frame.samples_per_channel_ = codec.plfreq / 100; // 10 ms. | 104 frame.samples_per_channel_ = codec.plfreq / 100; // 10 ms. |
| 105 frame.num_channels_ = codec.channels; | 105 frame.num_channels_ = codec.channels; |
| 106 memset(frame.data_, 0, frame.samples_per_channel_ * frame.num_channels_ * | 106 memset(frame.data_, 0, frame.samples_per_channel_ * frame.num_channels_ * |
| 107 sizeof(int16_t)); | 107 sizeof(int16_t)); |
| 108 packet_sent_ = false; | 108 packet_sent_ = false; |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 } | 359 } |
| 360 EXPECT_EQ(c.id, receiver_->last_audio_codec_id()); | 360 EXPECT_EQ(c.id, receiver_->last_audio_codec_id()); |
| 361 EXPECT_EQ(0, receiver_->LastAudioCodec(&codec)); | 361 EXPECT_EQ(0, receiver_->LastAudioCodec(&codec)); |
| 362 EXPECT_TRUE(CodecsEqual(c.inst, codec)); | 362 EXPECT_TRUE(CodecsEqual(c.inst, codec)); |
| 363 } | 363 } |
| 364 } | 364 } |
| 365 | 365 |
| 366 } // namespace acm2 | 366 } // namespace acm2 |
| 367 | 367 |
| 368 } // namespace webrtc | 368 } // namespace webrtc |
| OLD | NEW |