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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 auto current_codec = acm_->SendCodec(); | 96 auto current_codec = acm_->SendCodec(); |
97 ASSERT_TRUE(current_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 frame.Mute(); |
107 sizeof(int16_t)); | |
108 packet_sent_ = false; | 107 packet_sent_ = false; |
109 last_packet_send_timestamp_ = timestamp_; | 108 last_packet_send_timestamp_ = timestamp_; |
110 while (!packet_sent_) { | 109 while (!packet_sent_) { |
111 frame.timestamp_ = timestamp_; | 110 frame.timestamp_ = timestamp_; |
112 timestamp_ += frame.samples_per_channel_; | 111 timestamp_ += frame.samples_per_channel_; |
113 ASSERT_GE(acm_->Add10MsData(frame), 0); | 112 ASSERT_GE(acm_->Add10MsData(frame), 0); |
114 } | 113 } |
115 } | 114 } |
116 | 115 |
117 template <size_t N> | 116 template <size_t N> |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 receiver_->last_packet_sample_rate_hz()); | 499 receiver_->last_packet_sample_rate_hz()); |
501 EXPECT_EQ(0, receiver_->LastAudioCodec(&codec)); | 500 EXPECT_EQ(0, receiver_->LastAudioCodec(&codec)); |
502 EXPECT_TRUE(CodecsEqual(c.inst, codec)); | 501 EXPECT_TRUE(CodecsEqual(c.inst, codec)); |
503 } | 502 } |
504 } | 503 } |
505 #endif | 504 #endif |
506 | 505 |
507 } // namespace acm2 | 506 } // namespace acm2 |
508 | 507 |
509 } // namespace webrtc | 508 } // namespace webrtc |
OLD | NEW |