diff --git a/internal/platform/implementation/g3/platform.cc b/internal/platform/implementation/g3/platform.cc index 49842156..ed937acd 100644 --- a/internal/platform/implementation/g3/platform.cc +++ b/internal/platform/implementation/g3/platform.cc @@ -33,9 +33,10 @@ #include "internal/platform/implementation/scheduled_executor.h" #include "internal/platform/implementation/server_sync.h" #include "internal/platform/implementation/submittable_executor.h" +#ifndef NO_WEBRTC +#include "internal/platform/implementation/g3/webrtc.h" #include "internal/platform/implementation/webrtc.h" -#include "internal/platform/implementation/wifi.h" -#include "internal/platform/medium_environment.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" @@ -47,9 +48,10 @@ #include "internal/platform/implementation/g3/mutex.h" #include "internal/platform/implementation/g3/scheduled_executor.h" #include "internal/platform/implementation/g3/single_thread_executor.h" -#include "internal/platform/implementation/g3/webrtc.h" #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 location { namespace nearby { @@ -146,6 +148,7 @@ std::unique_ptr ImplementationPlatform::CreateWifiLanMedium() { return absl::make_unique(); } +#ifndef NO_WEBRTC std::unique_ptr ImplementationPlatform::CreateWebRtcMedium() { if (MediumEnvironment::Instance().GetEnvironmentConfig().webrtc_enabled) { return absl::make_unique(); @@ -153,6 +156,7 @@ std::unique_ptr ImplementationPlatform::CreateWebRtcMedium() { return nullptr; } } +#endif std::unique_ptr ImplementationPlatform::CreateMutex(Mutex::Mode mode) { if (mode == Mutex::Mode::kRecursive) diff --git a/internal/platform/implementation/platform.h b/internal/platform/implementation/platform.h index acd6e36c..2bd8a147 100644 --- a/internal/platform/implementation/platform.h +++ b/internal/platform/implementation/platform.h @@ -38,7 +38,9 @@ #include "internal/platform/implementation/settable_future.h" #include "internal/platform/implementation/submittable_executor.h" #include "internal/platform/implementation/system_clock.h" +#ifndef NO_WEBRTC #include "internal/platform/implementation/webrtc.h" +#endif #include "internal/platform/implementation/wifi.h" #include "internal/platform/implementation/wifi_lan.h" #include "internal/platform/payload_id.h" @@ -101,7 +103,9 @@ class ImplementationPlatform { static std::unique_ptr CreateServerSyncMedium(); static std::unique_ptr CreateWifiMedium(); static std::unique_ptr CreateWifiLanMedium(); +#ifndef NO_WEBRTC static std::unique_ptr CreateWebRtcMedium(); +#endif }; } // namespace api diff --git a/internal/platform/medium_environment.cc b/internal/platform/medium_environment.cc index e0aeadd7..5d9f619e 100644 --- a/internal/platform/medium_environment.cc +++ b/internal/platform/medium_environment.cc @@ -59,8 +59,10 @@ void MediumEnvironment::Reset() { bluetooth_adapters_.clear(); bluetooth_mediums_.clear(); ble_mediums_.clear(); +#ifndef NO_WEBRTC webrtc_signaling_message_callback_.clear(); webrtc_signaling_complete_callback_.clear(); +#endif wifi_lan_mediums_.clear(); use_valid_peer_connection_ = true; peer_connection_latency_ = absl::ZeroDuration(); @@ -475,7 +477,7 @@ void MediumEnvironment::CallBleAcceptedConnectionCallback( info.accepted_connection_callback.accepted_cb(socket, service_id); }); } - +#ifndef NO_WEBRTC void MediumEnvironment::RegisterWebRtcSignalingMessenger( absl::string_view self_id, OnSignalingMessageCallback message_callback, OnSignalingCompleteCallback complete_callback) { @@ -535,7 +537,7 @@ void MediumEnvironment::SendWebRtcSignalingComplete(absl::string_view peer_id, item->second(success); }); } - +#endif void MediumEnvironment::SetUseValidPeerConnection( bool use_valid_peer_connection) { use_valid_peer_connection_ = use_valid_peer_connection; diff --git a/internal/platform/medium_environment.h b/internal/platform/medium_environment.h index b1c43769..609e9595 100644 --- a/internal/platform/medium_environment.h +++ b/internal/platform/medium_environment.h @@ -23,7 +23,9 @@ #include "internal/platform/implementation/ble.h" #include "internal/platform/implementation/bluetooth_adapter.h" #include "internal/platform/implementation/bluetooth_classic.h" +#ifndef NO_WEBRTC #include "internal/platform/implementation/webrtc.h" +#endif #include "internal/platform/implementation/wifi_lan.h" #include "internal/platform/byte_array.h" #include "internal/platform/feature_flags.h" @@ -56,10 +58,12 @@ class MediumEnvironment { api::BleMedium::DiscoveredPeripheralCallback; using BleAcceptedConnectionCallback = api::BleMedium::AcceptedConnectionCallback; +#ifndef NO_WEBRTC using OnSignalingMessageCallback = api::WebRtcSignalingMessenger::OnSignalingMessageCallback; using OnSignalingCompleteCallback = api::WebRtcSignalingMessenger::OnSignalingCompleteCallback; +#endif using WifiLanDiscoveredServiceCallback = api::WifiLanMedium::DiscoveredServiceCallback; @@ -130,7 +134,7 @@ class MediumEnvironment { api::BluetoothDevice* FindBluetoothDevice(const std::string& mac_address); const EnvironmentConfig& GetEnvironmentConfig(); - +#ifndef NO_WEBRTC // Registers |message_callback| to receive messages sent to device with id // |self_id|, and |complete_callback| to notify when signaling is complete. void RegisterWebRtcSignalingMessenger( @@ -147,7 +151,7 @@ class MediumEnvironment { // Simulates sending an "signaling complete" signal to the WebRTC medium. void SendWebRtcSignalingComplete(absl::string_view peer_id, bool success); - +#endif // Used to set if WebRtcMedium should use a valid peer connection or nullptr // in tests. void SetUseValidPeerConnection(bool use_valid_peer_connection); @@ -299,7 +303,7 @@ class MediumEnvironment { bluetooth_mediums_; absl::flat_hash_map ble_mediums_; - +#ifndef NO_WEBRTC // Maps peer id to callback for receiving signaling messages. absl::flat_hash_map webrtc_signaling_message_callback_; @@ -307,7 +311,7 @@ class MediumEnvironment { // Maps peer id to callback for signaling complete events. absl::flat_hash_map webrtc_signaling_complete_callback_; - +#endif absl::flat_hash_map wifi_lan_mediums_;