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

Side by Side Diff: webrtc/voice_engine/test/auto_test/fakes/conference_transport.cc

Issue 2686043006: WebRtcVoiceMediaChannel::AddRecvStream: Don't call SetRecPayloadType (Closed)
Patch Set: rebase Created 3 years, 9 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
11 #include "webrtc/voice_engine/test/auto_test/fakes/conference_transport.h" 11 #include "webrtc/voice_engine/test/auto_test/fakes/conference_transport.h"
12 12
13 #include <string> 13 #include <string>
14 14
15 #include "webrtc/base/byteorder.h" 15 #include "webrtc/base/byteorder.h"
16 #include "webrtc/base/timeutils.h" 16 #include "webrtc/base/timeutils.h"
17 #include "webrtc/system_wrappers/include/sleep.h" 17 #include "webrtc/system_wrappers/include/sleep.h"
18 #include "webrtc/voice_engine/channel_proxy.h"
19 #include "webrtc/voice_engine/voice_engine_impl.h"
18 20
19 namespace { 21 namespace {
20 static const unsigned int kReflectorSsrc = 0x0000; 22 static const unsigned int kReflectorSsrc = 0x0000;
21 static const unsigned int kLocalSsrc = 0x0001; 23 static const unsigned int kLocalSsrc = 0x0001;
22 static const unsigned int kFirstRemoteSsrc = 0x0002; 24 static const unsigned int kFirstRemoteSsrc = 0x0002;
23 static const webrtc::CodecInst kCodecInst = 25 static const webrtc::CodecInst kCodecInst =
24 {120, "opus", 48000, 960, 2, 64000}; 26 {120, "opus", 48000, 960, 2, 64000};
25 static const int kAudioLevelHeaderId = 1; 27 static const int kAudioLevelHeaderId = 1;
26 28
27 static unsigned int ParseRtcpSsrc(const void* data, size_t len) { 29 static unsigned int ParseRtcpSsrc(const void* data, size_t len) {
(...skipping 27 matching lines...) Expand all
55 // here, we use two engines to make it more like reality. 57 // here, we use two engines to make it more like reality.
56 remote_voe_ = webrtc::VoiceEngine::Create(); 58 remote_voe_ = webrtc::VoiceEngine::Create();
57 remote_base_ = webrtc::VoEBase::GetInterface(remote_voe_); 59 remote_base_ = webrtc::VoEBase::GetInterface(remote_voe_);
58 remote_codec_ = webrtc::VoECodec::GetInterface(remote_voe_); 60 remote_codec_ = webrtc::VoECodec::GetInterface(remote_voe_);
59 remote_network_ = webrtc::VoENetwork::GetInterface(remote_voe_); 61 remote_network_ = webrtc::VoENetwork::GetInterface(remote_voe_);
60 remote_rtp_rtcp_ = webrtc::VoERTP_RTCP::GetInterface(remote_voe_); 62 remote_rtp_rtcp_ = webrtc::VoERTP_RTCP::GetInterface(remote_voe_);
61 remote_file_ = webrtc::VoEFile::GetInterface(remote_voe_); 63 remote_file_ = webrtc::VoEFile::GetInterface(remote_voe_);
62 64
63 EXPECT_EQ(0, local_base_->Init()); 65 EXPECT_EQ(0, local_base_->Init());
64 local_sender_ = local_base_->CreateChannel(); 66 local_sender_ = local_base_->CreateChannel();
67 static_cast<webrtc::VoiceEngineImpl*>(local_voe_)
68 ->GetChannelProxy(local_sender_)
69 ->RegisterLegacyCodecs();
65 EXPECT_EQ(0, local_network_->RegisterExternalTransport(local_sender_, *this)); 70 EXPECT_EQ(0, local_network_->RegisterExternalTransport(local_sender_, *this));
66 EXPECT_EQ(0, local_rtp_rtcp_->SetLocalSSRC(local_sender_, kLocalSsrc)); 71 EXPECT_EQ(0, local_rtp_rtcp_->SetLocalSSRC(local_sender_, kLocalSsrc));
67 EXPECT_EQ(0, local_rtp_rtcp_-> 72 EXPECT_EQ(0, local_rtp_rtcp_->
68 SetSendAudioLevelIndicationStatus(local_sender_, true, 73 SetSendAudioLevelIndicationStatus(local_sender_, true,
69 kAudioLevelHeaderId)); 74 kAudioLevelHeaderId));
70 75
71 EXPECT_EQ(0, local_base_->StartSend(local_sender_)); 76 EXPECT_EQ(0, local_base_->StartSend(local_sender_));
72 77
73 EXPECT_EQ(0, remote_base_->Init()); 78 EXPECT_EQ(0, remote_base_->Init());
74 reflector_ = remote_base_->CreateChannel(); 79 reflector_ = remote_base_->CreateChannel();
80 static_cast<webrtc::VoiceEngineImpl*>(remote_voe_)
81 ->GetChannelProxy(reflector_)
82 ->RegisterLegacyCodecs();
75 EXPECT_EQ(0, remote_network_->RegisterExternalTransport(reflector_, *this)); 83 EXPECT_EQ(0, remote_network_->RegisterExternalTransport(reflector_, *this));
76 EXPECT_EQ(0, remote_rtp_rtcp_->SetLocalSSRC(reflector_, kReflectorSsrc)); 84 EXPECT_EQ(0, remote_rtp_rtcp_->SetLocalSSRC(reflector_, kReflectorSsrc));
77 85
78 thread_.Start(); 86 thread_.Start();
79 thread_.SetPriority(rtc::kHighPriority); 87 thread_.SetPriority(rtc::kHighPriority);
80 } 88 }
81 89
82 ConferenceTransport::~ConferenceTransport() { 90 ConferenceTransport::~ConferenceTransport() {
83 // Must stop sending, otherwise DispatchPackets() cannot quit. 91 // Must stop sending, otherwise DispatchPackets() cannot quit.
84 EXPECT_EQ(0, remote_network_->DeRegisterExternalTransport(reflector_)); 92 EXPECT_EQ(0, remote_network_->DeRegisterExternalTransport(reflector_));
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 return true; 223 return true;
216 } 224 }
217 225
218 void ConferenceTransport::SetRtt(unsigned int rtt_ms) { 226 void ConferenceTransport::SetRtt(unsigned int rtt_ms) {
219 rtt_ms_ = rtt_ms; 227 rtt_ms_ = rtt_ms;
220 } 228 }
221 229
222 unsigned int ConferenceTransport::AddStream(std::string file_name, 230 unsigned int ConferenceTransport::AddStream(std::string file_name,
223 webrtc::FileFormats format) { 231 webrtc::FileFormats format) {
224 const int new_sender = remote_base_->CreateChannel(); 232 const int new_sender = remote_base_->CreateChannel();
233 static_cast<webrtc::VoiceEngineImpl*>(remote_voe_)
234 ->GetChannelProxy(new_sender)
235 ->RegisterLegacyCodecs();
225 EXPECT_EQ(0, remote_network_->RegisterExternalTransport(new_sender, *this)); 236 EXPECT_EQ(0, remote_network_->RegisterExternalTransport(new_sender, *this));
226 237
227 const unsigned int remote_ssrc = kFirstRemoteSsrc + stream_count_++; 238 const unsigned int remote_ssrc = kFirstRemoteSsrc + stream_count_++;
228 EXPECT_EQ(0, remote_rtp_rtcp_->SetLocalSSRC(new_sender, remote_ssrc)); 239 EXPECT_EQ(0, remote_rtp_rtcp_->SetLocalSSRC(new_sender, remote_ssrc));
229 EXPECT_EQ(0, remote_rtp_rtcp_-> 240 EXPECT_EQ(0, remote_rtp_rtcp_->
230 SetSendAudioLevelIndicationStatus(new_sender, true, kAudioLevelHeaderId)); 241 SetSendAudioLevelIndicationStatus(new_sender, true, kAudioLevelHeaderId));
231 242
232 EXPECT_EQ(0, remote_codec_->SetSendCodec(new_sender, kCodecInst)); 243 EXPECT_EQ(0, remote_codec_->SetSendCodec(new_sender, kCodecInst));
233 EXPECT_EQ(0, remote_base_->StartSend(new_sender)); 244 EXPECT_EQ(0, remote_base_->StartSend(new_sender));
234 EXPECT_EQ(0, remote_file_->StartPlayingFileAsMicrophone( 245 EXPECT_EQ(0, remote_file_->StartPlayingFileAsMicrophone(
235 new_sender, file_name.c_str(), true, false, format, 1.0)); 246 new_sender, file_name.c_str(), true, false, format, 1.0));
236 247
237 const int new_receiver = local_base_->CreateChannel(); 248 const int new_receiver = local_base_->CreateChannel();
249 static_cast<webrtc::VoiceEngineImpl*>(local_voe_)
250 ->GetChannelProxy(new_receiver)
251 ->RegisterLegacyCodecs();
238 EXPECT_EQ(0, local_base_->AssociateSendChannel(new_receiver, local_sender_)); 252 EXPECT_EQ(0, local_base_->AssociateSendChannel(new_receiver, local_sender_));
239 253
240 EXPECT_EQ(0, local_network_->RegisterExternalTransport(new_receiver, *this)); 254 EXPECT_EQ(0, local_network_->RegisterExternalTransport(new_receiver, *this));
241 // Receive channels have to have the same SSRC in order to send receiver 255 // Receive channels have to have the same SSRC in order to send receiver
242 // reports with this SSRC. 256 // reports with this SSRC.
243 EXPECT_EQ(0, local_rtp_rtcp_->SetLocalSSRC(new_receiver, kLocalSsrc)); 257 EXPECT_EQ(0, local_rtp_rtcp_->SetLocalSSRC(new_receiver, kLocalSsrc));
244 258
245 { 259 {
246 rtc::CritScope lock(&stream_crit_); 260 rtc::CritScope lock(&stream_crit_);
247 streams_[remote_ssrc] = std::make_pair(new_sender, new_receiver); 261 streams_[remote_ssrc] = std::make_pair(new_sender, new_receiver);
(...skipping 29 matching lines...) Expand all
277 bool ConferenceTransport::GetReceiverStatistics(unsigned int id, 291 bool ConferenceTransport::GetReceiverStatistics(unsigned int id,
278 webrtc::CallStatistics* stats) { 292 webrtc::CallStatistics* stats) {
279 int dst = GetReceiverChannelForSsrc(id); 293 int dst = GetReceiverChannelForSsrc(id);
280 if (dst == -1) { 294 if (dst == -1) {
281 return false; 295 return false;
282 } 296 }
283 EXPECT_EQ(0, local_rtp_rtcp_->GetRTCPStatistics(dst, *stats)); 297 EXPECT_EQ(0, local_rtp_rtcp_->GetRTCPStatistics(dst, *stats));
284 return true; 298 return true;
285 } 299 }
286 } // namespace voetest 300 } // namespace voetest
OLDNEW
« no previous file with comments | « webrtc/voice_engine/channel_proxy.cc ('k') | webrtc/voice_engine/test/auto_test/fixtures/after_streaming_fixture.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698