From 932475e5086d9b660e72620bff3717543ac14e8e Mon Sep 17 00:00:00 2001 From: Alan George Date: Thu, 28 May 2026 21:20:17 -0600 Subject: [PATCH] Remove second arg to init/LogSink --- .github/workflows/builds.yml | 2 +- .github/workflows/docker-validate.yml | 2 +- cpp-example-collection | 2 +- docs/doxygen/index.md | 135 ------------------ include/livekit/livekit.h | 11 +- src/livekit.cpp | 6 +- src/tests/common/test_common.h | 2 +- src/tests/integration/test_room.cpp | 2 +- src/tests/integration/test_rpc.cpp | 2 +- src/tests/stress/test_audio_frame_stress.cpp | 2 +- src/tests/stress/test_room_stress.cpp | 4 +- src/tests/unit/test_audio_frame.cpp | 2 +- .../unit/test_audio_processing_module.cpp | 2 +- src/tests/unit/test_audio_source.cpp | 2 +- src/tests/unit/test_ffi_client.cpp | 2 +- src/tests/unit/test_room.cpp | 2 +- src/tests/unit/test_room_callbacks.cpp | 2 +- .../test_subscription_thread_dispatcher.cpp | 2 +- src/tests/unit/test_video_source.cpp | 2 +- 19 files changed, 21 insertions(+), 165 deletions(-) delete mode 100644 docs/doxygen/index.md diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 6fbae309..d39b17d4 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -58,7 +58,7 @@ env: # failing the build. SCCACHE_GHA_ENABLED: "true" # Pinned commit for cpp-example-collection smoke build (https://github.com/livekit-examples/cpp-example-collection) - CPP_EXAMPLE_COLLECTION_REF: 56815733a71c14692569e8adf2916a56a14d4882 + CPP_EXAMPLE_COLLECTION_REF: 361237b7dc52e939b0572aac14cc792678c5cc40 # vcpkg binary caching for Windows VCPKG_DEFAULT_TRIPLET: x64-windows-static-md VCPKG_DEFAULT_HOST_TRIPLET: x64-windows-static-md diff --git a/.github/workflows/docker-validate.yml b/.github/workflows/docker-validate.yml index ffd0d121..4b3bb728 100644 --- a/.github/workflows/docker-validate.yml +++ b/.github/workflows/docker-validate.yml @@ -11,7 +11,7 @@ permissions: env: # Pinned commit for cpp-example-collection smoke build (https://github.com/livekit-examples/cpp-example-collection) - CPP_EXAMPLE_COLLECTION_REF: 56815733a71c14692569e8adf2916a56a14d4882 + CPP_EXAMPLE_COLLECTION_REF: 361237b7dc52e939b0572aac14cc792678c5cc40 jobs: validate-x64: diff --git a/cpp-example-collection b/cpp-example-collection index 56815733..361237b7 160000 --- a/cpp-example-collection +++ b/cpp-example-collection @@ -1 +1 @@ -Subproject commit 56815733a71c14692569e8adf2916a56a14d4882 +Subproject commit 361237b7dc52e939b0572aac14cc792678c5cc40 diff --git a/docs/doxygen/index.md b/docs/doxygen/index.md deleted file mode 100644 index 56df9d37..00000000 --- a/docs/doxygen/index.md +++ /dev/null @@ -1,135 +0,0 @@ -# Overview - -Build real-time audio/video applications in C++ with LiveKit. - -## Quick Start - -```cpp -#include "livekit/livekit.h" - -bool initializeLivekit(const std::string& url, const std::string& token) { - // Init LiveKit - livekit::initialize(livekit::LogLevel::Info, livekit::LogSink::kConsole); - - room_ = std::make_unique(); - livekit::RoomOptions options; - options.auto_subscribe = true; - options.dynacast = false; - if (!room_->connect(url, token, options)) { - std::cerr << "Failed to connect\n"; - livekit::shutdown(); - return false; - } - - std::cout << "Connected.\n"; - - // ---- Create & publish AUDIO ---- - // Note: Hook up your own audio capture flow to |audioSource_| - audioSource_ = std::make_shared(48000, 1, 10); - auto audioTrack = livekit::LocalAudioTrack::createLocalAudioTrack("noise", audioSource_); - - livekit::TrackPublishOptions audioOpts; - audioOpts.source = livekit::TrackSource::SOURCE_MICROPHONE; - - try { - audioPub_ = room_->localParticipant()->publishTrack(audioTrack, audioOpts); - std::cout << "Published audio: sid=" << audioPub_->sid() << "\n"; - } catch (const std::exception& e) { - std::cerr << "Failed to publish audio: " << e.what() << "\n"; - return false; - } - - // ---- Create & publish VIDEO ---- - // Note: Hook up your own video capture flow to |videoSource_| - videoSource_ = std::make_shared(1280, 720); - auto videoTrack = livekit::LocalVideoTrack::createLocalVideoTrack("rgb", videoSource_); - - livekit::TrackPublishOptions videoOpts; - videoOpts.source = livekit::TrackSource::SOURCE_CAMERA; - - try { - videoPub_ = room_->localParticipant()->publishTrack(videoTrack, videoOpts); - std::cout << "Published video: sid=" << videoPub_->sid() << "\n"; - } catch (const std::exception& e) { - std::cerr << "Failed to publish video: " << e.what() << "\n"; - return false; - } - return true; -} - -void shutdownLivekit() { - // Best-effort unpublish - try { - if (room_ && audioPub_) - room_->localParticipant()->unpublishTrack(audioPub_->sid()); - if (room_ && videoPub_) - room_->localParticipant()->unpublishTrack(videoPub_->sid()); - } catch (...) { - } - - audioPub_.reset(); - videoPub_.reset(); - audioSource_.reset(); - videoSource_.reset(); - room_.reset(); - - livekit::shutdown(); -} -``` - -## Key Classes - -| Class | Description | -|-------|-------------| -| @ref livekit::Room | Main entry point - connect to a LiveKit room | -| @ref livekit::RoomOptions | Configuration for room connection (auto_subscribe, dynacast, etc.) | -| @ref livekit::LocalParticipant | The local user - publish tracks and send data | -| @ref livekit::RemoteParticipant | Other participants in the room | -| @ref livekit::AudioSource | Audio input source for publishing (sample rate, channels) | -| @ref livekit::VideoSource | Video input source for publishing (width, height) | -| @ref livekit::LocalAudioTrack | Local audio track created from AudioSource | -| @ref livekit::LocalVideoTrack | Local video track created from VideoSource | -| @ref livekit::LocalTrackPublication | Handle to a published local track | -| @ref livekit::TrackPublishOptions | Options for publishing (source type, codec, etc.) | -| @ref livekit::AudioStream | Receive audio from remote participants | -| @ref livekit::VideoStream | Receive video from remote participants | -| @ref livekit::RoomDelegate | Callbacks for room events | - -## Installation - -See the [GitHub README](https://github.com/livekit/client-sdk-cpp#readme) for build instructions. - -**Requirements:** - -- CMake ≥ 3.20 -- Rust/Cargo (latest stable) -- Platform: Windows, macOS, or Linux - -## Examples - -**Getting started** - -- [SimpleRoom](https://github.com/livekit-examples/cpp-example-collection/tree/main/simple_room) - Minimal room connection that publishes audio and video. -- [BasicRoom](https://github.com/livekit-examples/cpp-example-collection/tree/main/basic_room) - Publishes synthetic noise audio plus an RGB test pattern with capture loops; runs until Ctrl-C. -- [HelloLiveKit](https://github.com/livekit-examples/cpp-example-collection/tree/main/hello_livekit) - Two-process sender/receiver demo of publishing video and a data track from one app and subscribing in another. - -**Logging** - -- [LoggingLevels](https://github.com/livekit-examples/cpp-example-collection/tree/main/logging_levels) - Demonstrates @ref livekit::setLogLevel() and @ref livekit::setLogCallback(), including custom sinks for redirecting SDK logs. - -**RPC and data** - -- [SimpleRpc](https://github.com/livekit-examples/cpp-example-collection/tree/main/simple_rpc) - Remote procedure calls between participants. -- [SimpleDataStream](https://github.com/livekit-examples/cpp-example-collection/tree/main/simple_data_stream) - Send and receive text and binary data streams. -- [PingPong](https://github.com/livekit-examples/cpp-example-collection/tree/main/ping_pong) - Two-process round-trip over data tracks that prints RTT and one-way latency metrics. -- [SimpleJoystick](https://github.com/livekit-examples/cpp-example-collection/tree/main/simple_joystick) - Interactive sender/receiver: keyboard-driven joystick commands delivered via RPC, with auto-reconnect. - -**Advanced video** - -- [UserTimestampedVideo](https://github.com/livekit-examples/cpp-example-collection/tree/main/user_timestamped_video) - Producer/consumer pair showing per-frame `VideoFrameMetadata::user_timestamp_us` and the rich `setOnVideoFrameEventCallback` vs. legacy `setOnVideoFrameCallback` paths. - -## Resources - -- [GitHub Repository](https://github.com/livekit/client-sdk-cpp) -- [LiveKit Documentation](https://docs.livekit.io/) -- [Community Slack](https://livekit.io/join-slack) diff --git a/include/livekit/livekit.h b/include/livekit/livekit.h index d5ea02f5..e02ce67e 100644 --- a/include/livekit/livekit.h +++ b/include/livekit/livekit.h @@ -44,14 +44,6 @@ /// @brief Public API for the LiveKit C++ Client SDK. namespace livekit { -/// The log sink to use for SDK messages. -enum class LogSink { - /// Log messages to the console. - kConsole = 0, - /// Log messages to a callback function. - kCallback = 1, -}; - /// Initialize the LiveKit SDK. /// /// This **must be the first LiveKit API called** in the process. @@ -59,10 +51,9 @@ enum class LogSink { /// /// @param level Minimum log level for SDK messages (default: Info). /// Use setLogLevel() to change at runtime. -/// @param log_sink The log sink to use for SDK messages (default: Console). /// @returns true if initialization happened on this call, false if it was /// already initialized. -LIVEKIT_API bool initialize(const LogLevel& level = LogLevel::Info, const LogSink& log_sink = LogSink::kConsole); +LIVEKIT_API bool initialize(const LogLevel& level = LogLevel::Info); /// Shut down the LiveKit SDK. /// diff --git a/src/livekit.cpp b/src/livekit.cpp index 1417213e..1db9bae5 100644 --- a/src/livekit.cpp +++ b/src/livekit.cpp @@ -21,11 +21,11 @@ namespace livekit { -bool initialize(const LogLevel& level, const LogSink& log_sink) { +bool initialize(const LogLevel& level) { // Initializes logger if singleton instance is not already initialized setLogLevel(level); - auto& ffi_client = FfiClient::instance(); - return ffi_client.initialize(log_sink == LogSink::kCallback); + // Note: capture_logs currently disabled, requires event support in FfiClient + return FfiClient::instance().initialize(false); } bool isInitialized() { return FfiClient::instance().isInitialized(); } diff --git a/src/tests/common/test_common.h b/src/tests/common/test_common.h index 6fd68a67..f484dd76 100644 --- a/src/tests/common/test_common.h +++ b/src/tests/common/test_common.h @@ -456,7 +456,7 @@ class StressTestStats { class LiveKitTestBase : public ::testing::Test { protected: void SetUp() override { - livekit::initialize(livekit::LogLevel::Info, livekit::LogSink::kConsole); + livekit::initialize(livekit::LogLevel::Info); config_ = TestConfig::fromEnv(); // Tracing is controlled by compile-time macro LIVEKIT_TEST_ENABLE_TRACING diff --git a/src/tests/integration/test_room.cpp b/src/tests/integration/test_room.cpp index 9fb2490d..473afd81 100644 --- a/src/tests/integration/test_room.cpp +++ b/src/tests/integration/test_room.cpp @@ -23,7 +23,7 @@ namespace livekit::test { class RoomTest : public ::testing::Test { protected: void SetUp() override { - livekit::initialize(livekit::LogLevel::Info, livekit::LogSink::kConsole); + livekit::initialize(livekit::LogLevel::Info); const char* url_env = std::getenv("LIVEKIT_URL"); const char* token_env = std::getenv("LIVEKIT_TOKEN_A"); diff --git a/src/tests/integration/test_rpc.cpp b/src/tests/integration/test_rpc.cpp index 18353244..ea0e4025 100644 --- a/src/tests/integration/test_rpc.cpp +++ b/src/tests/integration/test_rpc.cpp @@ -93,7 +93,7 @@ std::string generateRandomPayload(size_t size) { class RpcIntegrationTest : public ::testing::Test { protected: void SetUp() override { - livekit::initialize(livekit::LogLevel::Info, livekit::LogSink::kConsole); + livekit::initialize(livekit::LogLevel::Info); config_ = RpcTestConfig::fromEnv(); } diff --git a/src/tests/stress/test_audio_frame_stress.cpp b/src/tests/stress/test_audio_frame_stress.cpp index 88f811d0..3d4e8550 100644 --- a/src/tests/stress/test_audio_frame_stress.cpp +++ b/src/tests/stress/test_audio_frame_stress.cpp @@ -27,7 +27,7 @@ namespace livekit::test { class AudioFrameStressTest : public ::testing::Test { protected: - void SetUp() override { livekit::initialize(livekit::LogLevel::Info, livekit::LogSink::kConsole); } + void SetUp() override { livekit::initialize(livekit::LogLevel::Info); } void TearDown() override { livekit::shutdown(); } }; diff --git a/src/tests/stress/test_room_stress.cpp b/src/tests/stress/test_room_stress.cpp index 0174f315..22792e82 100644 --- a/src/tests/stress/test_room_stress.cpp +++ b/src/tests/stress/test_room_stress.cpp @@ -27,7 +27,7 @@ namespace livekit::test { class RoomStressTest : public ::testing::Test { protected: - void SetUp() override { livekit::initialize(livekit::LogLevel::Info, livekit::LogSink::kConsole); } + void SetUp() override { livekit::initialize(livekit::LogLevel::Info); } void TearDown() override { livekit::shutdown(); } }; @@ -176,7 +176,7 @@ TEST_F(RoomStressTest, StreamHandlerRegistrationStress) { class RoomServerStressTest : public ::testing::Test { protected: void SetUp() override { - livekit::initialize(livekit::LogLevel::Info, livekit::LogSink::kConsole); + livekit::initialize(livekit::LogLevel::Info); const char* url_env = std::getenv("LIVEKIT_URL"); const char* token_env = std::getenv("LIVEKIT_TOKEN_A"); diff --git a/src/tests/unit/test_audio_frame.cpp b/src/tests/unit/test_audio_frame.cpp index 935a620e..312f0e61 100644 --- a/src/tests/unit/test_audio_frame.cpp +++ b/src/tests/unit/test_audio_frame.cpp @@ -22,7 +22,7 @@ namespace livekit::test { class AudioFrameTest : public ::testing::Test { protected: - void SetUp() override { livekit::initialize(livekit::LogLevel::Info, livekit::LogSink::kConsole); } + void SetUp() override { livekit::initialize(livekit::LogLevel::Info); } void TearDown() override { livekit::shutdown(); } }; diff --git a/src/tests/unit/test_audio_processing_module.cpp b/src/tests/unit/test_audio_processing_module.cpp index 304dbb9f..62d86d65 100644 --- a/src/tests/unit/test_audio_processing_module.cpp +++ b/src/tests/unit/test_audio_processing_module.cpp @@ -32,7 +32,7 @@ namespace livekit::test { class AudioProcessingModuleTest : public ::testing::Test { protected: - void SetUp() override { livekit::initialize(livekit::LogLevel::Info, livekit::LogSink::kConsole); } + void SetUp() override { livekit::initialize(livekit::LogLevel::Info); } void TearDown() override { livekit::shutdown(); } diff --git a/src/tests/unit/test_audio_source.cpp b/src/tests/unit/test_audio_source.cpp index a201ca9c..9a6e9f1e 100644 --- a/src/tests/unit/test_audio_source.cpp +++ b/src/tests/unit/test_audio_source.cpp @@ -22,7 +22,7 @@ namespace livekit::test { class AudioSourceTest : public ::testing::Test { protected: - void SetUp() override { livekit::initialize(livekit::LogLevel::Info, livekit::LogSink::kConsole); } + void SetUp() override { livekit::initialize(livekit::LogLevel::Info); } void TearDown() override { livekit::shutdown(); } }; diff --git a/src/tests/unit/test_ffi_client.cpp b/src/tests/unit/test_ffi_client.cpp index 79f74263..d240654b 100644 --- a/src/tests/unit/test_ffi_client.cpp +++ b/src/tests/unit/test_ffi_client.cpp @@ -56,7 +56,7 @@ TEST_F(FfiClientTest, Initialize) { } TEST_F(FfiClientTest, InitializeFromSDK) { - EXPECT_TRUE(livekit::initialize(livekit::LogLevel::Info, livekit::LogSink::kConsole)); + EXPECT_TRUE(livekit::initialize(livekit::LogLevel::Info)); EXPECT_TRUE(FfiClient::instance().isInitialized()); } diff --git a/src/tests/unit/test_room.cpp b/src/tests/unit/test_room.cpp index 18c6f222..dad4c710 100644 --- a/src/tests/unit/test_room.cpp +++ b/src/tests/unit/test_room.cpp @@ -21,7 +21,7 @@ namespace livekit::test { class RoomTest : public ::testing::Test { protected: - void SetUp() override { livekit::initialize(livekit::LogLevel::Info, livekit::LogSink::kConsole); } + void SetUp() override { livekit::initialize(livekit::LogLevel::Info); } void TearDown() override { livekit::shutdown(); } }; diff --git a/src/tests/unit/test_room_callbacks.cpp b/src/tests/unit/test_room_callbacks.cpp index feee6a3c..8c4a5e0b 100644 --- a/src/tests/unit/test_room_callbacks.cpp +++ b/src/tests/unit/test_room_callbacks.cpp @@ -29,7 +29,7 @@ namespace livekit { class RoomCallbackTest : public ::testing::Test { protected: - void SetUp() override { livekit::initialize(livekit::LogLevel::Info, livekit::LogSink::kConsole); } + void SetUp() override { livekit::initialize(livekit::LogLevel::Info); } void TearDown() override { livekit::shutdown(); } }; diff --git a/src/tests/unit/test_subscription_thread_dispatcher.cpp b/src/tests/unit/test_subscription_thread_dispatcher.cpp index 7840c666..0c38c5dd 100644 --- a/src/tests/unit/test_subscription_thread_dispatcher.cpp +++ b/src/tests/unit/test_subscription_thread_dispatcher.cpp @@ -28,7 +28,7 @@ namespace livekit { class SubscriptionThreadDispatcherTest : public ::testing::Test { protected: - void SetUp() override { livekit::initialize(livekit::LogLevel::Info, livekit::LogSink::kConsole); } + void SetUp() override { livekit::initialize(livekit::LogLevel::Info); } void TearDown() override { livekit::shutdown(); } diff --git a/src/tests/unit/test_video_source.cpp b/src/tests/unit/test_video_source.cpp index f1ae4f79..4d481d4c 100644 --- a/src/tests/unit/test_video_source.cpp +++ b/src/tests/unit/test_video_source.cpp @@ -22,7 +22,7 @@ namespace livekit::test { class VideoSourceTest : public ::testing::Test { protected: - void SetUp() override { livekit::initialize(livekit::LogLevel::Info, livekit::LogSink::kConsole); } + void SetUp() override { livekit::initialize(livekit::LogLevel::Info); } void TearDown() override { livekit::shutdown(); } };