Я работаю над Webrtc PeerConnection, и я получаю UDP socket Creation Failed
Фрагмент кода для вызова метода CreatePeerConnection упомянут ниже.
Я использовал свои собственные серверы оглушения и поворота и упомянул их IP-адрес и порт в данном коде. Я также попытался использовать адрес и порт сервера оглушения Google (stun:stun.l.google.com:19302
), но получаю ту же проблему
webrtc::PeerConnectionInterface::IceServers ice_servers;
webrtc::PeerConnectionInterface::IceServer ice_server;
webrtc::PeerConnectionInterface::RTCConfiguration config;
ice_server.uri = "stun:address_stun:port_stun";
config.servers.push_back(ice_server);
webrtc::PeerConnectionInterface::IceServer turn_server;
std::string url = "turn:address_turn:port_turn?transport=udp";
turn_server.urls.push_back(url);
turn_server.username = "username";
turn_server.password = "password";
config.servers.push_back(turn_server);
webrtc::FakeConstraints constraints;
constraints.AddOptional(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, "true");
config.candidate_network_policy = webrtc::PeerConnectionInterface::kCandidateNetworkPolicyLowCost;
config.tcp_candidate_policy = webrtc::PeerConnectionInterface::kTcpCandidatePolicyDisabled;
constraints.AddOptional(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
webrtc::MediaConstraintsInterface::kValueFalse);
constraints.AddMandatory(webrtc::MediaConstraintsInterface::kOfferToReceiveAudio,
webrtc::MediaConstraintsInterface::kValueTrue);rtc::ThreadManager::Instance()->WrapCurrentThread();
u_worker_thread = rtc::Thread::Create();
u_worker_thread->SetName("worker_thread", NULL);
RTC_CHECK(u_worker_thread->Start()) << "Failed to start thread";
u_signaling_thread = rtc::Thread::Create();
u_signaling_thread->SetName("signaling_thread", NULL);
RTC_CHECK(u_signaling_thread->Start()) << "Failed to start thread";m_networkThread = rtc::Thread::Create();
m_networkThread->SetName("networking_thread", NULL);
RTC_CHECK(m_networkThread->Start()) << "Failed to start thread";cricket::WebRtcVideoEncoderFactory* video_encoder_factory = nullptr;
cricket::WebRtcVideoDecoderFactory* video_decoder_factory = nullptr;
auto audio_encoder_factory = webrtc::CreateBuiltinAudioEncoderFactory();
auto audio_decoder_factory = webrtc::CreateBuiltinAudioDecoderFactory();webrtc::AudioDeviceModule* adm = nullptr;
fake_network_manager_.reset(new rtc::FakeNetworkManager());
static const SocketAddress kDefaultLocalAddress("local_ip", 0);
fake_network_manager_->AddInterface(kDefaultLocalAddress);
std::unique_ptr<cricket::PortAllocator> port_allocator_(new cricket::BasicPortAllocator(fake_network_manager_.get()));
_peerConnectionFactory = webrtc::CreatePeerConnectionFactory(m_networkThread.get(),u_worker_thread.get(),u_signaling_thread.get(),adm,audio_encoder_factory,audio_decoder_factory,video_encoder_factory,video_decoder_factory);
if (!_peerConnectionFactory.get()) {
}
else
{
__android_log_print(ANDROID_LOG_INFO, TAG,"Going to initialise CreatePeerConnection" );
_peerConnection = _peerConnectionFactory->CreatePeerConnection(
config, &constraints, std::move(port_allocator_), NULL, this);
}
Задача ещё не решена.
Других решений пока нет …