mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
Move platform dependent part of WebRtcMedium into WebRtcPlatform.
PiperOrigin-RevId: 919888693
This commit is contained in:
committed by
Copybara-Service
parent
b536c8da3a
commit
4e387e7ea7
@@ -40,10 +40,6 @@ class WebRtc {
|
||||
|
||||
virtual ~WebRtc() = default;
|
||||
|
||||
// Gets the default two-letter country code associated with current locale.
|
||||
// For example, en_US locale resolves to "US".
|
||||
virtual std::string GetDefaultCountryCode() { return ""; }
|
||||
|
||||
// Returns if WebRtc is available as a medium for nearby to transport data.
|
||||
// Runs on @MainThread.
|
||||
virtual bool IsAvailable() { return false; }
|
||||
|
||||
@@ -132,6 +132,7 @@ cc_library(
|
||||
"//internal/platform:cancellation_flag",
|
||||
"//internal/platform:logging",
|
||||
"//internal/platform:types",
|
||||
"//internal/platform/implementation:webrtc_platform",
|
||||
"//proto/mediums:web_rtc_signaling_frames_cc_proto",
|
||||
"//third_party/webrtc/files/stable/webrtc/api:jsep",
|
||||
"//third_party/webrtc/files/stable/webrtc/rtc_base:network_constants",
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
@@ -72,10 +71,6 @@ class WebRtcMedium {
|
||||
WebRtcMedium(WebRtcMedium&&) = default;
|
||||
WebRtcMedium& operator=(WebRtcMedium&&) = delete;
|
||||
|
||||
// Gets the default two-letter country code associated with current locale.
|
||||
// For example, en_US locale resolves to "US".
|
||||
std::string GetDefaultCountryCode() { return impl_->GetDefaultCountryCode(); }
|
||||
|
||||
void SetNonCellular(bool non_cellular) { non_cellular_ = non_cellular; }
|
||||
|
||||
// Creates and returns a new webrtc::PeerConnectionInterface object via
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "connections/implementation/offline_frames.h"
|
||||
#include "connections/implementation/proto/offline_wire_formats.pb.h"
|
||||
#include "internal/platform/expected.h"
|
||||
#include "internal/platform/implementation/webrtc_platform.h"
|
||||
#include "internal/platform/logging.h"
|
||||
|
||||
namespace nearby {
|
||||
@@ -135,8 +136,8 @@ void WebrtcBwuHandler::HandleRevertInitiatorStateForService(
|
||||
std::string WebrtcBwuHandler::HandleInitializeUpgradedMediumForEndpoint(
|
||||
ClientProxy* client, const std::string& upgrade_service_id,
|
||||
const std::string& endpoint_id) {
|
||||
LocationHint location_hint =
|
||||
BuildLocationHint(webrtc_.GetDefaultCountryCode());
|
||||
LocationHint location_hint = BuildLocationHint(
|
||||
api::WebRtcImplementationPlatform::GetDefaultCountryCode());
|
||||
|
||||
mediums::WebrtcPeerId self_id{mediums::WebrtcPeerId::FromRandom()};
|
||||
if (!webrtc_.IsAcceptingConnections(upgrade_service_id)) {
|
||||
|
||||
@@ -81,10 +81,6 @@ WebRtcImpl::~WebRtcImpl() {
|
||||
}
|
||||
}
|
||||
|
||||
std::string WebRtcImpl::GetDefaultCountryCode() {
|
||||
return medium_->GetDefaultCountryCode();
|
||||
}
|
||||
|
||||
bool WebRtcImpl::IsAvailable() { return medium_->IsValid(); }
|
||||
|
||||
bool WebRtcImpl::IsAcceptingConnections(const std::string& service_id) {
|
||||
|
||||
@@ -52,7 +52,6 @@ class WebRtcImpl : public WebRtc {
|
||||
~WebRtcImpl() override;
|
||||
|
||||
// Overrides for WebRtc:
|
||||
std::string GetDefaultCountryCode() override;
|
||||
bool IsAvailable() override;
|
||||
bool IsAcceptingConnections(const std::string& service_id) override
|
||||
ABSL_LOCKS_EXCLUDED(mutex_);
|
||||
|
||||
Reference in New Issue
Block a user