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

Side by Side Diff: webrtc/media/engine/webrtcvoiceengine_unittest.cc

Issue 2568553002: Add SSRC to RtpEncodingParameters for audio. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « webrtc/media/engine/webrtcvoiceengine.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2008 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2008 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 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 parameters.codecs.push_back(kIsacCodec); 1106 parameters.codecs.push_back(kIsacCodec);
1107 parameters.codecs.push_back(kPcmuCodec); 1107 parameters.codecs.push_back(kPcmuCodec);
1108 SetSendParameters(parameters); 1108 SetSendParameters(parameters);
1109 1109
1110 webrtc::RtpParameters rtp_parameters = channel_->GetRtpSendParameters(kSsrc1); 1110 webrtc::RtpParameters rtp_parameters = channel_->GetRtpSendParameters(kSsrc1);
1111 ASSERT_EQ(2u, rtp_parameters.codecs.size()); 1111 ASSERT_EQ(2u, rtp_parameters.codecs.size());
1112 EXPECT_EQ(kIsacCodec.ToCodecParameters(), rtp_parameters.codecs[0]); 1112 EXPECT_EQ(kIsacCodec.ToCodecParameters(), rtp_parameters.codecs[0]);
1113 EXPECT_EQ(kPcmuCodec.ToCodecParameters(), rtp_parameters.codecs[1]); 1113 EXPECT_EQ(kPcmuCodec.ToCodecParameters(), rtp_parameters.codecs[1]);
1114 } 1114 }
1115 1115
1116 // Test that GetRtpSendParameters returns an SSRC.
1117 TEST_F(WebRtcVoiceEngineTestFake, GetRtpSendParametersSsrc) {
1118 EXPECT_TRUE(SetupSendStream());
1119 webrtc::RtpParameters rtp_parameters = channel_->GetRtpSendParameters(kSsrc1);
1120 ASSERT_EQ(1u, rtp_parameters.encodings.size());
1121 EXPECT_EQ(kSsrc1, rtp_parameters.encodings[0].ssrc);
1122 }
1123
1116 // Test that if we set/get parameters multiple times, we get the same results. 1124 // Test that if we set/get parameters multiple times, we get the same results.
1117 TEST_F(WebRtcVoiceEngineTestFake, SetAndGetRtpSendParameters) { 1125 TEST_F(WebRtcVoiceEngineTestFake, SetAndGetRtpSendParameters) {
1118 EXPECT_TRUE(SetupSendStream()); 1126 EXPECT_TRUE(SetupSendStream());
1119 cricket::AudioSendParameters parameters; 1127 cricket::AudioSendParameters parameters;
1120 parameters.codecs.push_back(kIsacCodec); 1128 parameters.codecs.push_back(kIsacCodec);
1121 parameters.codecs.push_back(kPcmuCodec); 1129 parameters.codecs.push_back(kPcmuCodec);
1122 SetSendParameters(parameters); 1130 SetSendParameters(parameters);
1123 1131
1124 webrtc::RtpParameters initial_params = channel_->GetRtpSendParameters(kSsrc1); 1132 webrtc::RtpParameters initial_params = channel_->GetRtpSendParameters(kSsrc1);
1125 1133
(...skipping 13 matching lines...) Expand all
1139 parameters.codecs.push_back(kPcmuCodec); 1147 parameters.codecs.push_back(kPcmuCodec);
1140 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); 1148 EXPECT_TRUE(channel_->SetRecvParameters(parameters));
1141 1149
1142 webrtc::RtpParameters rtp_parameters = 1150 webrtc::RtpParameters rtp_parameters =
1143 channel_->GetRtpReceiveParameters(kSsrc1); 1151 channel_->GetRtpReceiveParameters(kSsrc1);
1144 ASSERT_EQ(2u, rtp_parameters.codecs.size()); 1152 ASSERT_EQ(2u, rtp_parameters.codecs.size());
1145 EXPECT_EQ(kIsacCodec.ToCodecParameters(), rtp_parameters.codecs[0]); 1153 EXPECT_EQ(kIsacCodec.ToCodecParameters(), rtp_parameters.codecs[0]);
1146 EXPECT_EQ(kPcmuCodec.ToCodecParameters(), rtp_parameters.codecs[1]); 1154 EXPECT_EQ(kPcmuCodec.ToCodecParameters(), rtp_parameters.codecs[1]);
1147 } 1155 }
1148 1156
1157 // Test that GetRtpReceiveParameters returns an SSRC.
1158 TEST_F(WebRtcVoiceEngineTestFake, GetRtpReceiveParametersSsrc) {
1159 EXPECT_TRUE(SetupRecvStream());
1160 webrtc::RtpParameters rtp_parameters =
the sun 2016/12/12 08:59:19 note: you could use 'auto' here and avoid a line b
Taylor Brandstetter 2016/12/12 18:50:17 I think I'll leave it in this case, for consistenc
1161 channel_->GetRtpReceiveParameters(kSsrc1);
1162 ASSERT_EQ(1u, rtp_parameters.encodings.size());
1163 EXPECT_EQ(kSsrc1, rtp_parameters.encodings[0].ssrc);
1164 }
1165
1149 // Test that if we set/get parameters multiple times, we get the same results. 1166 // Test that if we set/get parameters multiple times, we get the same results.
1150 TEST_F(WebRtcVoiceEngineTestFake, SetAndGetRtpReceiveParameters) { 1167 TEST_F(WebRtcVoiceEngineTestFake, SetAndGetRtpReceiveParameters) {
1151 EXPECT_TRUE(SetupRecvStream()); 1168 EXPECT_TRUE(SetupRecvStream());
1152 cricket::AudioRecvParameters parameters; 1169 cricket::AudioRecvParameters parameters;
1153 parameters.codecs.push_back(kIsacCodec); 1170 parameters.codecs.push_back(kIsacCodec);
1154 parameters.codecs.push_back(kPcmuCodec); 1171 parameters.codecs.push_back(kPcmuCodec);
1155 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); 1172 EXPECT_TRUE(channel_->SetRecvParameters(parameters));
1156 1173
1157 webrtc::RtpParameters initial_params = 1174 webrtc::RtpParameters initial_params =
1158 channel_->GetRtpReceiveParameters(kSsrc1); 1175 channel_->GetRtpReceiveParameters(kSsrc1);
(...skipping 2447 matching lines...) Expand 10 before | Expand all | Expand 10 after
3606 nullptr, webrtc::CreateBuiltinAudioDecoderFactory()); 3623 nullptr, webrtc::CreateBuiltinAudioDecoderFactory());
3607 webrtc::RtcEventLogNullImpl event_log; 3624 webrtc::RtcEventLogNullImpl event_log;
3608 std::unique_ptr<webrtc::Call> call( 3625 std::unique_ptr<webrtc::Call> call(
3609 webrtc::Call::Create(webrtc::Call::Config(&event_log))); 3626 webrtc::Call::Create(webrtc::Call::Config(&event_log)));
3610 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(), 3627 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(),
3611 cricket::AudioOptions(), call.get()); 3628 cricket::AudioOptions(), call.get());
3612 cricket::AudioRecvParameters parameters; 3629 cricket::AudioRecvParameters parameters;
3613 parameters.codecs = engine.recv_codecs(); 3630 parameters.codecs = engine.recv_codecs();
3614 EXPECT_TRUE(channel.SetRecvParameters(parameters)); 3631 EXPECT_TRUE(channel.SetRecvParameters(parameters));
3615 } 3632 }
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvoiceengine.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698