mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
Create separate WebRtc Platform.
PiperOrigin-RevId: 919283950
This commit is contained in:
committed by
Copybara-Service
parent
765bd555e4
commit
5df1af7c61
@@ -112,6 +112,7 @@ cc_library(
|
||||
"//internal/platform:types",
|
||||
"//internal/platform:uuid",
|
||||
"//internal/platform/implementation:comm",
|
||||
"//internal/platform/implementation:webrtc_platform",
|
||||
"//internal/platform/implementation:wifi_utils",
|
||||
"//internal/proto:credential_cc_proto",
|
||||
# "//third_party/webrtc/files/stable/webrtc/api:create_modular_peer_connection_factory",
|
||||
@@ -177,6 +178,7 @@ cc_library(
|
||||
testonly = True,
|
||||
srcs = [
|
||||
"platform.cc",
|
||||
"webrtc_platform.cc",
|
||||
],
|
||||
defines = ["NO_WEBRTC"],
|
||||
visibility = [
|
||||
@@ -208,14 +210,16 @@ cc_library(
|
||||
"//internal/platform/implementation:comm",
|
||||
"//internal/platform/implementation:platform",
|
||||
"//internal/platform/implementation:types",
|
||||
"//internal/platform/implementation:webrtc_platform",
|
||||
"//internal/platform/implementation/shared:count_down_latch",
|
||||
"//internal/platform/implementation/shared:file",
|
||||
"//third_party/gloop/thread",
|
||||
"@com_google_absl//absl/base:core_headers",
|
||||
"@com_google_absl//absl/status",
|
||||
"@com_google_absl//absl/status:statusor",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_nisaba//nisaba/port:thread_pool",
|
||||
],
|
||||
alwayslink = 1,
|
||||
)
|
||||
|
||||
cc_library(
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
#include "internal/platform/implementation/platform.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
@@ -25,6 +24,7 @@
|
||||
#include "absl/status/statusor.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "third_party/gloop/thread/thread.h"
|
||||
#include "internal/base/file_path.h"
|
||||
#include "internal/base/files.h"
|
||||
#include "internal/platform/implementation/app_lifecycle_monitor.h"
|
||||
@@ -55,11 +55,6 @@
|
||||
#include "internal/platform/logging.h"
|
||||
#include "internal/platform/os_name.h"
|
||||
#include "internal/platform/payload_id.h"
|
||||
#include "thread/thread.h"
|
||||
#ifndef NO_WEBRTC
|
||||
#include "internal/platform/implementation/g3/webrtc.h"
|
||||
#include "internal/platform/implementation/webrtc.h"
|
||||
#endif
|
||||
#include "internal/platform/implementation/g3/atomic_boolean.h"
|
||||
#include "internal/platform/implementation/g3/atomic_reference.h"
|
||||
#include "internal/platform/implementation/g3/ble.h"
|
||||
@@ -80,7 +75,6 @@
|
||||
#include "internal/platform/implementation/g3/wifi_lan.h"
|
||||
#include "internal/platform/implementation/shared/file.h"
|
||||
#include "internal/platform/implementation/wifi.h"
|
||||
#include "internal/platform/medium_environment.h"
|
||||
|
||||
namespace nearby {
|
||||
namespace api {
|
||||
@@ -219,16 +213,6 @@ ImplementationPlatform::CreateWifiDirectMedium() {
|
||||
return std::make_unique<g3::WifiDirectMedium>();
|
||||
}
|
||||
|
||||
#ifndef NO_WEBRTC
|
||||
std::unique_ptr<WebRtcMedium> ImplementationPlatform::CreateWebRtcMedium() {
|
||||
if (MediumEnvironment::Instance().GetEnvironmentConfig().webrtc_enabled) {
|
||||
return std::make_unique<g3::WebRtcMedium>();
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
std::unique_ptr<AppLifecycleMonitor>
|
||||
ImplementationPlatform::CreateAppLifecycleMonitor(
|
||||
std::function<void(AppLifecycleMonitor::AppLifecycleState)>
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
// Copyright 2026 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "internal/platform/implementation/webrtc_platform.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "internal/platform/implementation/g3/webrtc.h"
|
||||
#include "internal/platform/implementation/webrtc.h"
|
||||
#include "internal/platform/medium_environment.h"
|
||||
|
||||
namespace nearby::api {
|
||||
|
||||
std::unique_ptr<WebRtcMedium>
|
||||
WebRtcImplementationPlatform::CreateWebRtcMedium() {
|
||||
if (MediumEnvironment::Instance().GetEnvironmentConfig().webrtc_enabled) {
|
||||
return std::make_unique<g3::WebRtcMedium>();
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace nearby::api
|
||||
Reference in New Issue
Block a user