Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: webrtc/audio/audio_receive_stream_unittest.cc

Issue 2886993005: Introduce RtpStreamReceiver and RtpStreamReceiverControllerInterface. (Closed)
Patch Set: Rename again, to RtpStreamReceiver. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 30 matching lines...) Expand all
41 audio_decode_stats.decoded_plc = 123; 41 audio_decode_stats.decoded_plc = 123;
42 audio_decode_stats.decoded_cng = 456; 42 audio_decode_stats.decoded_cng = 456;
43 audio_decode_stats.decoded_plc_cng = 789; 43 audio_decode_stats.decoded_plc_cng = 789;
44 audio_decode_stats.decoded_muted_output = 987; 44 audio_decode_stats.decoded_muted_output = 987;
45 return audio_decode_stats; 45 return audio_decode_stats;
46 } 46 }
47 47
48 const int kChannelId = 2; 48 const int kChannelId = 2;
49 const uint32_t kRemoteSsrc = 1234; 49 const uint32_t kRemoteSsrc = 1234;
50 const uint32_t kLocalSsrc = 5678; 50 const uint32_t kLocalSsrc = 5678;
51 #if 0
51 const size_t kOneByteExtensionHeaderLength = 4; 52 const size_t kOneByteExtensionHeaderLength = 4;
52 const size_t kOneByteExtensionLength = 4; 53 const size_t kOneByteExtensionLength = 4;
54 #endif
53 const int kAudioLevelId = 3; 55 const int kAudioLevelId = 3;
54 const int kTransportSequenceNumberId = 4; 56 const int kTransportSequenceNumberId = 4;
55 const int kJitterBufferDelay = -7; 57 const int kJitterBufferDelay = -7;
56 const int kPlayoutBufferDelay = 302; 58 const int kPlayoutBufferDelay = 302;
57 const unsigned int kSpeechOutputLevel = 99; 59 const unsigned int kSpeechOutputLevel = 99;
58 const CallStatistics kCallStats = { 60 const CallStatistics kCallStats = {
59 345, 678, 901, 234, -12, 3456, 7890, 567, 890, 123}; 61 345, 678, 901, 234, -12, 3456, 7890, 567, 890, 123};
60 const CodecInst kCodecInst = { 62 const CodecInst kCodecInst = {
61 123, "codec_name_recv", 96000, -187, 0, -103}; 63 123, "codec_name_recv", 96000, -187, 0, -103};
62 const NetworkStatistics kNetworkStats = { 64 const NetworkStatistics kNetworkStats = {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 PacketRouter packet_router_; 163 PacketRouter packet_router_;
162 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_; 164 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_;
163 MockRtcEventLog event_log_; 165 MockRtcEventLog event_log_;
164 testing::StrictMock<MockVoiceEngine> voice_engine_; 166 testing::StrictMock<MockVoiceEngine> voice_engine_;
165 rtc::scoped_refptr<AudioState> audio_state_; 167 rtc::scoped_refptr<AudioState> audio_state_;
166 rtc::scoped_refptr<MockAudioMixer> audio_mixer_; 168 rtc::scoped_refptr<MockAudioMixer> audio_mixer_;
167 AudioReceiveStream::Config stream_config_; 169 AudioReceiveStream::Config stream_config_;
168 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr; 170 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr;
169 }; 171 };
170 172
173 #if 0
171 void BuildOneByteExtension(std::vector<uint8_t>::iterator it, 174 void BuildOneByteExtension(std::vector<uint8_t>::iterator it,
172 int id, 175 int id,
173 uint32_t extension_value, 176 uint32_t extension_value,
174 size_t value_length) { 177 size_t value_length) {
175 const uint16_t kRtpOneByteHeaderExtensionId = 0xBEDE; 178 const uint16_t kRtpOneByteHeaderExtensionId = 0xBEDE;
176 ByteWriter<uint16_t>::WriteBigEndian(&(*it), kRtpOneByteHeaderExtensionId); 179 ByteWriter<uint16_t>::WriteBigEndian(&(*it), kRtpOneByteHeaderExtensionId);
177 it += 2; 180 it += 2;
178 181
179 ByteWriter<uint16_t>::WriteBigEndian(&(*it), kOneByteExtensionLength / 4); 182 ByteWriter<uint16_t>::WriteBigEndian(&(*it), kOneByteExtensionLength / 4);
180 it += 2; 183 it += 2;
(...skipping 30 matching lines...) Expand all
211 std::vector<uint8_t> packet; 214 std::vector<uint8_t> packet;
212 const size_t kRtcpSrLength = 28; // In bytes. 215 const size_t kRtcpSrLength = 28; // In bytes.
213 packet.resize(kRtcpSrLength); 216 packet.resize(kRtcpSrLength);
214 packet[0] = 0x80; // Version 2. 217 packet[0] = 0x80; // Version 2.
215 packet[1] = 0xc8; // PT = 200, SR. 218 packet[1] = 0xc8; // PT = 200, SR.
216 // Length in number of 32-bit words - 1. 219 // Length in number of 32-bit words - 1.
217 ByteWriter<uint16_t>::WriteBigEndian(&packet[2], 6); 220 ByteWriter<uint16_t>::WriteBigEndian(&packet[2], 6);
218 ByteWriter<uint32_t>::WriteBigEndian(&packet[4], kLocalSsrc); 221 ByteWriter<uint32_t>::WriteBigEndian(&packet[4], kLocalSsrc);
219 return packet; 222 return packet;
220 } 223 }
224 #endif
221 } // namespace 225 } // namespace
222 226
223 TEST(AudioReceiveStreamTest, ConfigToString) { 227 TEST(AudioReceiveStreamTest, ConfigToString) {
224 AudioReceiveStream::Config config; 228 AudioReceiveStream::Config config;
225 config.rtp.remote_ssrc = kRemoteSsrc; 229 config.rtp.remote_ssrc = kRemoteSsrc;
226 config.rtp.local_ssrc = kLocalSsrc; 230 config.rtp.local_ssrc = kLocalSsrc;
227 config.voe_channel_id = kChannelId; 231 config.voe_channel_id = kChannelId;
228 config.rtp.extensions.push_back( 232 config.rtp.extensions.push_back(
229 RtpExtension(RtpExtension::kAudioLevelUri, kAudioLevelId)); 233 RtpExtension(RtpExtension::kAudioLevelUri, kAudioLevelId));
230 EXPECT_EQ( 234 EXPECT_EQ(
231 "{rtp: {remote_ssrc: 1234, local_ssrc: 5678, transport_cc: off, nack: " 235 "{rtp: {remote_ssrc: 1234, local_ssrc: 5678, transport_cc: off, nack: "
232 "{rtp_history_ms: 0}, extensions: [{uri: " 236 "{rtp_history_ms: 0}, extensions: [{uri: "
233 "urn:ietf:params:rtp-hdrext:ssrc-audio-level, id: 3}]}, " 237 "urn:ietf:params:rtp-hdrext:ssrc-audio-level, id: 3}]}, "
234 "rtcp_send_transport: null, voe_channel_id: 2}", 238 "rtcp_send_transport: null, voe_channel_id: 2}",
235 config.ToString()); 239 config.ToString());
236 } 240 }
237 241
242 #if 0
238 TEST(AudioReceiveStreamTest, ConstructDestruct) { 243 TEST(AudioReceiveStreamTest, ConstructDestruct) {
239 ConfigHelper helper; 244 ConfigHelper helper;
240 internal::AudioReceiveStream recv_stream( 245 internal::AudioReceiveStream recv_stream(
241 helper.packet_router(), 246 helper.packet_router(),
242 helper.config(), helper.audio_state(), helper.event_log()); 247 helper.config(), helper.audio_state(), helper.event_log());
243 } 248 }
244 249
245 TEST(AudioReceiveStreamTest, ReceiveRtpPacket) { 250 TEST(AudioReceiveStreamTest, ReceiveRtpPacket) {
246 ConfigHelper helper; 251 ConfigHelper helper;
247 helper.config().rtp.transport_cc = true; 252 helper.config().rtp.transport_cc = true;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 helper.packet_router(), 355 helper.packet_router(),
351 helper.config(), helper.audio_state(), helper.event_log()); 356 helper.config(), helper.audio_state(), helper.event_log());
352 357
353 EXPECT_CALL(helper.voice_engine(), StartPlayout(_)).WillOnce(Return(0)); 358 EXPECT_CALL(helper.voice_engine(), StartPlayout(_)).WillOnce(Return(0));
354 EXPECT_CALL(helper.voice_engine(), StopPlayout(_)); 359 EXPECT_CALL(helper.voice_engine(), StopPlayout(_));
355 EXPECT_CALL(*helper.audio_mixer(), AddSource(&recv_stream)) 360 EXPECT_CALL(*helper.audio_mixer(), AddSource(&recv_stream))
356 .WillOnce(Return(true)); 361 .WillOnce(Return(true));
357 362
358 recv_stream.Start(); 363 recv_stream.Start();
359 } 364 }
365 #endif
360 } // namespace test 366 } // namespace test
361 } // namespace webrtc 367 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/audio/audio_receive_stream.cc ('k') | webrtc/call/BUILD.gn » ('j') | webrtc/call/call.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698