From 16234432ad682b7b880e6a6083408e2bf11cf011 Mon Sep 17 00:00:00 2001 From: Stephen DeRosa Date: Wed, 18 Mar 2026 19:57:54 -0600 Subject: [PATCH 1/2] include lk_log.h inside livekit.h --- CMakeLists.txt | 3 ++- .../include/livekit_bridge/livekit_bridge.h | 1 + bridge/src/bridge_audio_track.cpp | 2 +- bridge/src/bridge_video_track.cpp | 2 +- bridge/src/livekit_bridge.cpp | 2 -- build.sh | 22 +++++++++++++++++++ cmake/LiveKitConfig.cmake.in | 3 +++ examples/bridge_human_robot/human.cpp | 1 - examples/bridge_human_robot/robot.cpp | 1 - examples/common/sdl_media.cpp | 2 +- examples/common/sdl_media_manager.cpp | 2 +- examples/common/sdl_video_renderer.cpp | 2 +- examples/logging_levels/basic_usage.cpp | 2 +- examples/simple_room/fallback_capture.cpp | 1 - examples/simple_room/main.cpp | 1 - include/livekit/livekit.h | 1 + {src => include/livekit}/lk_log.h | 0 src/audio_source.cpp | 2 +- src/data_stream.cpp | 2 +- src/ffi_client.cpp | 2 +- src/livekit.cpp | 2 +- src/room.cpp | 2 +- src/tests/CMakeLists.txt | 1 - src/tests/integration/test_logging.cpp | 2 +- src/video_frame.cpp | 2 +- src/video_stream.cpp | 2 +- 26 files changed, 43 insertions(+), 22 deletions(-) rename {src => include/livekit}/lk_log.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 39d06fad..47cd6468 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -372,10 +372,11 @@ target_include_directories(livekit ) target_link_libraries(livekit + PUBLIC + $ PRIVATE livekit_ffi ${LIVEKIT_PROTOBUF_TARGET} - spdlog::spdlog ) target_compile_definitions(livekit diff --git a/bridge/include/livekit_bridge/livekit_bridge.h b/bridge/include/livekit_bridge/livekit_bridge.h index f366c10d..7f152597 100644 --- a/bridge/include/livekit_bridge/livekit_bridge.h +++ b/bridge/include/livekit_bridge/livekit_bridge.h @@ -23,6 +23,7 @@ #include "livekit_bridge/bridge_video_track.h" #include "livekit_bridge/rpc_constants.h" +#include "livekit/lk_log.h" #include "livekit/local_participant.h" #include "livekit/room.h" #include "livekit/rpc_error.h" diff --git a/bridge/src/bridge_audio_track.cpp b/bridge/src/bridge_audio_track.cpp index 654129cc..66577145 100644 --- a/bridge/src/bridge_audio_track.cpp +++ b/bridge/src/bridge_audio_track.cpp @@ -27,7 +27,7 @@ #include -#include "lk_log.h" +#include "livekit/lk_log.h" namespace livekit_bridge { diff --git a/bridge/src/bridge_video_track.cpp b/bridge/src/bridge_video_track.cpp index d78d2322..bb763422 100644 --- a/bridge/src/bridge_video_track.cpp +++ b/bridge/src/bridge_video_track.cpp @@ -27,7 +27,7 @@ #include -#include "lk_log.h" +#include "livekit/lk_log.h" namespace livekit_bridge { diff --git a/bridge/src/livekit_bridge.cpp b/bridge/src/livekit_bridge.cpp index b6c495c1..809aae6a 100644 --- a/bridge/src/livekit_bridge.cpp +++ b/bridge/src/livekit_bridge.cpp @@ -39,8 +39,6 @@ #include #include -#include "lk_log.h" - namespace livekit_bridge { // --------------------------------------------------------------- diff --git a/build.sh b/build.sh index 278cea55..e3b02d6a 100755 --- a/build.sh +++ b/build.sh @@ -37,6 +37,7 @@ Commands: release Configure + build Release version (build-release/) release-examples Configure + build Release version with examples release-tests Configure + build Release version with tests + build-all Configure + build all of the above (debug/release + examples + tests) clean Clean both Debug and Release build directories clean-all Full clean (build dirs + Rust targets) help Show this help message @@ -60,6 +61,7 @@ Examples: ./build.sh debug ./build.sh debug-tests ./build.sh release-tests + ./build.sh build-all ./build.sh clean ./build.sh clean-all EOF @@ -401,6 +403,26 @@ case "${cmd}" in fi fi ;; + build-all) + echo "==> Build-all: debug, debug-examples, debug-tests, release, release-examples, release-tests" + BUILD_TYPE="Debug" + BUILD_DIR="${PROJECT_ROOT}/build-debug" + PRESET="${OS_TYPE}-debug" + configure && build + PRESET="${OS_TYPE}-debug-examples" + configure && build + PRESET="${OS_TYPE}-debug-tests" + configure && build + BUILD_TYPE="Release" + BUILD_DIR="${PROJECT_ROOT}/build-release" + PRESET="${OS_TYPE}-release" + configure && build + PRESET="${OS_TYPE}-release-examples" + configure && build + PRESET="${OS_TYPE}-release-tests" + configure && build + echo "==> Build-all complete." + ;; clean) clean ;; diff --git a/cmake/LiveKitConfig.cmake.in b/cmake/LiveKitConfig.cmake.in index b5805e4d..90b1a7e1 100644 --- a/cmake/LiveKitConfig.cmake.in +++ b/cmake/LiveKitConfig.cmake.in @@ -1,4 +1,7 @@ @PACKAGE_INIT@ +include(CMakeFindDependencyMacro) +find_dependency(spdlog) + include("${CMAKE_CURRENT_LIST_DIR}/LiveKitTargets.cmake") diff --git a/examples/bridge_human_robot/human.cpp b/examples/bridge_human_robot/human.cpp index 434deca6..e323f76b 100644 --- a/examples/bridge_human_robot/human.cpp +++ b/examples/bridge_human_robot/human.cpp @@ -47,7 +47,6 @@ #include "livekit/track.h" #include "livekit/video_frame.h" #include "livekit_bridge/livekit_bridge.h" -#include "lk_log.h" #include "sdl_media.h" #include diff --git a/examples/bridge_human_robot/robot.cpp b/examples/bridge_human_robot/robot.cpp index 18d07b92..041580ef 100644 --- a/examples/bridge_human_robot/robot.cpp +++ b/examples/bridge_human_robot/robot.cpp @@ -37,7 +37,6 @@ #include "livekit/track.h" #include "livekit/video_frame.h" #include "livekit_bridge/livekit_bridge.h" -#include "lk_log.h" #include "sdl_media.h" #include diff --git a/examples/common/sdl_media.cpp b/examples/common/sdl_media.cpp index 6975aca0..d4a44e63 100644 --- a/examples/common/sdl_media.cpp +++ b/examples/common/sdl_media.cpp @@ -16,7 +16,7 @@ #include "sdl_media.h" -#include "lk_log.h" +#include "livekit/lk_log.h" // ---------------------- SDLMicSource ----------------------------- diff --git a/examples/common/sdl_media_manager.cpp b/examples/common/sdl_media_manager.cpp index 93dc0d45..f44c60ae 100644 --- a/examples/common/sdl_media_manager.cpp +++ b/examples/common/sdl_media_manager.cpp @@ -18,7 +18,7 @@ #include "fallback_capture.h" #include "livekit/livekit.h" -#include "lk_log.h" +#include "livekit/lk_log.h" #include "sdl_media.h" #include "sdl_video_renderer.h" #include diff --git a/examples/common/sdl_video_renderer.cpp b/examples/common/sdl_video_renderer.cpp index b820f539..5ba2cd72 100644 --- a/examples/common/sdl_video_renderer.cpp +++ b/examples/common/sdl_video_renderer.cpp @@ -17,7 +17,7 @@ #include "sdl_video_renderer.h" #include "livekit/livekit.h" -#include "lk_log.h" +#include "livekit/lk_log.h" #include using namespace livekit; diff --git a/examples/logging_levels/basic_usage.cpp b/examples/logging_levels/basic_usage.cpp index 657f6c3d..8c0b0314 100644 --- a/examples/logging_levels/basic_usage.cpp +++ b/examples/logging_levels/basic_usage.cpp @@ -35,7 +35,7 @@ /// see which messages are filtered at each setting. #include "livekit/livekit.h" -#include "lk_log.h" +#include "livekit/lk_log.h" #include #include diff --git a/examples/simple_room/fallback_capture.cpp b/examples/simple_room/fallback_capture.cpp index 29508e34..26269886 100644 --- a/examples/simple_room/fallback_capture.cpp +++ b/examples/simple_room/fallback_capture.cpp @@ -24,7 +24,6 @@ #include #include "livekit/livekit.h" -#include "lk_log.h" #include "wav_audio_source.h" using namespace livekit; diff --git a/examples/simple_room/main.cpp b/examples/simple_room/main.cpp index 90761857..4b2e2e16 100644 --- a/examples/simple_room/main.cpp +++ b/examples/simple_room/main.cpp @@ -27,7 +27,6 @@ #include #include "livekit/livekit.h" -#include "lk_log.h" #include "sdl_media_manager.h" #include "wav_audio_source.h" diff --git a/include/livekit/livekit.h b/include/livekit/livekit.h index d6f3ec01..7d055725 100644 --- a/include/livekit/livekit.h +++ b/include/livekit/livekit.h @@ -22,6 +22,7 @@ #include "audio_stream.h" #include "build.h" #include "e2ee.h" +#include "lk_log.h" #include "local_audio_track.h" #include "local_participant.h" #include "local_track_publication.h" diff --git a/src/lk_log.h b/include/livekit/lk_log.h similarity index 100% rename from src/lk_log.h rename to include/livekit/lk_log.h diff --git a/src/audio_source.cpp b/src/audio_source.cpp index 4e1a48a1..bc648e50 100644 --- a/src/audio_source.cpp +++ b/src/audio_source.cpp @@ -24,7 +24,7 @@ #include "ffi.pb.h" #include "ffi_client.h" #include "livekit/audio_frame.h" -#include "lk_log.h" +#include "livekit/lk_log.h" namespace livekit { diff --git a/src/data_stream.cpp b/src/data_stream.cpp index 3376466a..9841a902 100644 --- a/src/data_stream.cpp +++ b/src/data_stream.cpp @@ -6,8 +6,8 @@ #include #include "ffi_client.h" +#include "livekit/lk_log.h" #include "livekit/local_participant.h" -#include "lk_log.h" #include "room.pb.h" namespace livekit { diff --git a/src/ffi_client.cpp b/src/ffi_client.cpp index 916ab88a..eba73821 100644 --- a/src/ffi_client.cpp +++ b/src/ffi_client.cpp @@ -22,11 +22,11 @@ #include "livekit/build.h" #include "livekit/e2ee.h" #include "livekit/ffi_handle.h" +#include "livekit/lk_log.h" #include "livekit/room.h" #include "livekit/rpc_error.h" #include "livekit/track.h" #include "livekit_ffi.h" -#include "lk_log.h" #include "room.pb.h" #include "room_proto_converter.h" diff --git a/src/livekit.cpp b/src/livekit.cpp index b9132efc..86b9ebd6 100644 --- a/src/livekit.cpp +++ b/src/livekit.cpp @@ -16,7 +16,7 @@ #include "livekit/livekit.h" #include "ffi_client.h" -#include "lk_log.h" +#include "livekit/lk_log.h" namespace livekit { diff --git a/src/room.cpp b/src/room.cpp index 7eed7ed9..6e464079 100644 --- a/src/room.cpp +++ b/src/room.cpp @@ -30,8 +30,8 @@ #include "ffi.pb.h" #include "ffi_client.h" +#include "livekit/lk_log.h" #include "livekit_ffi.h" -#include "lk_log.h" #include "room.pb.h" #include "room_proto_converter.h" #include "track.pb.h" diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index af6aed18..6ff68ef9 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -41,7 +41,6 @@ if(INTEGRATION_TEST_SOURCES) target_link_libraries(livekit_integration_tests PRIVATE livekit - spdlog::spdlog GTest::gtest_main GTest::gmock ) diff --git a/src/tests/integration/test_logging.cpp b/src/tests/integration/test_logging.cpp index 88e16166..5ccb0fa1 100644 --- a/src/tests/integration/test_logging.cpp +++ b/src/tests/integration/test_logging.cpp @@ -17,7 +17,7 @@ #include #include -#include "lk_log.h" +#include "livekit/lk_log.h" #include #include diff --git a/src/video_frame.cpp b/src/video_frame.cpp index 5fdc83e2..271c5ce5 100644 --- a/src/video_frame.cpp +++ b/src/video_frame.cpp @@ -6,7 +6,7 @@ #include #include "livekit/ffi_handle.h" -#include "lk_log.h" +#include "livekit/lk_log.h" #include "video_utils.h" namespace livekit { diff --git a/src/video_stream.cpp b/src/video_stream.cpp index 182617e3..657d4db1 100644 --- a/src/video_stream.cpp +++ b/src/video_stream.cpp @@ -4,8 +4,8 @@ #include "ffi.pb.h" #include "ffi_client.h" +#include "livekit/lk_log.h" #include "livekit/track.h" -#include "lk_log.h" #include "video_frame.pb.h" #include "video_utils.h" From 30e6d11ebfc52fbde7836e378a9df44051cad1d4 Mon Sep 17 00:00:00 2001 From: Stephen DeRosa Date: Wed, 18 Mar 2026 20:00:04 -0600 Subject: [PATCH 2/2] rpc_constants.cpp --- .gitignore | 1 + CMakeLists.txt | 1 - bridge/CMakeLists.txt | 1 + bridge/include/livekit_bridge/rpc_constants.h | 21 +++------- bridge/src/rpc_constants.cpp | 41 +++++++++++++++++++ 5 files changed, 49 insertions(+), 16 deletions(-) create mode 100644 bridge/src/rpc_constants.cpp diff --git a/.gitignore b/.gitignore index 8a37fba5..46a7e1f7 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,4 @@ lib/ *.dll *.exe livekit.log +web/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 47cd6468..a7a312d9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,6 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") option(LIVEKIT_BUILD_EXAMPLES "Build LiveKit examples" OFF) option(LIVEKIT_BUILD_TESTS "Build LiveKit tests" OFF) -option(LIVEKIT_BUILD_BRIDGE "Build LiveKit Bridge (simplified high-level API)" OFF) # vcpkg is only used on Windows; Linux/macOS use system package managers if(WIN32) diff --git a/bridge/CMakeLists.txt b/bridge/CMakeLists.txt index 25d88aa0..1d045a19 100644 --- a/bridge/CMakeLists.txt +++ b/bridge/CMakeLists.txt @@ -11,6 +11,7 @@ add_library(livekit_bridge SHARED src/bridge_video_track.cpp src/bridge_room_delegate.cpp src/bridge_room_delegate.h + src/rpc_constants.cpp src/rpc_controller.cpp src/rpc_controller.h ) diff --git a/bridge/include/livekit_bridge/rpc_constants.h b/bridge/include/livekit_bridge/rpc_constants.h index 4bd81093..3511239f 100644 --- a/bridge/include/livekit_bridge/rpc_constants.h +++ b/bridge/include/livekit_bridge/rpc_constants.h @@ -34,29 +34,20 @@ namespace track_control { enum class Action { kActionMute, kActionUnmute }; /// RPC method name registered by the bridge for remote track control. -constexpr const char *kMethod = "lk.bridge.track-control"; +extern const char *const kMethod; /// Payload action strings. -constexpr const char *kActionMute = "mute"; -constexpr const char *kActionUnmute = "unmute"; +extern const char *const kActionMute; +extern const char *const kActionUnmute; /// Delimiter between action and track name in the payload (e.g. "mute:cam"). -constexpr char kDelimiter = ':'; +extern const char kDelimiter; /// Response payload returned on success. -constexpr const char *kResponseOk = "ok"; +extern const char *const kResponseOk; /// Build a track-control RPC payload: ":". -inline std::string formatPayload(const char *action, - const std::string &track_name) { - std::string payload; - payload.reserve(std::char_traits::length(action) + 1 + - track_name.size()); - payload += action; - payload += kDelimiter; - payload += track_name; - return payload; -} +std::string formatPayload(const char *action, const std::string &track_name); } // namespace track_control } // namespace rpc diff --git a/bridge/src/rpc_constants.cpp b/bridge/src/rpc_constants.cpp new file mode 100644 index 00000000..03386fe9 --- /dev/null +++ b/bridge/src/rpc_constants.cpp @@ -0,0 +1,41 @@ +/* + * Copyright 2026 LiveKit + * + * 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 + * + * http://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 "livekit_bridge/rpc_constants.h" + +namespace livekit_bridge { +namespace rpc { +namespace track_control { + +const char *const kMethod = "lk.bridge.track-control"; +const char *const kActionMute = "mute"; +const char *const kActionUnmute = "unmute"; +const char kDelimiter = ':'; +const char *const kResponseOk = "ok"; + +std::string formatPayload(const char *action, const std::string &track_name) { + std::string payload; + payload.reserve(std::char_traits::length(action) + 1 + + track_name.size()); + payload += action; + payload += kDelimiter; + payload += track_name; + return payload; +} + +} // namespace track_control +} // namespace rpc +} // namespace livekit_bridge