From 983546767adc8f75fc971dd058eafcb61e2a1856 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Monnom?= Date: Mon, 19 Jun 2023 01:40:51 +0200 Subject: [PATCH] fix: use native tls roots on ffi (#91) --- livekit-ffi/Cargo.toml | 2 +- webrtc-sys/include/livekit/audio_device.h | 8 ++++---- webrtc-sys/src/audio_device.cpp | 2 ++ webrtc-sys/src/data_channel.cpp | 5 ++++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/livekit-ffi/Cargo.toml b/livekit-ffi/Cargo.toml index 21f76d9..2ed4fbb 100644 --- a/livekit-ffi/Cargo.toml +++ b/livekit-ffi/Cargo.toml @@ -7,7 +7,7 @@ description = "LiveKit interface for foreign languages" repository = "https://github.com/livekit/client-sdk-rust" [features] -default = ["__rustls-tls"] +default = ["rustls-tls-native-roots"] native-tls = ["livekit/native-tls"] native-tls-vendored = ["livekit/native-tls-vendored"] rustls-tls-native-roots = ["livekit/rustls-tls-native-roots"] diff --git a/webrtc-sys/include/livekit/audio_device.h b/webrtc-sys/include/livekit/audio_device.h index 135e178..788fb63 100644 --- a/webrtc-sys/include/livekit/audio_device.h +++ b/webrtc-sys/include/livekit/audio_device.h @@ -118,12 +118,12 @@ class AudioDevice : public webrtc::AudioDeviceModule { private: mutable webrtc::Mutex mutex_; - webrtc::TaskQueueFactory* task_queue_factory_; + std::vector data_; std::unique_ptr audio_queue_; webrtc::RepeatingTaskHandle audio_task_; - std::vector data_; webrtc::AudioTransport* audio_transport_; - std::atomic playing_{false}; - std::atomic initialized_{false}; + webrtc::TaskQueueFactory* task_queue_factory_; + bool playing_{false}; + bool initialized_{false}; }; } // namespace livekit diff --git a/webrtc-sys/src/audio_device.cpp b/webrtc-sys/src/audio_device.cpp index 392f73a..18e63d6 100644 --- a/webrtc-sys/src/audio_device.cpp +++ b/webrtc-sys/src/audio_device.cpp @@ -150,11 +150,13 @@ bool AudioDevice::RecordingIsInitialized() const { } int32_t AudioDevice::StartPlayout() { + webrtc::MutexLock lock(&mutex_); playing_ = true; return 0; } int32_t AudioDevice::StopPlayout() { + webrtc::MutexLock lock(&mutex_); playing_ = false; return 0; } diff --git a/webrtc-sys/src/data_channel.cpp b/webrtc-sys/src/data_channel.cpp index 0eb1bcb..047af94 100644 --- a/webrtc-sys/src/data_channel.cpp +++ b/webrtc-sys/src/data_channel.cpp @@ -45,9 +45,12 @@ webrtc::DataChannelInit to_native_data_channel_init(DataChannelInit init) { DataChannel::DataChannel( std::shared_ptr rtc_runtime, rtc::scoped_refptr data_channel) - : rtc_runtime_(rtc_runtime), data_channel_(std::move(data_channel)) {} + : rtc_runtime_(rtc_runtime), data_channel_(std::move(data_channel)) { + RTC_LOG(LS_VERBOSE) << "DataChannel::DataChannel()"; +} DataChannel::~DataChannel() { + RTC_LOG(LS_VERBOSE) << "DataChannel::~DataChannel()"; unregister_observer(); }