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 17 matching lines...) Expand all Loading... |
28 namespace test { | 28 namespace test { |
29 namespace { | 29 namespace { |
30 | 30 |
31 using testing::_; | 31 using testing::_; |
32 using testing::Return; | 32 using testing::Return; |
33 | 33 |
34 const int kChannelId = 1; | 34 const int kChannelId = 1; |
35 const uint32_t kSsrc = 1234; | 35 const uint32_t kSsrc = 1234; |
36 const char* kCName = "foo_name"; | 36 const char* kCName = "foo_name"; |
37 const int kAudioLevelId = 2; | 37 const int kAudioLevelId = 2; |
38 const int kAbsSendTimeId = 3; | |
39 const int kTransportSequenceNumberId = 4; | 38 const int kTransportSequenceNumberId = 4; |
40 const int kEchoDelayMedian = 254; | 39 const int kEchoDelayMedian = 254; |
41 const int kEchoDelayStdDev = -3; | 40 const int kEchoDelayStdDev = -3; |
42 const int kEchoReturnLoss = -65; | 41 const int kEchoReturnLoss = -65; |
43 const int kEchoReturnLossEnhancement = 101; | 42 const int kEchoReturnLossEnhancement = 101; |
44 const float kResidualEchoLikelihood = 0.0f; | 43 const float kResidualEchoLikelihood = 0.0f; |
45 const unsigned int kSpeechInputLevel = 96; | 44 const unsigned int kSpeechInputLevel = 96; |
46 const CallStatistics kCallStats = { | 45 const CallStatistics kCallStats = { |
47 1345, 1678, 1901, 1234, 112, 13456, 17890, 1567, -1890, -1123}; | 46 1345, 1678, 1901, 1234, 112, 13456, 17890, 1567, -1890, -1123}; |
48 const ReportBlock kReportBlock = {456, 780, 123, 567, 890, 132, 143, 13354}; | 47 const ReportBlock kReportBlock = {456, 780, 123, 567, 890, 132, 143, 13354}; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 })); | 85 })); |
87 | 86 |
88 SetupMockForSetupSendCodec(); | 87 SetupMockForSetupSendCodec(); |
89 | 88 |
90 stream_config_.voe_channel_id = kChannelId; | 89 stream_config_.voe_channel_id = kChannelId; |
91 stream_config_.rtp.ssrc = kSsrc; | 90 stream_config_.rtp.ssrc = kSsrc; |
92 stream_config_.rtp.nack.rtp_history_ms = 200; | 91 stream_config_.rtp.nack.rtp_history_ms = 200; |
93 stream_config_.rtp.c_name = kCName; | 92 stream_config_.rtp.c_name = kCName; |
94 stream_config_.rtp.extensions.push_back( | 93 stream_config_.rtp.extensions.push_back( |
95 RtpExtension(RtpExtension::kAudioLevelUri, kAudioLevelId)); | 94 RtpExtension(RtpExtension::kAudioLevelUri, kAudioLevelId)); |
96 stream_config_.rtp.extensions.push_back( | |
97 RtpExtension(RtpExtension::kAbsSendTimeUri, kAbsSendTimeId)); | |
98 stream_config_.rtp.extensions.push_back(RtpExtension( | 95 stream_config_.rtp.extensions.push_back(RtpExtension( |
99 RtpExtension::kTransportSequenceNumberUri, kTransportSequenceNumberId)); | 96 RtpExtension::kTransportSequenceNumberUri, kTransportSequenceNumberId)); |
100 // Use ISAC as default codec so as to prevent unnecessary |voice_engine_| | 97 // Use ISAC as default codec so as to prevent unnecessary |voice_engine_| |
101 // calls from the default ctor behavior. | 98 // calls from the default ctor behavior. |
102 stream_config_.send_codec_spec.codec_inst = kIsacCodec; | 99 stream_config_.send_codec_spec.codec_inst = kIsacCodec; |
103 } | 100 } |
104 | 101 |
105 AudioSendStream::Config& config() { return stream_config_; } | 102 AudioSendStream::Config& config() { return stream_config_; } |
106 rtc::scoped_refptr<AudioState> audio_state() { return audio_state_; } | 103 rtc::scoped_refptr<AudioState> audio_state() { return audio_state_; } |
107 MockVoEChannelProxy* channel_proxy() { return channel_proxy_; } | 104 MockVoEChannelProxy* channel_proxy() { return channel_proxy_; } |
108 CongestionController* congestion_controller() { | 105 CongestionController* congestion_controller() { |
109 return &congestion_controller_; | 106 return &congestion_controller_; |
110 } | 107 } |
111 BitrateAllocator* bitrate_allocator() { return &bitrate_allocator_; } | 108 BitrateAllocator* bitrate_allocator() { return &bitrate_allocator_; } |
112 rtc::TaskQueue* worker_queue() { return &worker_queue_; } | 109 rtc::TaskQueue* worker_queue() { return &worker_queue_; } |
113 RtcEventLog* event_log() { return &event_log_; } | 110 RtcEventLog* event_log() { return &event_log_; } |
114 MockVoiceEngine* voice_engine() { return &voice_engine_; } | 111 MockVoiceEngine* voice_engine() { return &voice_engine_; } |
115 | 112 |
116 void SetupDefaultChannelProxy() { | 113 void SetupDefaultChannelProxy() { |
117 using testing::StrEq; | 114 using testing::StrEq; |
118 channel_proxy_ = new testing::StrictMock<MockVoEChannelProxy>(); | 115 channel_proxy_ = new testing::StrictMock<MockVoEChannelProxy>(); |
119 EXPECT_CALL(*channel_proxy_, SetRTCPStatus(true)).Times(1); | 116 EXPECT_CALL(*channel_proxy_, SetRTCPStatus(true)).Times(1); |
120 EXPECT_CALL(*channel_proxy_, SetLocalSSRC(kSsrc)).Times(1); | 117 EXPECT_CALL(*channel_proxy_, SetLocalSSRC(kSsrc)).Times(1); |
121 EXPECT_CALL(*channel_proxy_, SetRTCP_CNAME(StrEq(kCName))).Times(1); | 118 EXPECT_CALL(*channel_proxy_, SetRTCP_CNAME(StrEq(kCName))).Times(1); |
122 EXPECT_CALL(*channel_proxy_, SetNACKStatus(true, 10)).Times(1); | 119 EXPECT_CALL(*channel_proxy_, SetNACKStatus(true, 10)).Times(1); |
123 EXPECT_CALL(*channel_proxy_, | 120 EXPECT_CALL(*channel_proxy_, |
124 SetSendAbsoluteSenderTimeStatus(true, kAbsSendTimeId)) | |
125 .Times(1); | |
126 EXPECT_CALL(*channel_proxy_, | |
127 SetSendAudioLevelIndicationStatus(true, kAudioLevelId)) | 121 SetSendAudioLevelIndicationStatus(true, kAudioLevelId)) |
128 .Times(1); | 122 .Times(1); |
129 EXPECT_CALL(*channel_proxy_, | 123 EXPECT_CALL(*channel_proxy_, |
130 EnableSendTransportSequenceNumber(kTransportSequenceNumberId)) | 124 EnableSendTransportSequenceNumber(kTransportSequenceNumberId)) |
131 .Times(1); | 125 .Times(1); |
132 EXPECT_CALL(*channel_proxy_, | 126 EXPECT_CALL(*channel_proxy_, |
133 RegisterSenderCongestionControlObjects( | 127 RegisterSenderCongestionControlObjects( |
134 congestion_controller_.pacer(), | 128 congestion_controller_.pacer(), |
135 congestion_controller_.GetTransportFeedbackObserver(), | 129 congestion_controller_.GetTransportFeedbackObserver(), |
136 congestion_controller_.packet_router())) | 130 congestion_controller_.packet_router())) |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 BitrateAllocator bitrate_allocator_; | 206 BitrateAllocator bitrate_allocator_; |
213 // |worker_queue| is defined last to ensure all pending tasks are cancelled | 207 // |worker_queue| is defined last to ensure all pending tasks are cancelled |
214 // and deleted before any other members. | 208 // and deleted before any other members. |
215 rtc::TaskQueue worker_queue_; | 209 rtc::TaskQueue worker_queue_; |
216 }; | 210 }; |
217 } // namespace | 211 } // namespace |
218 | 212 |
219 TEST(AudioSendStreamTest, ConfigToString) { | 213 TEST(AudioSendStreamTest, ConfigToString) { |
220 AudioSendStream::Config config(nullptr); | 214 AudioSendStream::Config config(nullptr); |
221 config.rtp.ssrc = kSsrc; | 215 config.rtp.ssrc = kSsrc; |
222 config.rtp.extensions.push_back( | |
223 RtpExtension(RtpExtension::kAbsSendTimeUri, kAbsSendTimeId)); | |
224 config.rtp.c_name = kCName; | 216 config.rtp.c_name = kCName; |
225 config.voe_channel_id = kChannelId; | 217 config.voe_channel_id = kChannelId; |
226 config.min_bitrate_kbps = 12; | 218 config.min_bitrate_kbps = 12; |
227 config.max_bitrate_kbps = 34; | 219 config.max_bitrate_kbps = 34; |
228 config.send_codec_spec.nack_enabled = true; | 220 config.send_codec_spec.nack_enabled = true; |
229 config.send_codec_spec.transport_cc_enabled = false; | 221 config.send_codec_spec.transport_cc_enabled = false; |
230 config.send_codec_spec.enable_codec_fec = true; | 222 config.send_codec_spec.enable_codec_fec = true; |
231 config.send_codec_spec.enable_opus_dtx = false; | 223 config.send_codec_spec.enable_opus_dtx = false; |
232 config.send_codec_spec.opus_max_playback_rate = 32000; | 224 config.send_codec_spec.opus_max_playback_rate = 32000; |
233 config.send_codec_spec.cng_payload_type = 42; | 225 config.send_codec_spec.cng_payload_type = 42; |
234 config.send_codec_spec.cng_plfreq = 56; | 226 config.send_codec_spec.cng_plfreq = 56; |
235 config.send_codec_spec.min_ptime_ms = 20; | 227 config.send_codec_spec.min_ptime_ms = 20; |
236 config.send_codec_spec.max_ptime_ms = 60; | 228 config.send_codec_spec.max_ptime_ms = 60; |
237 config.send_codec_spec.codec_inst = kIsacCodec; | 229 config.send_codec_spec.codec_inst = kIsacCodec; |
| 230 config.rtp.extensions.push_back( |
| 231 RtpExtension(RtpExtension::kAudioLevelUri, kAudioLevelId)); |
238 EXPECT_EQ( | 232 EXPECT_EQ( |
239 "{rtp: {ssrc: 1234, extensions: [{uri: " | 233 "{rtp: {ssrc: 1234, extensions: [{uri: " |
240 "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time, id: 3}], " | 234 "urn:ietf:params:rtp-hdrext:ssrc-audio-level, id: 2}], nack: " |
241 "nack: {rtp_history_ms: 0}, c_name: foo_name}, send_transport: nullptr, " | 235 "{rtp_history_ms: 0}, c_name: foo_name}, send_transport: nullptr, " |
242 "voe_channel_id: 1, min_bitrate_kbps: 12, max_bitrate_kbps: 34, " | 236 "voe_channel_id: 1, min_bitrate_kbps: 12, max_bitrate_kbps: 34, " |
243 "send_codec_spec: {nack_enabled: true, transport_cc_enabled: false, " | 237 "send_codec_spec: {nack_enabled: true, transport_cc_enabled: false, " |
244 "enable_codec_fec: true, enable_opus_dtx: false, opus_max_playback_rate: " | 238 "enable_codec_fec: true, enable_opus_dtx: false, opus_max_playback_rate: " |
245 "32000, cng_payload_type: 42, cng_plfreq: 56, min_ptime: 20, max_ptime: " | 239 "32000, cng_payload_type: 42, cng_plfreq: 56, min_ptime: 20, max_ptime: " |
246 "60, codec_inst: {pltype: 103, plname: \"isac\", plfreq: 16000, pacsize: " | 240 "60, codec_inst: {pltype: 103, plname: \"isac\", plfreq: 16000, pacsize: " |
247 "320, channels: 1, rate: 32000}}}", | 241 "320, channels: 1, rate: 32000}}}", |
248 config.ToString()); | 242 config.ToString()); |
249 } | 243 } |
250 | 244 |
251 TEST(AudioSendStreamTest, ConstructDestruct) { | 245 TEST(AudioSendStreamTest, ConstructDestruct) { |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 EXPECT_CALL(*helper.voice_engine(), SetVADStatus(kChannelId, true, _, _)) | 376 EXPECT_CALL(*helper.voice_engine(), SetVADStatus(kChannelId, true, _, _)) |
383 .WillOnce(Return(0)); | 377 .WillOnce(Return(0)); |
384 internal::AudioSendStream send_stream( | 378 internal::AudioSendStream send_stream( |
385 stream_config, helper.audio_state(), helper.worker_queue(), | 379 stream_config, helper.audio_state(), helper.worker_queue(), |
386 helper.congestion_controller(), helper.bitrate_allocator(), | 380 helper.congestion_controller(), helper.bitrate_allocator(), |
387 helper.event_log()); | 381 helper.event_log()); |
388 } | 382 } |
389 | 383 |
390 } // namespace test | 384 } // namespace test |
391 } // namespace webrtc | 385 } // namespace webrtc |
OLD | NEW |