mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
Add WEB_RTC_NON_CELLULAR enum, II
PiperOrigin-RevId: 685103930
This commit is contained in:
committed by
Copybara-Service
parent
fec1c8f63f
commit
7b2eddc458
@@ -17,6 +17,7 @@
|
||||
#include <winnls.h>
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
@@ -71,6 +72,12 @@ const std::string WebRtcMedium::GetDefaultCountryCode() {
|
||||
|
||||
void WebRtcMedium::CreatePeerConnection(
|
||||
webrtc::PeerConnectionObserver* observer, PeerConnectionCallback callback) {
|
||||
CreatePeerConnection(std::nullopt, observer, std::move(callback));
|
||||
}
|
||||
|
||||
void WebRtcMedium::CreatePeerConnection(
|
||||
std::optional<webrtc::PeerConnectionFactoryInterface::Options> options,
|
||||
webrtc::PeerConnectionObserver* observer, PeerConnectionCallback callback) {
|
||||
webrtc::PeerConnectionInterface::RTCConfiguration rtc_config;
|
||||
rtc_config.sdp_semantics = webrtc::SdpSemantics::kUnifiedPlan;
|
||||
// TODO(b/261663238): Add the TURN servers and go beyond the default servers.
|
||||
@@ -94,6 +101,9 @@ void WebRtcMedium::CreatePeerConnection(
|
||||
webrtc::CreateDefaultTaskQueueFactory();
|
||||
factory_dependencies.signaling_thread = signaling_thread.release();
|
||||
|
||||
if (options.has_value()) {
|
||||
// TODO(edwinwu): Add support for non-cellular networks.
|
||||
}
|
||||
auto peer_connection_or_error =
|
||||
webrtc::CreateModularPeerConnectionFactory(
|
||||
std::move(factory_dependencies))
|
||||
|
||||
@@ -15,10 +15,15 @@
|
||||
#ifndef PLATFORM_IMPL_WINDOWS_WEBRTC_H_
|
||||
#define PLATFORM_IMPL_WINDOWS_WEBRTC_H_
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "internal/platform/byte_array.h"
|
||||
#include "internal/platform/implementation/account_manager.h"
|
||||
#include "internal/platform/implementation/webrtc.h"
|
||||
#include "webrtc/api/peer_connection_interface.h"
|
||||
|
||||
namespace nearby {
|
||||
namespace windows {
|
||||
@@ -63,6 +68,13 @@ class WebRtcMedium : public api::WebRtcMedium {
|
||||
void CreatePeerConnection(webrtc::PeerConnectionObserver* observer,
|
||||
PeerConnectionCallback callback) override;
|
||||
|
||||
// Creates and returns a new webrtc::PeerConnectionInterface object via
|
||||
// |callback| with |PeerConnectionFactoryInterface::Options|.
|
||||
void CreatePeerConnection(
|
||||
std::optional<webrtc::PeerConnectionFactoryInterface::Options> options,
|
||||
webrtc::PeerConnectionObserver* observer,
|
||||
PeerConnectionCallback callback) override;
|
||||
|
||||
// Returns a signaling messenger for sending WebRTC signaling messages.
|
||||
// TODO(b/261663238): replace with real implementation.
|
||||
std::unique_ptr<api::WebRtcSignalingMessenger> GetSignalingMessenger(
|
||||
|
||||
@@ -15,12 +15,17 @@
|
||||
#include "internal/platform/implementation/windows/webrtc.h"
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
#include "protobuf-matchers/protocol-buffer-matchers.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "internal/platform/implementation/webrtc.h"
|
||||
#include "webrtc/api/jsep.h"
|
||||
#include "webrtc/api/data_channel_interface.h"
|
||||
#include "webrtc/api/peer_connection_interface.h"
|
||||
#include "webrtc/api/scoped_refptr.h"
|
||||
|
||||
namespace nearby {
|
||||
namespace windows {
|
||||
|
||||
@@ -58,8 +63,9 @@ TEST(WebrtcTest, CreatePeerConnectionSucceeds) {
|
||||
auto observer = std::make_unique<MockPeerConnectionObserver>();
|
||||
WebRtcMedium medium;
|
||||
medium.CreatePeerConnection(
|
||||
observer.get(), [](rtc::scoped_refptr<webrtc::PeerConnectionInterface>
|
||||
peer_connection) mutable {
|
||||
std::nullopt, observer.get(),
|
||||
[](rtc::scoped_refptr<webrtc::PeerConnectionInterface>
|
||||
peer_connection) mutable {
|
||||
if (!peer_connection) {
|
||||
FAIL() << "Peer connection should have been non-null";
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user