Skip to content

Draft - Add clang-tidy support in GHA#88

Open
alan-george-lk wants to merge 15 commits intomainfrom
feature/clang-tidy
Open

Draft - Add clang-tidy support in GHA#88
alan-george-lk wants to merge 15 commits intomainfrom
feature/clang-tidy

Conversation

@alan-george-lk
Copy link
Copy Markdown
Contributor

No description provided.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 8, 2026

CLA assistant check
All committers have signed the CLA.

@alan-george-lk alan-george-lk force-pushed the feature/clang-tidy branch 3 times, most recently from 4fb7db7 to e53271c Compare April 8, 2026 19:26
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 9, 2026

Cpp-Linter Report ⚠️

Some files did not pass the configured checks!

clang-tidy (v20.1.2) reports: 332 concern(s)
  • examples/bridge_human_robot/human.cpp:74:12: warning: [performance-enum-size]

    enum 'SelectedSource' uses a larger base type ('int', size: 4 bytes) than necessary for its value set, consider using 'std::uint8_t' (1 byte) as the base type to reduce its size

       74 | enum class SelectedSource : int { Webcam = 0, SimFrame = 1 };
          |            ^
  • examples/bridge_human_robot/human.cpp:359:25: warning: [bugprone-implicit-widening-of-multiplication-result]

    result of multiplication in type 'int' is used as a pointer offset after an implicit widening conversion to type 'ptrdiff_t'

      359 |             std::memcpy(static_cast<std::uint8_t *>(pixels) + y * pitch,
          |                         ^
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/examples/bridge_human_robot/human.cpp:359:63: note: make conversion explicit to silence this warning
       62 |             std::memcpy(static_cast<std::uint8_t *>(pixels) + y * pitch,
          |                                                               ^~~~~~~~~
          |                                                               static_cast<ptrdiff_t>( )
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/examples/bridge_human_robot/human.cpp:359:63: note: perform multiplication in a wider type
      359 |             std::memcpy(static_cast<std::uint8_t *>(pixels) + y * pitch,
          |                                                               ^        
          |                                                               static_cast<ptrdiff_t>( )
  • include/livekit/local_data_track.h:66:3: warning: [modernize-use-nodiscard]

    function 'info' should be marked [[nodiscard]]

       66 |   const DataTrackInfo &info() const noexcept { return info_; }
          |   ^
          |   [[nodiscard]] 
  • include/livekit/local_data_track.h:87:3: warning: [modernize-use-nodiscard]

    function 'isPublished' should be marked [[nodiscard]]

       87 |   bool isPublished() const;
          |   ^
          |   [[nodiscard]] 
  • include/livekit/local_data_track.h:101:3: warning: [modernize-use-nodiscard]

    function 'ffi_handle_id' should be marked [[nodiscard]]

      101 |   uintptr_t ffi_handle_id() const noexcept { return handle_.get(); }
          |   ^
          |   [[nodiscard]] 
  • src/tests/integration/test_subscription_thread_dispatcher.cpp:19:10: error: [clang-diagnostic-error]

    'gtest/gtest.h' file not found

       19 | #include <gtest/gtest.h>
          |          ^~~~~~~~~~~~~~~
  • src/audio_stream.cpp:127:42: error: [bugprone-narrowing-conversions]

    narrowing conversion from 'std::int64_t' (aka 'long') to signed type 'ListenerId' (aka 'int') is implementation-defined

      127 |     FfiClient::instance().RemoveListener(listener_id_);
          |                                          ^
  • include/livekit/logging.h:25:12: warning: [performance-enum-size]

    enum 'LogLevel' uses a larger base type ('int', size: 4 bytes) than necessary for its value set, consider using 'std::uint8_t' (1 byte) as the base type to reduce its size

       25 | enum class LogLevel {
          |            ^
  • bridge/src/bridge_audio_track.cpp:33:23: warning: [bugprone-easily-swappable-parameters]

    2 adjacent parameters of 'BridgeAudioTrack' of similar type ('int') are easily swapped by mistake

       33 |     std::string name, int sample_rate, int num_channels,
          |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/bridge/src/bridge_audio_track.cpp:33:27: note: the first parameter in the range is 'sample_rate'
       33 |     std::string name, int sample_rate, int num_channels,
          |                           ^~~~~~~~~~~
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/bridge/src/bridge_audio_track.cpp:33:44: note: the last parameter in the range is 'num_channels'
       33 |     std::string name, int sample_rate, int num_channels,
          |                                            ^~~~~~~~~~~~
  • bridge/src/bridge_audio_track.cpp:46:34: warning: [bugprone-easily-swappable-parameters]

    2 adjacent parameters of 'pushFrame' of similar type ('int') are easily swapped by mistake

       46 |                                  int samples_per_channel, int timeout_ms) {
          |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/bridge/src/bridge_audio_track.cpp:46:38: note: the first parameter in the range is 'samples_per_channel'
       46 |                                  int samples_per_channel, int timeout_ms) {
          |                                      ^~~~~~~~~~~~~~~~~~~
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/bridge/src/bridge_audio_track.cpp:46:63: note: the last parameter in the range is 'timeout_ms'
       46 |                                  int samples_per_channel, int timeout_ms) {
          |                                                               ^~~~~~~~~~
  • bridge/src/bridge_audio_track.cpp:65:34: warning: [bugprone-easily-swappable-parameters]

    2 adjacent parameters of 'pushFrame' of similar type ('int') are easily swapped by mistake

       65 |                                  int samples_per_channel, int timeout_ms) {
          |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/bridge/src/bridge_audio_track.cpp:65:38: note: the first parameter in the range is 'samples_per_channel'
       65 |                                  int samples_per_channel, int timeout_ms) {
          |                                      ^~~~~~~~~~~~~~~~~~~
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/bridge/src/bridge_audio_track.cpp:65:63: note: the last parameter in the range is 'timeout_ms'
       65 |                                  int samples_per_channel, int timeout_ms) {
          |                                                               ^~~~~~~~~~
  • src/tests/integration/test_data_track.cpp:37:1: warning: [modernize-concat-nested-namespaces]

    nested namespaces can be concatenated

       37 | namespace livekit {
          | ^~~~~~~~~~~~~~~~~~~
       38 | namespace test {
          | ~~~~~~~~~~~~~~
          | namespace livekit::test
  • src/tests/integration/test_data_track.cpp:92:46: warning: [bugprone-easily-swappable-parameters]

    2 adjacent parameters of 'waitForCondition' of similar type ('std::chrono::milliseconds') are easily swapped by mistake

       92 | bool waitForCondition(Predicate &&predicate, std::chrono::milliseconds timeout,
          |                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       93 |                       std::chrono::milliseconds interval = kPollingInterval) {
          |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/tests/integration/test_data_track.cpp:92:72: note: the first parameter in the range is 'timeout'
       92 | bool waitForCondition(Predicate &&predicate, std::chrono::milliseconds timeout,
          |                                                                        ^~~~~~~
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/tests/integration/test_data_track.cpp:93:49: note: the last parameter in the range is 'interval'
       93 |                       std::chrono::milliseconds interval = kPollingInterval) {
          |                                                 ^~~~~~~~
  • src/data_track_stream.cpp:84:42: error: [bugprone-narrowing-conversions]

    narrowing conversion from 'std::int64_t' (aka 'long') to signed type 'ListenerId' (aka 'int') is implementation-defined

       84 |     FfiClient::instance().RemoveListener(listener_id);
          |                                          ^
  • bridge/tests/test_livekit_bridge.cpp:20:10: error: [clang-diagnostic-error]

    'gtest/gtest.h' file not found

       20 | #include <gtest/gtest.h>
          |          ^~~~~~~~~~~~~~~
  • src/tests/integration/test_audio_processing_module.cpp:17:10: error: [clang-diagnostic-error]

    'gtest/gtest.h' file not found

       17 | #include <gtest/gtest.h>
          |          ^~~~~~~~~~~~~~~
  • src/tests/integration/test_audio_processing_module.cpp:31:1: warning: [modernize-concat-nested-namespaces]

    nested namespaces can be concatenated

       31 | namespace livekit {
          | ^~~~~~~~~~~~~~~~~~~
       32 | namespace test {
          | ~~~~~~~~~~~~~~
          | namespace livekit::test
  • src/tests/integration/test_audio_processing_module.cpp:67:48: warning: [bugprone-easily-swappable-parameters]

    2 adjacent parameters of 'fillWithNoise' of convertible types are easily swapped by mistake

       67 |   static void fillWithNoise(AudioFrame &frame, double amplitude = 5000.0,
          |                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~
       68 |                             unsigned int seed = 0) {
          |                             ~~~~~~~~~~~~~~~~~~~~~
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/tests/integration/test_audio_processing_module.cpp:67:55: note: the first parameter in the range is 'amplitude'
       67 |   static void fillWithNoise(AudioFrame &frame, double amplitude = 5000.0,
          |                                                       ^~~~~~~~~
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/tests/integration/test_audio_processing_module.cpp:68:42: note: the last parameter in the range is 'seed'
       68 |                             unsigned int seed = 0) {
          |                                          ^~~~
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/tests/integration/test_audio_processing_module.cpp:68:29: note: 'double' and 'unsigned int' may be implicitly converted
       68 |                             unsigned int seed = 0) {
          |                             ^
  • src/tests/integration/test_audio_processing_module.cpp:69:34: error: [bugprone-narrowing-conversions]

    narrowing conversion from 'result_type' (aka 'unsigned int') to signed type 'std::mt19937' (aka 'int') is implementation-defined

       69 |     std::mt19937 gen(seed == 0 ? std::random_device{}() : seed);
          |                                  ^
  • src/tests/integration/test_audio_processing_module.cpp:69:59: error: [bugprone-narrowing-conversions]

    narrowing conversion from 'unsigned int' to signed type 'std::mt19937' (aka 'int') is implementation-defined

       69 |     std::mt19937 gen(seed == 0 ? std::random_device{}() : seed);
          |                                                           ^
  • src/tests/integration/test_audio_processing_module.cpp:95:46: warning: [bugprone-easily-swappable-parameters]

    2 adjacent parameters of 'calculateFrequencyBandEnergy' of similar type ('double') are easily swapped by mistake

       95 |                                              double low_freq,
          |                                              ^~~~~~~~~~~~~~~~
       96 |                                              double high_freq) {
          |                                              ~~~~~~~~~~~~~~~~
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/tests/integration/test_audio_processing_module.cpp:95:53: note: the first parameter in the range is 'low_freq'
       95 |                                              double low_freq,
          |                                                     ^~~~~~~~
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/tests/integration/test_audio_processing_module.cpp:96:53: note: the last parameter in the range is 'high_freq'
       96 |                                              double high_freq) {
          |                                                     ^~~~~~~~~
  • src/tests/integration/test_audio_processing_module.cpp:144:27: warning: [bugprone-easily-swappable-parameters]

    3 adjacent parameters of 'readWavFile' of similar type ('int &') are easily swapped by mistake

      144 |                           std::vector<std::int16_t> &samples, int &sample_rate,
          |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      145 |                           int &num_channels) {
          |                           ~~~~~~~~~~~~~~~~~
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/tests/integration/test_audio_processing_module.cpp:144:54: note: the first parameter in the range is 'samples'
      144 |                           std::vector<std::int16_t> &samples, int &sample_rate,
          |                                                      ^~~~~~~
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/tests/integration/test_audio_processing_module.cpp:145:32: note: the last parameter in the range is 'num_channels'
      145 |                           int &num_channels) {
          |                                ^~~~~~~~~~~~
  • src/tests/integration/test_audio_processing_module.cpp:899:22: error: [bugprone-narrowing-conversions]

    narrowing conversion from 'unsigned int' to signed type 'std::mt19937' (aka 'int') is implementation-defined

      899 |     std::mt19937 gen(kSeed + 50 + i);
          |                      ^
  • src/lk_log.h:23:1: warning: [modernize-concat-nested-namespaces]

    nested namespaces can be concatenated

       23 | namespace livekit {
          | ^~~~~~~~~~~~~~~~~~~
       24 | namespace detail {
          | ~~~~~~~~~~~~~~~~
          | namespace livekit::detail
       25 | 
       26 | /// Returns the shared "livekit" logger instance.
       27 | /// The logger is created lazily on first access and lives until
       28 | /// shutdownLogger() is called.  Safe to call before initialize().
       29 | std::shared_ptr<spdlog::logger> getLogger();
       30 | 
       31 | /// Tears down the spdlog logger. Called by livekit::shutdown().
       32 | void shutdownLogger();
       33 | 
       34 | } // namespace detail
          | ~~~~~~~~~~~~~~~~~~~~~
          | } // namespace livekit::detail
       35 | } // namespace livekit
          | ~~~~~~~~~~~~~~~~~~~~~~
  • include/livekit/rpc_error.h:45:14: warning: [performance-enum-size]

    enum 'ErrorCode' uses a larger base type ('std::uint32_t' (aka 'unsigned int'), size: 4 bytes) than necessary for its value set, consider using 'std::uint16_t' (2 bytes) as the base type to reduce its size

       45 |   enum class ErrorCode : std::uint32_t {
          |              ^
  • include/livekit/rpc_error.h:85:3: warning: [modernize-use-nodiscard]

    function 'code' should be marked [[nodiscard]]

       85 |   std::uint32_t code() const noexcept;
          |   ^
          |   [[nodiscard]] 
  • include/livekit/rpc_error.h:90:3: warning: [modernize-use-nodiscard]

    function 'message' should be marked [[nodiscard]]

       90 |   const std::string &message() const noexcept;
          |   ^
          |   [[nodiscard]] 
  • include/livekit/rpc_error.h:96:3: warning: [modernize-use-nodiscard]

    function 'data' should be marked [[nodiscard]]

       96 |   const std::string &data() const noexcept;
          |   ^
          |   [[nodiscard]] 
  • include/livekit/rpc_error.h:109:3: warning: [modernize-use-nodiscard]

    function 'toProto' should be marked [[nodiscard]]

      109 |   proto::RpcError toProto() const;
          |   ^
          |   [[nodiscard]] 
  • src/tests/integration/test_sdk_initialization.cpp:17:10: error: [clang-diagnostic-error]

    'gtest/gtest.h' file not found

       17 | #include <gtest/gtest.h>
          |          ^~~~~~~~~~~~~~~
  • src/tests/integration/test_sdk_initialization.cpp:20:1: warning: [modernize-concat-nested-namespaces]

    nested namespaces can be concatenated

       20 | namespace livekit {
          | ^~~~~~~~~~~~~~~~~~~
       21 | namespace test {
          | ~~~~~~~~~~~~~~
          | namespace livekit::test
  • src/tests/common/test_common.h:24:10: error: [clang-diagnostic-error]

    'gtest/gtest.h' file not found

       24 | #include <gtest/gtest.h>
          |          ^~~~~~~~~~~~~~~
  • src/tests/common/test_common.h:37:1: warning: [modernize-concat-nested-namespaces]

    nested namespaces can be concatenated

       37 | namespace livekit {
          | ^~~~~~~~~~~~~~~~~~~
       38 | namespace test {
          | ~~~~~~~~~~~~~~
          | namespace livekit::test
  • src/tests/common/test_common.h:321:33: warning: [bugprone-easily-swappable-parameters]

    2 adjacent parameters of 'recordCall' of convertible types are easily swapped by mistake

      321 |   void recordCall(bool success, double latency_ms, size_t payload_size = 0) {
          |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/tests/common/test_common.h:321:40: note: the first parameter in the range is 'latency_ms'
      321 |   void recordCall(bool success, double latency_ms, size_t payload_size = 0) {
          |                                        ^~~~~~~~~~
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/tests/common/test_common.h:321:59: note: the last parameter in the range is 'payload_size'
      321 |   void recordCall(bool success, double latency_ms, size_t payload_size = 0) {
          |                                                           ^~~~~~~~~~~~
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/tests/common/test_common.h:321:33: note: 
      321 |   void recordCall(bool success, double latency_ms, size_t payload_size = 0) {
          |                                 ^
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/tests/common/test_common.h:321:52: note: 'double' and 'size_t' may be implicitly converted: 'double' -> 'size_t' (as 'unsigned long'), 'size_t' (as 'unsigned long') -> 'double'
      321 |   void recordCall(bool success, double latency_ms, size_t payload_size = 0) {
          |                                                    ^
  • src/tests/common/test_common.h:352:19: error: [bugprone-narrowing-conversions]

    narrowing conversion from 'size_t' (aka 'unsigned long') to 'double'

      352 |               << (total_bytes_ / (1024.0 * 1024.0)) << " MB)" << std::endl;
          |                   ^
  • src/local_data_track.cpp:62:5: warning: [bugprone-empty-catch]

    empty catch statements hide issues; to handle exceptions appropriately, consider re-throwing, handling, or avoiding catch altogether

       62 |   } catch (const std::exception &e) {
          |     ^
  • include/livekit/remote_audio_track.h:52:3: warning: [modernize-use-nodiscard]

    function 'to_string' should be marked [[nodiscard]]

       52 |   std::string to_string() const;
          |   ^
          |   [[nodiscard]] 
  • bridge/src/livekit_bridge.cpp:242:24: warning: [performance-unnecessary-value-param]

    the parameter 'callback' is copied for each invocation but only used as a const reference; consider making it a const reference

      242 |     AudioFrameCallback callback) {
          |                        ^
          |     const             &
  • bridge/src/livekit_bridge.cpp:255:24: warning: [performance-unnecessary-value-param]

    the parameter 'callback' is copied for each invocation but only used as a const reference; consider making it a const reference

      255 |     VideoFrameCallback callback) {
          |                        ^
          |     const             &
  • include/livekit/local_track_publication.h:36:3: warning: [modernize-use-nodiscard]

    function 'track' should be marked [[nodiscard]]

       36 |   std::shared_ptr<Track> track() const noexcept;
          |   ^
          |   [[nodiscard]] 
  • include/livekit/remote_video_track.h:52:3: warning: [modernize-use-nodiscard]

    function 'to_string' should be marked [[nodiscard]]

       52 |   std::string to_string() const;
          |   ^
          |   [[nodiscard]] 
  • include/livekit/data_stream.h:95:3: warning: [modernize-use-nodiscard]

    function 'info' should be marked [[nodiscard]]

       95 |   const TextStreamInfo &info() const noexcept { return info_; }
          |   ^
          |   [[nodiscard]] 
  • include/livekit/data_stream.h:131:3: warning: [modernize-use-nodiscard]

    function 'info' should be marked [[nodiscard]]

      131 |   const ByteStreamInfo &info() const noexcept { return info_; }
          |   ^
          |   [[nodiscard]] 
  • include/livekit/data_stream.h:159:3: warning: [modernize-use-nodiscard]

    function 'streamId' should be marked [[nodiscard]]

      159 |   const std::string &streamId() const noexcept { return stream_id_; }
          |   ^
          |   [[nodiscard]] 
  • include/livekit/data_stream.h:162:3: warning: [modernize-use-nodiscard]

    function 'topic' should be marked [[nodiscard]]

      162 |   const std::string &topic() const noexcept { return topic_; }
          |   ^
          |   [[nodiscard]] 
  • include/livekit/data_stream.h:165:3: warning: [modernize-use-nodiscard]

    function 'mimeType' should be marked [[nodiscard]]

      165 |   const std::string &mimeType() const noexcept { return mime_type_; }
          |   ^
          |   [[nodiscard]] 
  • include/livekit/data_stream.h:168:3: warning: [modernize-use-nodiscard]

    function 'timestampMs' should be marked [[nodiscard]]

      168 |   std::int64_t timestampMs() const noexcept { return timestamp_ms_; }
          |   ^
          |   [[nodiscard]] 
  • include/livekit/data_stream.h:171:3: warning: [modernize-use-nodiscard]

    function 'isClosed' should be marked [[nodiscard]]

      171 |   bool isClosed() const noexcept { return closed_; }
          |   ^
          |   [[nodiscard]] 
  • include/livekit/data_stream.h:188:14: warning: [performance-enum-size]

    enum 'StreamKind' uses a larger base type ('int', size: 4 bytes) than necessary for its value set, consider using 'std::uint8_t' (1 byte) as the base type to reduce its size

      188 |   enum class StreamKind { kUnknown, kText, kByte };
          |              ^
  • include/livekit/data_stream.h:241:3: warning: [modernize-use-nodiscard]

    function 'info' should be marked [[nodiscard]]

      241 |   const TextStreamInfo &info() const noexcept { return info_; }
          |   ^
          |   [[nodiscard]] 
  • include/livekit/data_stream.h:266:3: warning: [modernize-use-nodiscard]

    function 'info' should be marked [[nodiscard]]

      266 |   const ByteStreamInfo &info() const noexcept { return info_; }
          |   ^
          |   [[nodiscard]] 
  • include/livekit/video_frame.h:27:12: warning: [performance-enum-size]

    enum 'VideoBufferType' uses a larger base type ('int', size: 4 bytes) than necessary for its value set, consider using 'std::uint8_t' (1 byte) as the base type to reduce its size

       27 | enum class VideoBufferType {
          |            ^
  • include/livekit/video_frame.h:78:3: warning: [modernize-use-nodiscard]

    function 'width' should be marked [[nodiscard]]

       78 |   int width() const noexcept { return width_; }
          |   ^
          |   [[nodiscard]] 
  • include/livekit/video_frame.h:79:3: warning: [modernize-use-nodiscard]

    function 'height' should be marked [[nodiscard]]

       79 |   int height() const noexcept { return height_; }
          |   ^
          |   [[nodiscard]] 
  • include/livekit/video_frame.h:80:3: warning: [modernize-use-nodiscard]

    function 'type' should be marked [[nodiscard]]

       80 |   VideoBufferType type() const noexcept { return type_; }
          |   ^
          |   [[nodiscard]] 
  • include/livekit/video_frame.h:83:3: warning: [modernize-use-nodiscard]

    function 'data' should be marked [[nodiscard]]

       83 |   const std::uint8_t *data() const noexcept { return data_.data(); }
          |   ^
          |   [[nodiscard]] 
  • include/livekit/video_frame.h:84:3: warning: [modernize-use-nodiscard]

    function 'dataSize' should be marked [[nodiscard]]

       84 |   std::size_t dataSize() const noexcept { return data_.size(); }
          |   ^
          |   [[nodiscard]] 
  • include/livekit/video_frame.h:92:3: warning: [modernize-use-nodiscard]

    function 'planeInfos' should be marked [[nodiscard]]

       92 |   std::vector<VideoPlaneInfo> planeInfos() const;
          |   ^
          |   [[nodiscard]] 
  • include/livekit/video_frame.h:119:3: warning: [modernize-use-nodiscard]

    function 'convert' should be marked [[nodiscard]]

      119 |   VideoFrame convert(VideoBufferType dst, bool flip_y = false) const;
          |   ^
          |   [[nodiscard]] 
  • examples/common/wav_audio_source.cpp:124:32: warning: [bugprone-easily-swappable-parameters]

    2 adjacent parameters of 'WavAudioSource' of similar type ('int') are easily swapped by mistake

      124 |                                int expected_sample_rate, int expected_channels,
          |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/examples/common/wav_audio_source.cpp:124:36: note: the first parameter in the range is 'expected_sample_rate'
      124 |                                int expected_sample_rate, int expected_channels,
          |                                    ^~~~~~~~~~~~~~~~~~~~
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/examples/common/wav_audio_source.cpp:124:62: note: the last parameter in the range is 'expected_channels'
      124 |                                int expected_sample_rate, int expected_channels,
          |                                                              ^~~~~~~~~~~~~~~~~
  • include/livekit/remote_track_publication.h:36:3: warning: [modernize-use-nodiscard]

    function 'track' should be marked [[nodiscard]]

       36 |   std::shared_ptr<Track> track() const noexcept;
          |   ^
          |   [[nodiscard]] 
  • include/livekit/remote_track_publication.h:38:3: warning: [modernize-use-nodiscard]

    function 'subscribed' should be marked [[nodiscard]]

       38 |   bool subscribed() const noexcept { return subscribed_; }
          |   ^
          |   [[nodiscard]] 
  • examples/common/sdl_media_manager.h:23:10: error: [clang-diagnostic-error]

    'SDL3/SDL.h' file not found

       23 | #include <SDL3/SDL.h>
          |          ^~~~~~~~~~~~
  • src/rpc_error.cpp:23:40: warning: [bugprone-easily-swappable-parameters]

    2 adjacent parameters of 'RpcError' of similar type ('std::string') are easily swapped by mistake

       23 | RpcError::RpcError(std::uint32_t code, std::string message, std::string data)
          |                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/rpc_error.cpp:23:52: note: the first parameter in the range is 'message'
       23 | RpcError::RpcError(std::uint32_t code, std::string message, std::string data)
          |                                                    ^~~~~~~
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/rpc_error.cpp:23:73: note: the last parameter in the range is 'data'
       23 | RpcError::RpcError(std::uint32_t code, std::string message, std::string data)
          |                                                                         ^~~~
  • src/rpc_error.cpp:52:10: warning: [modernize-return-braced-init-list]

    avoid repeating the return type from the declaration; use a braced initializer list instead

       52 |   return RpcError(err.code(), err.message(), err.data());
          |          ^~~~~~~~~                                     ~
          |          {                                             }
  • src/rpc_error.cpp:57:10: warning: [modernize-return-braced-init-list]

    avoid repeating the return type from the declaration; use a braced initializer list instead

       57 |   return RpcError(code, msg ? std::string(msg) : std::string{}, data);
          |          ^~~~~~~~~                                                  ~
          |          {                                                          }
  • bridge/tests/integration/test_bridge_rpc_roundtrip.cpp:17:10: error: [clang-diagnostic-error]

    '../common/bridge_test_common.h' file not found

       17 | #include "../common/bridge_test_common.h"
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • bridge/tests/integration/test_bridge_rpc_roundtrip.cpp:20:1: warning: [modernize-concat-nested-namespaces]

    nested namespaces can be concatenated

       20 | namespace livekit_bridge {
          | ^~~~~~~~~~~~~~~~~~~~~~~~~~
       21 | namespace test {
          | ~~~~~~~~~~~~~~
          | namespace livekit_bridge::test
  • examples/common/sdl_video_renderer.cpp:31:48: warning: [bugprone-easily-swappable-parameters]

    2 adjacent parameters of 'init' of similar type ('int') are easily swapped by mistake

       31 | bool SDLVideoRenderer::init(const char *title, int width, int height) {
          |                                                ^~~~~~~~~~~~~~~~~~~~~
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/examples/common/sdl_video_renderer.cpp:31:52: note: the first parameter in the range is 'width'
       31 | bool SDLVideoRenderer::init(const char *title, int width, int height) {
          |                                                    ^~~~~
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/examples/common/sdl_video_renderer.cpp:31:63: note: the last parameter in the range is 'height'
       31 | bool SDLVideoRenderer::init(const char *title, int width, int height) {
          |                                                               ^~~~~~
  • examples/common/sdl_video_renderer.cpp:166:17: warning: [bugprone-implicit-widening-of-multiplication-result]

    result of multiplication in type 'int' is used as a pointer offset after an implicit widening conversion to type 'ptrdiff_t'

      166 |     std::memcpy(static_cast<std::uint8_t *>(pixels) + y * pitch,
          |                 ^
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/examples/common/sdl_video_renderer.cpp:166:55: note: make conversion explicit to silence this warning
       20 |     std::memcpy(static_cast<std::uint8_t *>(pixels) + y * pitch,
          |                                                       ^~~~~~~~~
          |                                                       static_cast<ptrdiff_t>( )
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/examples/common/sdl_video_renderer.cpp:166:55: note: perform multiplication in a wider type
      166 |     std::memcpy(static_cast<std::uint8_t *>(pixels) + y * pitch,
          |                                                       ^        
          |                                                       static_cast<ptrdiff_t>( )
  • examples/common/sdl_video_renderer.cpp:167:17: warning: [bugprone-implicit-widening-of-multiplication-result]

    result of multiplication in type 'int' is used as a pointer offset after an implicit widening conversion to type 'ptrdiff_t'

      167 |                 src + y * srcPitch, srcPitch);
          |                 ^
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/examples/common/sdl_video_renderer.cpp:167:23: note: make conversion explicit to silence this warning
      167 |                 src + y * srcPitch, srcPitch);
          |                       ^~~~~~~~~~~~
          |                       static_cast<ptrdiff_t>( )
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/examples/common/sdl_video_renderer.cpp:167:23: note: perform multiplication in a wider type
      167 |                 src + y * srcPitch, srcPitch);
          |                       ^           
          |                       static_cast<ptrdiff_t>( )
  • include/livekit/audio_processing_module.h:159:3: warning: [modernize-use-nodiscard]

    function 'valid' should be marked [[nodiscard]]

      159 |   bool valid() const noexcept { return handle_.valid(); }
          |   ^
          |   [[nodiscard]] 
  • include/livekit/audio_processing_module.h:162:3: warning: [modernize-use-nodiscard]

    function 'ffi_handle_id' should be marked [[nodiscard]]

      162 |   std::uint64_t ffi_handle_id() const noexcept {
          |   ^
          |   [[nodiscard]] 
  • src/room.cpp:276:55: warning: [performance-unnecessary-value-param]

    the parameter 'callback' is copied for each invocation but only used as a const reference; consider making it a const reference

      276 |                                    AudioFrameCallback callback,
          |                                                       ^
          |                                    const             &
  • src/room.cpp:277:57: warning: [performance-unnecessary-value-param]

    the parameter 'opts' is copied for each invocation but only used as a const reference; consider making it a const reference

      277 |                                    AudioStream::Options opts) {
          |                                                         ^
          |                                    const               &
  • src/room.cpp:286:55: warning: [performance-unnecessary-value-param]

    the parameter 'callback' is copied for each invocation but only used as a const reference; consider making it a const reference

      286 |                                    AudioFrameCallback callback,
          |                                                       ^
          |                                    const             &
  • src/room.cpp:287:57: warning: [performance-unnecessary-value-param]

    the parameter 'opts' is copied for each invocation but only used as a const reference; consider making it a const reference

      287 |                                    AudioStream::Options opts) {
          |                                                         ^
          |                                    const               &
  • src/room.cpp:296:55: warning: [performance-unnecessary-value-param]

    the parameter 'callback' is copied for each invocation but only used as a const reference; consider making it a const reference

      296 |                                    VideoFrameCallback callback,
          |                                                       ^
          |                                    const             &
  • src/room.cpp:306:55: warning: [performance-unnecessary-value-param]

    the parameter 'callback' is copied for each invocation but only used as a const reference; consider making it a const reference

      306 |                                    VideoFrameCallback callback,
          |                                                       ^
          |                                    const             &
  • src/room.cpp:349:48: warning: [performance-unnecessary-value-param]

    the parameter 'callback' is copied for each invocation but only used as a const reference; consider making it a const reference

      349 |                              DataFrameCallback callback) {
          |                                                ^
          |                              const            &
  • include/livekit/result.h:46:41: warning: [modernize-type-traits]

    use c++17 style variable templates

       46 |             typename = std::enable_if_t<std::is_constructible<T, U &&>::value>>
          |                                         ^                             ~~~~~~~
          |                                                              _v
  • include/livekit/result.h:54:41: warning: [modernize-type-traits]

    use c++17 style variable templates

       54 |             typename = std::enable_if_t<std::is_constructible<E, F &&>::value>>
          |                                         ^                             ~~~~~~~
          |                                                              _v
  • include/livekit/result.h:61:3: warning: [modernize-use-nodiscard]

    function 'ok' should be marked [[nodiscard]]

       61 |   bool ok() const noexcept { return storage_.index() == 0; }
          |   ^
          |   [[nodiscard]] 
  • include/livekit/result.h:63:3: warning: [modernize-use-nodiscard]

    function 'has_error' should be marked [[nodiscard]]

       63 |   bool has_error() const noexcept { return !ok(); }
          |   ^
          |   [[nodiscard]] 
  • include/livekit/result.h:134:41: warning: [modernize-type-traits]

    use c++17 style variable templates

      134 |             typename = std::enable_if_t<std::is_constructible<E, F &&>::value>>
          |                                         ^                             ~~~~~~~
          |                                                              _v
  • include/livekit/result.h:140:3: warning: [modernize-use-nodiscard]

    function 'ok' should be marked [[nodiscard]]

      140 |   bool ok() const noexcept { return !error_.has_value(); }
          |   ^
          |   [[nodiscard]] 
  • include/livekit/result.h:142:3: warning: [modernize-use-nodiscard]

    function 'has_error' should be marked [[nodiscard]]

      142 |   bool has_error() const noexcept { return error_.has_value(); }
          |   ^
          |   [[nodiscard]] 
  • src/local_participant.cpp:411:29: warning: [bugprone-easily-swappable-parameters]

    2 adjacent parameters of 'handleRpcMethodInvocation' of similar type ('const std::string &') are easily swapped by mistake

      411 |     uint64_t invocation_id, const std::string &method,
          |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~
      412 |     const std::string &request_id, const std::string &caller_identity,
          |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/local_participant.cpp:411:48: note: the first parameter in the range is 'method'
      411 |     uint64_t invocation_id, const std::string &method,
          |                                                ^~~~~~
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/local_participant.cpp:412:24: note: the last parameter in the range is 'request_id'
      412 |     const std::string &request_id, const std::string &caller_identity,
          |                        ^~~~~~~~~~
  • include/livekit/livekit.h:23:10: error: [clang-diagnostic-error]

    'build.h' file not found

       23 | #include "build.h"
          |          ^~~~~~~~~
  • include/livekit/livekit.h:44:12: warning: [performance-enum-size]

    enum 'LogSink' uses a larger base type ('int', size: 4 bytes) than necessary for its value set, consider using 'std::uint8_t' (1 byte) as the base type to reduce its size

       44 | enum class LogSink {
          |            ^
  • include/livekit/participant.h:24:10: error: [clang-diagnostic-error]

    'livekit/ffi_handle.h' file not found

       24 | #include "livekit/ffi_handle.h"
          |          ^~~~~~~~~~~~~~~~~~~~~~
  • include/livekit/participant.h:29:12: warning: [performance-enum-size]

    enum 'ParticipantKind' uses a larger base type ('int', size: 4 bytes) than necessary for its value set, consider using 'std::uint8_t' (1 byte) as the base type to reduce its size

       29 | enum class ParticipantKind { Standard = 0, Ingress, Egress, Sip, Agent };
          |            ^
  • include/livekit/participant.h:33:33: warning: [bugprone-easily-swappable-parameters]

    4 adjacent parameters of 'Participant' of similar type ('std::string') are easily swapped by mistake

       33 |   Participant(FfiHandle handle, std::string sid, std::string name,
          |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       34 |               std::string identity, std::string metadata,
          |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/include/livekit/participant.h:33:45: note: the first parameter in the range is 'sid'
       33 |   Participant(FfiHandle handle, std::string sid, std::string name,
          |                                             ^~~
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/include/livekit/participant.h:34:49: note: the last parameter in the range is 'metadata'
       34 |               std::string identity, std::string metadata,
          |                                                 ^~~~~~~~
  • include/livekit/participant.h:44:3: warning: [modernize-use-nodiscard]

    function 'sid' should be marked [[nodiscard]]

       44 |   const std::string &sid() const noexcept { return sid_; }
          |   ^
          |   [[nodiscard]] 
  • include/livekit/participant.h:45:3: warning: [modernize-use-nodiscard]

    function 'name' should be marked [[nodiscard]]

       45 |   const std::string &name() const noexcept { return name_; }
          |   ^
          |   [[nodiscard]] 
  • include/livekit/participant.h:46:3: warning: [modernize-use-nodiscard]

    function 'identity' should be marked [[nodiscard]]

       46 |   const std::string &identity() const noexcept { return identity_; }
          |   ^
          |   [[nodiscard]] 
  • include/livekit/participant.h:47:3: warning: [modernize-use-nodiscard]

    function 'metadata' should be marked [[nodiscard]]

       47 |   const std::string &metadata() const noexcept { return metadata_; }
          |   ^
          |   [[nodiscard]] 
  • include/livekit/participant.h:48:3: warning: [modernize-use-nodiscard]

    function 'attributes' should be marked [[nodiscard]]

       48 |   const std::unordered_map<std::string, std::string> &
          |   ^
          |   [[nodiscard]] 
  • include/livekit/participant.h:52:3: warning: [modernize-use-nodiscard]

    function 'kind' should be marked [[nodiscard]]

       52 |   ParticipantKind kind() const noexcept { return kind_; }
          |   ^
          |   [[nodiscard]] 
  • include/livekit/participant.h:53:3: warning: [modernize-use-nodiscard]

    function 'disconnectReason' should be marked [[nodiscard]]

       53 |   DisconnectReason disconnectReason() const noexcept { return reason_; }
          |   ^
          |   [[nodiscard]] 
  • include/livekit/participant.h:55:3: warning: [modernize-use-nodiscard]

    function 'ffiHandleId' should be marked [[nodiscard]]

       55 |   uintptr_t ffiHandleId() const noexcept { return handle_.get(); }
          |   ^
          |   [[nodiscard]] 
  • include/livekit/participant.h:58:29: warning: [performance-unnecessary-value-param]

    the parameter 'name' is copied for each invocation but only used as a const reference; consider making it a const reference

       58 |   void set_name(std::string name) noexcept { name_ = std::move(name); }
          |                             ^
          |                 const      &
  • include/livekit/participant.h:59:33: warning: [performance-unnecessary-value-param]

    the parameter 'metadata' is copied for each invocation but only used as a const reference; consider making it a const reference

       59 |   void set_metadata(std::string metadata) noexcept {
          |                                 ^
          |                     const      &
  • include/livekit/participant.h:66:22: warning: [bugprone-easily-swappable-parameters]

    2 adjacent parameters of 'set_attribute' of similar type ('const std::string &') are easily swapped by mistake

       66 |   void set_attribute(const std::string &key, const std::string &value) {
          |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/include/livekit/participant.h:66:41: note: the first parameter in the range is 'key'
       66 |   void set_attribute(const std::string &key, const std::string &value) {
          |                                         ^~~
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/include/livekit/participant.h:66:65: note: the last parameter in the range is 'value'
       66 |   void set_attribute(const std::string &key, const std::string &value) {
          |                                                                 ^~~~~
  • include/livekit/participant.h:76:3: warning: [modernize-use-nodiscard]

    function 'findTrackPublication' should be marked [[nodiscard]]

       76 |   virtual std::shared_ptr<TrackPublication>
          |   ^
          |   [[nodiscard]] 
  • src/audio_source.cpp:43:26: warning: [bugprone-easily-swappable-parameters]

    3 adjacent parameters of 'AudioSource' of similar type ('int') are easily swapped by mistake

       43 | AudioSource::AudioSource(int sample_rate, int num_channels, int queue_size_ms)
          |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/audio_source.cpp:43:30: note: the first parameter in the range is 'sample_rate'
       43 | AudioSource::AudioSource(int sample_rate, int num_channels, int queue_size_ms)
          |                              ^~~~~~~~~~~
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/audio_source.cpp:43:65: note: the last parameter in the range is 'queue_size_ms'
       43 | AudioSource::AudioSource(int sample_rate, int num_channels, int queue_size_ms)
          |                                                                 ^~~~~~~~~~~~~
  • src/track_proto_converter.cpp:58:3: warning: [bugprone-branch-clone]

    switch has 2 consecutive identical branches

       58 |   case proto::TrackKind::KIND_UNKNOWN:
          |   ^
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/track_proto_converter.cpp:61:35: note: last of these clones ends here
       61 |     return TrackKind::KIND_UNKNOWN;
          |                                   ^
  • src/track_proto_converter.cpp:71:3: warning: [bugprone-branch-clone]

    switch has 2 consecutive identical branches

       71 |   case proto::StreamState::STATE_UNKNOWN:
          |   ^
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/track_proto_converter.cpp:74:38: note: last of these clones ends here
       74 |     return StreamState::STATE_UNKNOWN;
          |                                      ^
  • src/track_proto_converter.cpp:88:3: warning: [bugprone-branch-clone]

    switch has 2 consecutive identical branches

       88 |   case proto::TrackSource::SOURCE_UNKNOWN:
          |   ^
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/track_proto_converter.cpp:91:39: note: last of these clones ends here
       91 |     return TrackSource::SOURCE_UNKNOWN;
          |                                       ^
  • include/livekit/local_video_track.h:80:3: warning: [modernize-use-nodiscard]

    function 'to_string' should be marked [[nodiscard]]

       80 |   std::string to_string() const;
          |   ^
          |   [[nodiscard]] 
  • include/livekit/local_video_track.h:84:3: warning: [modernize-use-nodiscard]

    function 'publication' should be marked [[nodiscard]]

       84 |   std::shared_ptr<LocalTrackPublication> publication() const noexcept {
          |   ^
          |   [[nodiscard]] 
  • include/livekit/local_video_track.h:91:26: warning: [performance-move-const-arg]

    std::move of the const variable 'publication' has no effect; remove std::move() or make the variable non-const

       91 |     local_publication_ = std::move(publication);
          |                          ^~~~~~~~~~           ~
  • src/room_event_converter.cpp:17:10: error: [clang-diagnostic-error]

    'room_event_converter.h' file not found

       17 | #include "room_event_converter.h"
          |          ^~~~~~~~~~~~~~~~~~~~~~~~
  • src/room_event_converter.cpp:27:3: warning: [bugprone-branch-clone]

    switch has 5 consecutive identical branches

       27 |   case proto::QUALITY_POOR:
          |   ^
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/room_event_converter.cpp:35:11: note: last of these clones ends here
       35 |   default:
          |           ^
  • src/room_event_converter.cpp:42:3: warning: [bugprone-branch-clone]

    switch has 4 consecutive identical branches

       42 |   case proto::CONN_DISCONNECTED:
          |   ^
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/room_event_converter.cpp:48:11: note: last of these clones ends here
       48 |   default:
          |           ^
  • src/room_event_converter.cpp:55:3: warning: [bugprone-branch-clone]

    switch has 3 consecutive identical branches

       55 |   case proto::KIND_LOSSY:
          |   ^
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/room_event_converter.cpp:59:11: note: last of these clones ends here
       59 |   default:
          |           ^
  • src/room_event_converter.cpp:108:14: warning: [performance-no-int-to-ptr]

    integer to pointer cast pessimizes optimization opportunities

      108 |   auto ptr = reinterpret_cast<const std::uint8_t *>(buf.data_ptr());
          |              ^
  • src/tests/stress/test_room_stress.cpp:19:10: error: [clang-diagnostic-error]

    'gtest/gtest.h' file not found

       19 | #include <gtest/gtest.h>
          |          ^~~~~~~~~~~~~~~
  • src/tests/stress/test_room_stress.cpp:25:1: warning: [modernize-concat-nested-namespaces]

    nested namespaces can be concatenated

       25 | namespace livekit {
          | ^~~~~~~~~~~~~~~~~~~
       26 | namespace test {
          | ~~~~~~~~~~~~~~
          | namespace livekit::test
  • src/tests/integration/test_logging.cpp:17:10: error: [clang-diagnostic-error]

    'gtest/gtest.h' file not found

       17 | #include <gtest/gtest.h>
          |          ^~~~~~~~~~~~~~~
  • src/tests/integration/test_logging.cpp:28:1: warning: [modernize-concat-nested-namespaces]

    nested namespaces can be concatenated

       28 | namespace livekit {
          | ^~~~~~~~~~~~~~~~~~~
       29 | namespace test {
          | ~~~~~~~~~~~~~~
          | namespace livekit::test
  • src/subscription_thread_dispatcher.cpp:90:52: warning: [performance-move-const-arg]

    std::move of the variable 'opts' of the trivially-copyable type 'VideoStream::Options' has no effect; remove std::move()

       90 |       RegisteredVideoCallback{std::move(callback), std::move(opts)};
          |                                                    ^~~~~~~~~~    ~
  • src/subscription_thread_dispatcher.cpp:105:52: warning: [performance-move-const-arg]

    std::move of the variable 'opts' of the trivially-copyable type 'VideoStream::Options' has no effect; remove std::move()

      105 |       RegisteredVideoCallback{std::move(callback), std::move(opts)};
          |                                                    ^~~~~~~~~~    ~
  • src/subscription_thread_dispatcher.cpp:216:63: warning: [bugprone-branch-clone]

    repeated branch body in conditional chain

      216 |         audio_callbacks_.find(key) == audio_callbacks_.end()) {
          |                                                               ^
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/subscription_thread_dispatcher.cpp:218:6: note: end of the original
      218 |     } else if (track->kind() == TrackKind::KIND_VIDEO &&
          |      ^
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/subscription_thread_dispatcher.cpp:219:70: note: clone 1 starts here
      219 |                video_callbacks_.find(key) == video_callbacks_.end()) {
          |                                                                      ^
  • src/subscription_thread_dispatcher.cpp:478:24: warning: [performance-unnecessary-value-param]

    the parameter 'cb' is copied for each invocation but only used as a const reference; consider making it a const reference

      478 |     AudioFrameCallback cb, const AudioStream::Options &opts) {
          |                        ^
          |     const             &
  • src/subscription_thread_dispatcher.cpp:501:8: warning: [performance-unnecessary-copy-initialization]

    local copy 'stream_copy' of the variable 'stream' is never modified; consider avoiding the copy

      501 |   auto stream_copy = stream;
          |        ^
          |   const  &
  • src/subscription_thread_dispatcher.cpp:529:24: warning: [performance-unnecessary-value-param]

    the parameter 'cb' is copied for each invocation but only used as a const reference; consider making it a const reference

      529 |     VideoFrameCallback cb, const VideoStream::Options &opts) {
          |                        ^
          |     const             &
  • src/subscription_thread_dispatcher.cpp:552:8: warning: [performance-unnecessary-copy-initialization]

    local copy 'stream_copy' of the variable 'stream' is never modified; consider avoiding the copy

      552 |   auto stream_copy = stream;
          |        ^
          |   const  &
  • src/subscription_thread_dispatcher.cpp:623:70: warning: [performance-unnecessary-value-param]

    the parameter 'cb' is copied for each invocation but only used as a const reference; consider making it a const reference

      623 |     const std::shared_ptr<RemoteDataTrack> &track, DataFrameCallback cb) {
          |                                                                      ^
          |                                                    const            &
  • src/tests/integration/test_room_callbacks.cpp:20:10: error: [clang-diagnostic-error]

    'gtest/gtest.h' file not found

       20 | #include <gtest/gtest.h>
          |          ^~~~~~~~~~~~~~~

Have any feedback or feature suggestions? Share it here.

Copy link
Copy Markdown

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cpp-linter Review

Used clang-tidy v20.1.2

Click here for the full clang-tidy patch
diff --git a/src/ffi_client.cpp b/src/ffi_client.cpp
index 9c20691..7ef11b4 100644
--- a/src/ffi_client.cpp
+++ b/src/ffi_client.cpp
@@ -654,2 +654 @@ FfiClient::publishDataTrackAsync(std::uint64_t local_participant_handle,
-        proto::OwnedLocalDataTrack track = cb.track();
-        pr.set_value(
+               pr.set_value(
diff --git a/src/tests/common/audio_utils.h b/src/tests/common/audio_utils.h
index 1576b9a..5988b4d 100644
--- a/src/tests/common/audio_utils.h
+++ b/src/tests/common/audio_utils.h
@@ -27,2 +27,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -110,2 +110,2 @@ inline void fillToneFrame(AudioFrame &frame, double freq_hz, int sample_rate,
-  for (std::size_t i = 0; i < samples.size(); ++i) {
-    samples[i] = static_cast<std::int16_t>(std::sin(phase) * amplitude);
+  for (short & sample : samples) {
+    sample = static_cast<std::int16_t>(std::sin(phase) * amplitude);
@@ -119,2 +119,2 @@ inline void fillToneFrame(AudioFrame &frame, double freq_hz, int sample_rate,
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/include/livekit/remote_audio_track.h b/include/livekit/remote_audio_track.h
index 572e62c..5de6003 100644
--- a/include/livekit/remote_audio_track.h
+++ b/include/livekit/remote_audio_track.h
@@ -52 +52 @@ public:
-  std::string to_string() const;
+  [[nodiscard]] std::string to_string() const;
diff --git a/include/livekit/local_video_track.h b/include/livekit/local_video_track.h
index a431740..72d747f 100644
--- a/include/livekit/local_video_track.h
+++ b/include/livekit/local_video_track.h
@@ -80 +80 @@ public:
-  std::string to_string() const;
+  [[nodiscard]] std::string to_string() const;
@@ -84 +84 @@ public:
-  std::shared_ptr<LocalTrackPublication> publication() const noexcept {
+  [[nodiscard]] std::shared_ptr<LocalTrackPublication> publication() const noexcept {
@@ -91 +91 @@ public:
-    local_publication_ = std::move(publication);
+    local_publication_ = publication;
diff --git a/src/tests/common/video_utils.h b/src/tests/common/video_utils.h
index eb743c5..8150300 100644
--- a/src/tests/common/video_utils.h
+++ b/src/tests/common/video_utils.h
@@ -26,2 +26,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -40 +40 @@ inline void fillWebcamLikeFrame(VideoFrame &frame, std::uint64_t frame_index) {
-  const std::uint8_t blue = static_cast<std::uint8_t>((frame_index * 3) % 255);
+  const auto blue = static_cast<std::uint8_t>((frame_index * 3) % 255);
@@ -128,2 +128,2 @@ inline void runVideoLoop(
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/include/livekit/audio_frame.h b/include/livekit/audio_frame.h
index 2db2b9b..1e35b93 100644
--- a/include/livekit/audio_frame.h
+++ b/include/livekit/audio_frame.h
@@ -68 +68 @@ public:
-  const std::vector<std::int16_t> &data() const noexcept { return data_; }
+  [[nodiscard]] const std::vector<std::int16_t> &data() const noexcept { return data_; }
@@ -72 +72 @@ public:
-  std::size_t total_samples() const noexcept { return data_.size(); }
+  [[nodiscard]] std::size_t total_samples() const noexcept { return data_.size(); }
@@ -75 +75 @@ public:
-  int sample_rate() const noexcept { return sample_rate_; }
+  [[nodiscard]] int sample_rate() const noexcept { return sample_rate_; }
@@ -78 +78 @@ public:
-  int num_channels() const noexcept { return num_channels_; }
+  [[nodiscard]] int num_channels() const noexcept { return num_channels_; }
@@ -81 +81 @@ public:
-  int samples_per_channel() const noexcept { return samples_per_channel_; }
+  [[nodiscard]] int samples_per_channel() const noexcept { return samples_per_channel_; }
@@ -84 +84 @@ public:
-  double duration() const noexcept;
+  [[nodiscard]] double duration() const noexcept;
@@ -87 +87 @@ public:
-  std::string to_string() const;
+  [[nodiscard]] std::string to_string() const;
@@ -92 +92 @@ protected:
-  proto::AudioFrameBufferInfo toProto() const;
+  [[nodiscard]] proto::AudioFrameBufferInfo toProto() const;
diff --git a/include/livekit/participant.h b/include/livekit/participant.h
index 5987963..f61d64b 100644
--- a/include/livekit/participant.h
+++ b/include/livekit/participant.h
@@ -44,5 +44,5 @@ public:
-  const std::string &sid() const noexcept { return sid_; }
-  const std::string &name() const noexcept { return name_; }
-  const std::string &identity() const noexcept { return identity_; }
-  const std::string &metadata() const noexcept { return metadata_; }
-  const std::unordered_map<std::string, std::string> &
+  [[nodiscard]] const std::string &sid() const noexcept { return sid_; }
+  [[nodiscard]] const std::string &name() const noexcept { return name_; }
+  [[nodiscard]] const std::string &identity() const noexcept { return identity_; }
+  [[nodiscard]] const std::string &metadata() const noexcept { return metadata_; }
+  [[nodiscard]] const std::unordered_map<std::string, std::string> &
@@ -52,2 +52,2 @@ public:
-  ParticipantKind kind() const noexcept { return kind_; }
-  DisconnectReason disconnectReason() const noexcept { return reason_; }
+  [[nodiscard]] ParticipantKind kind() const noexcept { return kind_; }
+  [[nodiscard]] DisconnectReason disconnectReason() const noexcept { return reason_; }
@@ -55 +55 @@ public:
-  uintptr_t ffiHandleId() const noexcept { return handle_.get(); }
+  [[nodiscard]] uintptr_t ffiHandleId() const noexcept { return handle_.get(); }
@@ -58,2 +58,2 @@ public:
-  void set_name(std::string name) noexcept { name_ = std::move(name); }
-  void set_metadata(std::string metadata) noexcept {
+  void set_name(const std::string& name) noexcept { name_ = std::move(name); }
+  void set_metadata(const std::string& metadata) noexcept {
@@ -76 +76 @@ protected:
-  virtual std::shared_ptr<TrackPublication>
+  [[nodiscard]] virtual std::shared_ptr<TrackPublication>
diff --git a/src/audio_frame.cpp b/src/audio_frame.cpp
index 23ff01e..d165e73 100644
--- a/src/audio_frame.cpp
+++ b/src/audio_frame.cpp
@@ -72 +72 @@ AudioFrame::fromOwnedInfo(const proto::OwnedAudioFrameBuffer &owned) {
-  const std::int16_t *ptr =
+  const auto *ptr =
diff --git a/src/tests/integration/test_media_multistream.cpp b/src/tests/integration/test_media_multistream.cpp
index 8b98fe9..91495fc 100644
--- a/src/tests/integration/test_media_multistream.cpp
+++ b/src/tests/integration/test_media_multistream.cpp
@@ -29,2 +29,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -241 +241 @@ void MediaMultiStreamIntegrationTest::runPublishTwoVideoAndTwoAudioTracks(
-TEST_F(MediaMultiStreamIntegrationTest,
+TEST_F(const MediaMultiStreamIntegrationTest&,
@@ -246 +246 @@ TEST_F(MediaMultiStreamIntegrationTest,
-TEST_F(MediaMultiStreamIntegrationTest,
+TEST_F(const MediaMultiStreamIntegrationTest&,
@@ -251,2 +251,2 @@ TEST_F(MediaMultiStreamIntegrationTest,
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/bridge/tests/integration/test_bridge_rpc_roundtrip.cpp b/bridge/tests/integration/test_bridge_rpc_roundtrip.cpp
index e649450..b0012e4 100644
--- a/bridge/tests/integration/test_bridge_rpc_roundtrip.cpp
+++ b/bridge/tests/integration/test_bridge_rpc_roundtrip.cpp
@@ -20,2 +20,2 @@
-namespace livekit_bridge {
-namespace test {
+
+namespace livekit_bridge::test {
@@ -270,2 +270,2 @@ TEST_F(BridgeRemoteTrackControlTest, RemoteMuteNonexistentTrack) {
-} // namespace test
-} // namespace livekit_bridge
+} // namespace livekit_bridge::test
+
diff --git a/src/tests/stress/test_audio_frame_stress.cpp b/src/tests/stress/test_audio_frame_stress.cpp
index 41f92e9..32000a4 100644
--- a/src/tests/stress/test_audio_frame_stress.cpp
+++ b/src/tests/stress/test_audio_frame_stress.cpp
@@ -25,2 +25,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -286,2 +286,2 @@ TEST_F(AudioFrameStressTest, SimulatedRealtimeProcessing) {
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/examples/logging_levels/basic_usage.cpp b/examples/logging_levels/basic_usage.cpp
index 02cdb47..fc3451e 100644
--- a/examples/logging_levels/basic_usage.cpp
+++ b/examples/logging_levels/basic_usage.cpp
@@ -67 +67 @@ livekit::LogLevel parseLevel(const char *arg) {
-  if (std::strcmp(arg, "trace") == 0)
+  if (std::strcmp(arg, "trace") == 0) {
@@ -69 +69,2 @@ livekit::LogLevel parseLevel(const char *arg) {
-  if (std::strcmp(arg, "debug") == 0)
+}
+  if (std::strcmp(arg, "debug") == 0) {
@@ -71 +72,2 @@ livekit::LogLevel parseLevel(const char *arg) {
-  if (std::strcmp(arg, "info") == 0)
+}
+  if (std::strcmp(arg, "info") == 0) {
@@ -73 +75,2 @@ livekit::LogLevel parseLevel(const char *arg) {
-  if (std::strcmp(arg, "warn") == 0)
+}
+  if (std::strcmp(arg, "warn") == 0) {
@@ -75 +78,2 @@ livekit::LogLevel parseLevel(const char *arg) {
-  if (std::strcmp(arg, "error") == 0)
+}
+  if (std::strcmp(arg, "error") == 0) {
@@ -77 +81,2 @@ livekit::LogLevel parseLevel(const char *arg) {
-  if (std::strcmp(arg, "critical") == 0)
+}
+  if (std::strcmp(arg, "critical") == 0) {
@@ -79 +84,2 @@ livekit::LogLevel parseLevel(const char *arg) {
-  if (std::strcmp(arg, "off") == 0)
+}
+  if (std::strcmp(arg, "off") == 0) {
@@ -80,0 +87 @@ livekit::LogLevel parseLevel(const char *arg) {
+}
diff --git a/src/tests/integration/test_audio_frame.cpp b/src/tests/integration/test_audio_frame.cpp
index 9eba0be..dd11fd5 100644
--- a/src/tests/integration/test_audio_frame.cpp
+++ b/src/tests/integration/test_audio_frame.cpp
@@ -21,2 +21,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -169,2 +169,2 @@ TEST_F(AudioFrameTest, InvalidDataSizeThrows) {
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/examples/common/sdl_media.cpp b/examples/common/sdl_media.cpp
index 4961f51..cc14d75 100644
--- a/examples/common/sdl_media.cpp
+++ b/examples/common/sdl_media.cpp
@@ -65 +65 @@ void SDLMicSource::pump() {
-  if (!stream_ || !callback_)
+  if (!stream_ || !callback_) {
@@ -66,0 +67 @@ void SDLMicSource::pump() {
+}
@@ -142 +143 @@ void DDLSpeakerSink::enqueue(const int16_t *samples,
-  if (!stream_ || !samples)
+  if (!stream_ || !samples) {
@@ -143,0 +145 @@ void DDLSpeakerSink::enqueue(const int16_t *samples,
+}
@@ -186 +188 @@ bool SDLCamSource::init() {
-    if (cams)
+    if (cams) {
@@ -187,0 +190 @@ bool SDLCamSource::init() {
+}
@@ -214 +217 @@ void SDLCamSource::pump() {
-  if (!camera_ || !callback_)
+  if (!camera_ || !callback_) {
@@ -215,0 +219 @@ void SDLCamSource::pump() {
+}
diff --git a/src/tests/stress/test_rpc_stress.cpp b/src/tests/stress/test_rpc_stress.cpp
index 4e25a7b..659b458 100644
--- a/src/tests/stress/test_rpc_stress.cpp
+++ b/src/tests/stress/test_rpc_stress.cpp
@@ -22,2 +22,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -291 +291 @@ TEST_F(RpcStressTest, MaxPayloadStress) {
-      if (!running.load())
+      if (!running.load()) {
@@ -292,0 +293 @@ TEST_F(RpcStressTest, MaxPayloadStress) {
+}
@@ -477 +478 @@ TEST_F(RpcStressTest, SmallPayloadStress) {
-      if (!running.load())
+      if (!running.load()) {
@@ -478,0 +480 @@ TEST_F(RpcStressTest, SmallPayloadStress) {
+}
@@ -691 +693 @@ TEST_F(RpcStressTest, BidirectionalRpcStress) {
-      if (!running.load())
+      if (!running.load()) {
@@ -692,0 +695 @@ TEST_F(RpcStressTest, BidirectionalRpcStress) {
+}
@@ -838 +841 @@ TEST_F(RpcStressTest, HighThroughputBurst) {
-      if (!running.load())
+      if (!running.load()) {
@@ -839,0 +843 @@ TEST_F(RpcStressTest, HighThroughputBurst) {
+}
@@ -890,2 +894,2 @@ TEST_F(RpcStressTest, HighThroughputBurst) {
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/examples/bridge_mute_unmute/caller.cpp b/examples/bridge_mute_unmute/caller.cpp
index a47b2e1..07673e6 100644
--- a/examples/bridge_mute_unmute/caller.cpp
+++ b/examples/bridge_mute_unmute/caller.cpp
@@ -70 +70 @@ static void storeFrame(const livekit::VideoFrame &frame) {
-  if (!src || size == 0)
+  if (!src || size == 0) {
@@ -71,0 +72 @@ static void storeFrame(const livekit::VideoFrame &frame) {
+}
@@ -92 +93 @@ int main(int argc, char *argv[]) {
-    if (positional.size() >= 3)
+    if (positional.size() >= 3) {
@@ -93,0 +95 @@ int main(int argc, char *argv[]) {
+}
@@ -96 +98 @@ int main(int argc, char *argv[]) {
-    if (e)
+    if (e) {
@@ -97,0 +100 @@ int main(int argc, char *argv[]) {
+}
@@ -99 +102 @@ int main(int argc, char *argv[]) {
-    if (e)
+    if (e) {
@@ -101 +104,2 @@ int main(int argc, char *argv[]) {
-    if (!positional.empty())
+}
+    if (!positional.empty()) {
@@ -102,0 +107 @@ int main(int argc, char *argv[]) {
+}
@@ -171 +176 @@ int main(int argc, char *argv[]) {
-        if (samples.empty())
+        if (samples.empty()) {
@@ -172,0 +178 @@ int main(int argc, char *argv[]) {
+}
@@ -205 +211 @@ int main(int argc, char *argv[]) {
-    for (int i = 0; i < 30 && toggle_running.load(); ++i)
+    for (int i = 0; i < 30 && toggle_running.load(); ++i) {
@@ -206,0 +213 @@ int main(int argc, char *argv[]) {
+}
@@ -249 +256 @@ int main(int argc, char *argv[]) {
-      for (int i = 0; i < 100 && toggle_running.load(); ++i)
+      for (int i = 0; i < 100 && toggle_running.load(); ++i) {
@@ -250,0 +258 @@ int main(int argc, char *argv[]) {
+}
@@ -284 +292 @@ int main(int argc, char *argv[]) {
-        if (texture)
+        if (texture) {
@@ -285,0 +294 @@ int main(int argc, char *argv[]) {
+}
@@ -319 +328 @@ int main(int argc, char *argv[]) {
-  if (toggle_thread.joinable())
+  if (toggle_thread.joinable()) {
@@ -320,0 +330 @@ int main(int argc, char *argv[]) {
+}
@@ -329 +339 @@ int main(int argc, char *argv[]) {
-  if (texture)
+  if (texture) {
@@ -330,0 +341 @@ int main(int argc, char *argv[]) {
+}
diff --git a/src/tests/integration/test_data_track.cpp b/src/tests/integration/test_data_track.cpp
index 983497b..a8b1cc7 100644
--- a/src/tests/integration/test_data_track.cpp
+++ b/src/tests/integration/test_data_track.cpp
@@ -37,2 +37,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -847,2 +847,2 @@ INSTANTIATE_TEST_SUITE_P(DataTrackScenarios, DataTrackTransportTest,
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/bridge/src/rpc_controller.h b/bridge/src/rpc_controller.h
index 97d096d..c2b0a40 100644
--- a/bridge/src/rpc_controller.h
+++ b/bridge/src/rpc_controller.h
@@ -72 +72 @@ public:
-  bool isEnabled() const { return lp_ != nullptr; }
+  [[nodiscard]] bool isEnabled() const { return lp_ != nullptr; }
diff --git a/include/livekit/remote_track_publication.h b/include/livekit/remote_track_publication.h
index aa39408..9169a52 100644
--- a/include/livekit/remote_track_publication.h
+++ b/include/livekit/remote_track_publication.h
@@ -36 +36 @@ public:
-  std::shared_ptr<Track> track() const noexcept;
+  [[nodiscard]] std::shared_ptr<Track> track() const noexcept;
@@ -38 +38 @@ public:
-  bool subscribed() const noexcept { return subscribed_; }
+  [[nodiscard]] bool subscribed() const noexcept { return subscribed_; }
diff --git a/src/ffi_client.h b/src/ffi_client.h
index bc5fd3e..120d9a5 100644
--- a/src/ffi_client.h
+++ b/src/ffi_client.h
@@ -170 +170 @@ private:
-    virtual bool matches(const proto::FfiEvent &event) const = 0;
+    [[nodiscard]] virtual bool matches(const proto::FfiEvent &event) const = 0;
@@ -179 +179 @@ private:
-    bool matches(const proto::FfiEvent &event) const override {
+    [[nodiscard]] bool matches(const proto::FfiEvent &event) const override {
diff --git a/src/video_stream.cpp b/src/video_stream.cpp
index ed65da9..5f25a65 100644
--- a/src/video_stream.cpp
+++ b/src/video_stream.cpp
@@ -50 +50 @@ VideoStream &VideoStream::operator=(VideoStream &&other) noexcept {
-  if (this == &other)
+  if (this == &other) {
@@ -51,0 +52 @@ VideoStream &VideoStream::operator=(VideoStream &&other) noexcept {
+}
diff --git a/src/tests/stress/test_room_stress.cpp b/src/tests/stress/test_room_stress.cpp
index 50cc986..602cb98 100644
--- a/src/tests/stress/test_room_stress.cpp
+++ b/src/tests/stress/test_room_stress.cpp
@@ -25,2 +25,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -241,2 +241,2 @@ TEST_F(RoomServerStressTest, RepeatedConnectDisconnect) {
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/bridge/include/livekit_bridge/livekit_bridge.h b/bridge/include/livekit_bridge/livekit_bridge.h
index 3b84322..1f2d44a 100644
--- a/bridge/include/livekit_bridge/livekit_bridge.h
+++ b/bridge/include/livekit_bridge/livekit_bridge.h
@@ -226 +226 @@ public:
-                               const AudioFrameCallback& callback);
+                               AudioFrameCallback callback);
@@ -244 +244 @@ public:
-                               const VideoFrameCallback& callback);
+                               VideoFrameCallback callback);
diff --git a/bridge/src/livekit_bridge.cpp b/bridge/src/livekit_bridge.cpp
index b15587e..3869398 100644
--- a/bridge/src/livekit_bridge.cpp
+++ b/bridge/src/livekit_bridge.cpp
@@ -242 +242 @@ void LiveKitBridge::setOnAudioFrameCallback(
-    AudioFrameCallback callback) {
+    const AudioFrameCallback& callback) {
@@ -255 +255 @@ void LiveKitBridge::setOnVideoFrameCallback(
-    VideoFrameCallback callback) {
+    const VideoFrameCallback& callback) {
diff --git a/src/tests/integration/test_audio_processing_module.cpp b/src/tests/integration/test_audio_processing_module.cpp
index 4c4b48c..3035481 100644
--- a/src/tests/integration/test_audio_processing_module.cpp
+++ b/src/tests/integration/test_audio_processing_module.cpp
@@ -31,2 +31,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -925,2 +925,2 @@ TEST_F(AudioProcessingModuleTest, AGCWithNoiseSuppressionCombined) {
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/src/lk_log.h b/src/lk_log.h
index 7c51596..e360ce3 100644
--- a/src/lk_log.h
+++ b/src/lk_log.h
@@ -23,2 +23,2 @@
-namespace livekit {
-namespace detail {
+
+namespace livekit::detail {
@@ -34,2 +34,2 @@ void shutdownLogger();
-} // namespace detail
-} // namespace livekit
+} // namespace livekit::detail
+
diff --git a/examples/simple_data_stream/main.cpp b/examples/simple_data_stream/main.cpp
index f8144b7..5b37fd5 100644
--- a/examples/simple_data_stream/main.cpp
+++ b/examples/simple_data_stream/main.cpp
@@ -41 +41 @@ std::string randomHexId(std::size_t nbytes = 16) {
-    std::uint8_t b = static_cast<std::uint8_t>(rng() & 0xFF);
+    auto b = static_cast<std::uint8_t>(rng() & 0xFF);
diff --git a/examples/bridge_rpc/custom_caller.cpp b/examples/bridge_rpc/custom_caller.cpp
index 4ff5d35..ae32fac 100644
--- a/examples/bridge_rpc/custom_caller.cpp
+++ b/examples/bridge_rpc/custom_caller.cpp
@@ -54 +54 @@ int main(int argc, char *argv[]) {
-    if (e)
+    if (e) {
@@ -55,0 +56 @@ int main(int argc, char *argv[]) {
+}
@@ -57 +58 @@ int main(int argc, char *argv[]) {
-    if (e)
+    if (e) {
@@ -58,0 +60 @@ int main(int argc, char *argv[]) {
+}
@@ -79 +81 @@ int main(int argc, char *argv[]) {
-  for (int i = 0; i < 30 && g_running.load(); ++i)
+  for (int i = 0; i < 30 && g_running.load(); ++i) {
@@ -80,0 +83 @@ int main(int argc, char *argv[]) {
+}
@@ -114 +117 @@ int main(int argc, char *argv[]) {
-    for (int i = 0; i < 10 && g_running.load(); ++i)
+    for (int i = 0; i < 10 && g_running.load(); ++i) {
@@ -115,0 +119 @@ int main(int argc, char *argv[]) {
+}
diff --git a/examples/bridge_rpc/custom_receiver.cpp b/examples/bridge_rpc/custom_receiver.cpp
index a98cbd3..74c595a 100644
--- a/examples/bridge_rpc/custom_receiver.cpp
+++ b/examples/bridge_rpc/custom_receiver.cpp
@@ -51 +51 @@ int main(int argc, char *argv[]) {
-    if (e)
+    if (e) {
@@ -52,0 +53 @@ int main(int argc, char *argv[]) {
+}
@@ -54 +55 @@ int main(int argc, char *argv[]) {
-    if (e)
+    if (e) {
@@ -55,0 +57 @@ int main(int argc, char *argv[]) {
+}
@@ -84 +86 @@ int main(int argc, char *argv[]) {
-        if (n % 10 == 0)
+        if (n % 10 == 0) {
@@ -86 +88 @@ int main(int argc, char *argv[]) {
-        else if (n % 5 == 0)
+        } else if (n % 5 == 0) {
@@ -87,0 +90 @@ int main(int argc, char *argv[]) {
+}
diff --git a/src/tests/common/test_common.h b/src/tests/common/test_common.h
index 3133adc..34b25f7 100644
--- a/src/tests/common/test_common.h
+++ b/src/tests/common/test_common.h
@@ -37,2 +37,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -303 +303 @@ private:
-    if (sorted.empty())
+    if (sorted.empty()) {
@@ -304,0 +305 @@ private:
+}
@@ -306 +307 @@ private:
-    if (index >= sorted.size())
+    if (index >= sorted.size()) {
@@ -307,0 +309 @@ private:
+}
@@ -438,2 +440,2 @@ protected:
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/include/livekit/data_stream.h b/include/livekit/data_stream.h
index 11d906c..ed375bd 100644
--- a/include/livekit/data_stream.h
+++ b/include/livekit/data_stream.h
@@ -81 +81 @@ public:
-  explicit TextStreamReader(TextStreamInfo info);
+  explicit TextStreamReader(const TextStreamInfo &info);
@@ -95 +95 @@ public:
-  const TextStreamInfo &info() const noexcept { return info_; }
+  [[nodiscard]] const TextStreamInfo &info() const noexcept { return info_; }
@@ -121 +121 @@ public:
-  explicit ByteStreamReader(ByteStreamInfo info);
+  explicit ByteStreamReader(const ByteStreamInfo &info);
@@ -131 +131 @@ public:
-  const ByteStreamInfo &info() const noexcept { return info_; }
+  [[nodiscard]] const ByteStreamInfo &info() const noexcept { return info_; }
@@ -159 +159 @@ public:
-  const std::string &streamId() const noexcept { return stream_id_; }
+  [[nodiscard]] const std::string &streamId() const noexcept { return stream_id_; }
@@ -162 +162 @@ public:
-  const std::string &topic() const noexcept { return topic_; }
+  [[nodiscard]] const std::string &topic() const noexcept { return topic_; }
@@ -165 +165 @@ public:
-  const std::string &mimeType() const noexcept { return mime_type_; }
+  [[nodiscard]] const std::string &mimeType() const noexcept { return mime_type_; }
@@ -168 +168 @@ public:
-  std::int64_t timestampMs() const noexcept { return timestamp_ms_; }
+  [[nodiscard]] std::int64_t timestampMs() const noexcept { return timestamp_ms_; }
@@ -171 +171 @@ public:
-  bool isClosed() const noexcept { return closed_; }
+  [[nodiscard]] bool isClosed() const noexcept { return closed_; }
@@ -241 +241 @@ public:
-  const TextStreamInfo &info() const noexcept { return info_; }
+  [[nodiscard]] const TextStreamInfo &info() const noexcept { return info_; }
@@ -266 +266 @@ public:
-  const ByteStreamInfo &info() const noexcept { return info_; }
+  [[nodiscard]] const ByteStreamInfo &info() const noexcept { return info_; }
diff --git a/src/rpc_error.cpp b/src/rpc_error.cpp
index 1e521cd..96848ee 100644
--- a/src/rpc_error.cpp
+++ b/src/rpc_error.cpp
@@ -52 +52 @@ RpcError RpcError::fromProto(const proto::RpcError &err) {
-  return RpcError(err.code(), err.message(), err.data());
+  return {err.code(), err.message(), err.data()};
@@ -57 +57 @@ RpcError RpcError::builtIn(ErrorCode code, const std::string &data) {
-  return RpcError(code, msg ? std::string(msg) : std::string{}, data);
+  return {code, msg ? std::string(msg) : std::string{}, data};
diff --git a/include/livekit/local_audio_track.h b/include/livekit/local_audio_track.h
index 9c46819..26ce63f 100644
--- a/include/livekit/local_audio_track.h
+++ b/include/livekit/local_audio_track.h
@@ -79 +79 @@ public:
-  std::string to_string() const;
+  [[nodiscard]] std::string to_string() const;
@@ -83 +83 @@ public:
-  std::shared_ptr<LocalTrackPublication> publication() const noexcept {
+  [[nodiscard]] std::shared_ptr<LocalTrackPublication> publication() const noexcept {
@@ -90 +90 @@ public:
-    local_publication_ = std::move(publication);
+    local_publication_ = publication;
diff --git a/include/livekit/remote_video_track.h b/include/livekit/remote_video_track.h
index ff65c4c..3e3d4a4 100644
--- a/include/livekit/remote_video_track.h
+++ b/include/livekit/remote_video_track.h
@@ -52 +52 @@ public:
-  std::string to_string() const;
+  [[nodiscard]] std::string to_string() const;
diff --git a/src/tests/integration/test_rpc.cpp b/src/tests/integration/test_rpc.cpp
index 1747eaf..1d1576a 100644
--- a/src/tests/integration/test_rpc.cpp
+++ b/src/tests/integration/test_rpc.cpp
@@ -29,2 +29,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -535,2 +535,2 @@ TEST_F(RpcIntegrationTest, OneMinuteIntegration) {
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/bridge/include/livekit_bridge/rpc_constants.h b/bridge/include/livekit_bridge/rpc_constants.h
index 3511239..e200fd7 100644
--- a/bridge/include/livekit_bridge/rpc_constants.h
+++ b/bridge/include/livekit_bridge/rpc_constants.h
@@ -24,2 +24,2 @@
-namespace livekit_bridge {
-namespace rpc {
+
+
@@ -32 +32 @@ namespace rpc {
-namespace track_control {
+namespace livekit_bridge::rpc::track_control {
@@ -52,3 +52,3 @@ std::string formatPayload(const char *action, const std::string &track_name);
-} // namespace track_control
-} // namespace rpc
-} // namespace livekit_bridge
+} // namespace livekit_bridge::rpc::track_control
+
+
diff --git a/examples/bridge_human_robot/human.cpp b/examples/bridge_human_robot/human.cpp
index 714a77a..c8bba88 100644
--- a/examples/bridge_human_robot/human.cpp
+++ b/examples/bridge_human_robot/human.cpp
@@ -92 +92 @@ static void renderFrame(const livekit::VideoFrame &frame) {
-  if (!src || size == 0)
+  if (!src || size == 0) {
@@ -93,0 +94 @@ static void renderFrame(const livekit::VideoFrame &frame) {
+}
@@ -141 +142 @@ int main(int argc, char *argv[]) {
-    if (url.empty())
+    if (url.empty()) {
@@ -142,0 +144 @@ int main(int argc, char *argv[]) {
+}
@@ -145 +147 @@ int main(int argc, char *argv[]) {
-    if (e)
+    if (e) {
@@ -146,0 +149 @@ int main(int argc, char *argv[]) {
+}
@@ -148 +151 @@ int main(int argc, char *argv[]) {
-    if (e)
+    if (e) {
@@ -149,0 +153 @@ int main(int argc, char *argv[]) {
+}
@@ -219 +223 @@ int main(int argc, char *argv[]) {
-    if (samples.empty())
+    if (samples.empty()) {
@@ -220,0 +225 @@ int main(int argc, char *argv[]) {
+}
@@ -341 +346 @@ int main(int argc, char *argv[]) {
-        if (texture)
+        if (texture) {
@@ -342,0 +348 @@ int main(int argc, char *argv[]) {
+}
@@ -395 +401 @@ int main(int argc, char *argv[]) {
-  if (input_thread.joinable())
+  if (input_thread.joinable()) {
@@ -396,0 +403 @@ int main(int argc, char *argv[]) {
+}
@@ -408 +415 @@ int main(int argc, char *argv[]) {
-  if (texture)
+  if (texture) {
@@ -409,0 +417 @@ int main(int argc, char *argv[]) {
+}
diff --git a/include/livekit/video_source.h b/include/livekit/video_source.h
index 47715dc..62bb064 100644
--- a/include/livekit/video_source.h
+++ b/include/livekit/video_source.h
@@ -63,2 +63,2 @@ public:
-  int width() const noexcept { return width_; }
-  int height() const noexcept { return height_; }
+  [[nodiscard]] int width() const noexcept { return width_; }
+  [[nodiscard]] int height() const noexcept { return height_; }
@@ -67 +67 @@ public:
-  std::uint64_t ffi_handle_id() const noexcept { return handle_.get(); }
+  [[nodiscard]] std::uint64_t ffi_handle_id() const noexcept { return handle_.get(); }
diff --git a/include/livekit/remote_data_track.h b/include/livekit/remote_data_track.h
index 762140b..53986b0 100644
--- a/include/livekit/remote_data_track.h
+++ b/include/livekit/remote_data_track.h
@@ -61 +61 @@ public:
-  const DataTrackInfo &info() const noexcept { return info_; }
+  [[nodiscard]] const DataTrackInfo &info() const noexcept { return info_; }
@@ -64 +64 @@ public:
-  const std::string &publisherIdentity() const noexcept {
+  [[nodiscard]] const std::string &publisherIdentity() const noexcept {
@@ -69 +69 @@ public:
-  bool isPublished() const;
+  [[nodiscard]] bool isPublished() const;
@@ -90 +90 @@ private:
-  uintptr_t ffi_handle_id() const noexcept { return handle_.get(); }
+  [[nodiscard]] uintptr_t ffi_handle_id() const noexcept { return handle_.get(); }
diff --git a/bridge/src/rpc_constants.cpp b/bridge/src/rpc_constants.cpp
index 03386fe..bf8dde3 100644
--- a/bridge/src/rpc_constants.cpp
+++ b/bridge/src/rpc_constants.cpp
@@ -19,3 +19,3 @@
-namespace livekit_bridge {
-namespace rpc {
-namespace track_control {
+
+
+namespace livekit_bridge::rpc::track_control {
@@ -39,3 +39,3 @@ std::string formatPayload(const char *action, const std::string &track_name) {
-} // namespace track_control
-} // namespace rpc
-} // namespace livekit_bridge
+} // namespace livekit_bridge::rpc::track_control
+
+
diff --git a/include/livekit/e2ee.h b/include/livekit/e2ee.h
index e6473ae..f54f712 100644
--- a/include/livekit/e2ee.h
+++ b/include/livekit/e2ee.h
@@ -127 +127 @@ public:
-    const KeyProviderOptions &options() const;
+    [[nodiscard]] const KeyProviderOptions &options() const;
@@ -133 +133 @@ public:
-    std::vector<std::uint8_t> exportSharedKey(int key_index = 0) const;
+    [[nodiscard]] std::vector<std::uint8_t> exportSharedKey(int key_index = 0) const;
@@ -143 +143 @@ public:
-    std::vector<std::uint8_t> exportKey(const std::string &participant_identity,
+    [[nodiscard]] std::vector<std::uint8_t> exportKey(const std::string &participant_identity,
@@ -167,3 +167,3 @@ public:
-    const std::string &participantIdentity() const;
-    int keyIndex() const;
-    bool enabled() const;
+    [[nodiscard]] const std::string &participantIdentity() const;
+    [[nodiscard]] int keyIndex() const;
+    [[nodiscard]] bool enabled() const;
@@ -191 +191 @@ public:
-  bool enabled() const;
+  [[nodiscard]] bool enabled() const;
@@ -203 +203 @@ public:
-  const KeyProvider *keyProvider() const;
+  [[nodiscard]] const KeyProvider *keyProvider() const;
@@ -206 +206 @@ public:
-  std::vector<E2EEManager::FrameCryptor> frameCryptors() const;
+  [[nodiscard]] std::vector<E2EEManager::FrameCryptor> frameCryptors() const;
diff --git a/include/livekit/track.h b/include/livekit/track.h
index 35b1abf..5b5e3a6 100644
--- a/include/livekit/track.h
+++ b/include/livekit/track.h
@@ -78,6 +78,6 @@ public:
-  const std::string &sid() const noexcept { return sid_; }
-  const std::string &name() const noexcept { return name_; }
-  TrackKind kind() const noexcept { return kind_; }
-  StreamState stream_state() const noexcept { return state_; }
-  bool muted() const noexcept { return muted_; }
-  bool remote() const noexcept { return remote_; }
+  [[nodiscard]] const std::string &sid() const noexcept { return sid_; }
+  [[nodiscard]] const std::string &name() const noexcept { return name_; }
+  [[nodiscard]] TrackKind kind() const noexcept { return kind_; }
+  [[nodiscard]] StreamState stream_state() const noexcept { return state_; }
+  [[nodiscard]] bool muted() const noexcept { return muted_; }
+  [[nodiscard]] bool remote() const noexcept { return remote_; }
@@ -86,5 +86,5 @@ public:
-  std::optional<TrackSource> source() const noexcept { return source_; }
-  std::optional<bool> simulcasted() const noexcept { return simulcasted_; }
-  std::optional<uint32_t> width() const noexcept { return width_; }
-  std::optional<uint32_t> height() const noexcept { return height_; }
-  std::optional<std::string> mime_type() const noexcept { return mime_type_; }
+  [[nodiscard]] std::optional<TrackSource> source() const noexcept { return source_; }
+  [[nodiscard]] std::optional<bool> simulcasted() const noexcept { return simulcasted_; }
+  [[nodiscard]] std::optional<uint32_t> width() const noexcept { return width_; }
+  [[nodiscard]] std::optional<uint32_t> height() const noexcept { return height_; }
+  [[nodiscard]] std::optional<std::string> mime_type() const noexcept { return mime_type_; }
@@ -93,2 +93,2 @@ public:
-  bool has_handle() const noexcept { return handle_.valid(); }
-  uintptr_t ffi_handle_id() const noexcept { return handle_.get(); }
+  [[nodiscard]] bool has_handle() const noexcept { return handle_.valid(); }
+  [[nodiscard]] uintptr_t ffi_handle_id() const noexcept { return handle_.get(); }
@@ -97 +97 @@ public:
-  std::future<std::vector<RtcStats>> getStats() const;
+  [[nodiscard]] std::future<std::vector<RtcStats>> getStats() const;
@@ -119 +119 @@ protected:
-                            const std::optional<std::string>& mime_type);
+                            std::optional<std::string> mime_type);
diff --git a/src/data_stream.cpp b/src/data_stream.cpp
index 4db1312..cc2da47 100644
--- a/src/data_stream.cpp
+++ b/src/data_stream.cpp
@@ -6,0 +7 @@
+#include <utility>
@@ -36 +37 @@ std::vector<std::string> splitUtf8(const std::string &s,
-  if (s.empty())
+  if (s.empty()) {
@@ -37,0 +39 @@ std::vector<std::string> splitUtf8(const std::string &s,
+}
@@ -91 +93 @@ void fillBaseInfo(BaseStreamInfo &dst, const std::string &stream_id,
-TextStreamReader::TextStreamReader(const TextStreamInfo &info) : info_(info) {}
+TextStreamReader::TextStreamReader(TextStreamInfo info) : info_(std::move(info)) {}
@@ -96 +98 @@ void TextStreamReader::onChunkUpdate(const std::string &text) {
-    if (closed_)
+    if (closed_) {
@@ -97,0 +100 @@ void TextStreamReader::onChunkUpdate(const std::string &text) {
+}
@@ -130 +133 @@ std::string TextStreamReader::readAll() {
-  while (readNext(chunk))
+  while (readNext(chunk)) {
@@ -131,0 +135 @@ std::string TextStreamReader::readAll() {
+}
@@ -135 +139 @@ std::string TextStreamReader::readAll() {
-ByteStreamReader::ByteStreamReader(const ByteStreamInfo &info) : info_(info) {}
+ByteStreamReader::ByteStreamReader(ByteStreamInfo info) : info_(std::move(info)) {}
@@ -140 +144 @@ void ByteStreamReader::onChunkUpdate(const std::vector<std::uint8_t> &bytes) {
-    if (closed_)
+    if (closed_) {
@@ -141,0 +146 @@ void ByteStreamReader::onChunkUpdate(const std::vector<std::uint8_t> &bytes) {
+}
@@ -176 +181 @@ BaseStreamWriter::BaseStreamWriter(
-    LocalParticipant &local_participant, const std::string &topic,
+    LocalParticipant &local_participant, std::string topic,
@@ -179 +184 @@ BaseStreamWriter::BaseStreamWriter(
-    const std::string &mime_type,
+    std::string mime_type,
@@ -181 +186 @@ BaseStreamWriter::BaseStreamWriter(
-    const std::string &sender_identity)
+    std::string sender_identity)
@@ -184 +189 @@ BaseStreamWriter::BaseStreamWriter(
-      mime_type_(mime_type), topic_(topic),
+      mime_type_(std::move(mime_type)), topic_(std::move(topic)),
@@ -190 +195 @@ BaseStreamWriter::BaseStreamWriter(
-      sender_identity_(sender_identity) {
+      sender_identity_(std::move(sender_identity)) {
@@ -197 +202 @@ void BaseStreamWriter::ensureHeaderSent() {
-  if (header_sent_)
+  if (header_sent_) {
@@ -198,0 +204 @@ void BaseStreamWriter::ensureHeaderSent() {
+}
@@ -230 +236 @@ void BaseStreamWriter::sendChunk(const std::vector<std::uint8_t> &content) {
-  if (closed_)
+  if (closed_) {
@@ -231,0 +238 @@ void BaseStreamWriter::sendChunk(const std::vector<std::uint8_t> &content) {
+}
@@ -268 +275 @@ void BaseStreamWriter::close(
-  if (closed_)
+  if (closed_) {
@@ -269,0 +277 @@ void BaseStreamWriter::close(
+}
@@ -293 +301 @@ void TextStreamWriter::write(const std::string &text) {
-  if (closed_)
+  if (closed_) {
@@ -294,0 +303 @@ void TextStreamWriter::write(const std::string &text) {
+}
@@ -324 +333 @@ void ByteStreamWriter::write(const std::vector<std::uint8_t> &data) {
-  if (closed_)
+  if (closed_) {
@@ -325,0 +335 @@ void ByteStreamWriter::write(const std::vector<std::uint8_t> &data) {
+}
diff --git a/examples/simple_joystick/sender.cpp b/examples/simple_joystick/sender.cpp
index a235c3d..50907cc 100644
--- a/examples/simple_joystick/sender.cpp
+++ b/examples/simple_joystick/sender.cpp
@@ -78 +78 @@ int readKeyNonBlocking() {
-    if (read(STDIN_FILENO, &ch, 1) == 1)
+    if (read(STDIN_FILENO, &ch, 1) == 1) {
@@ -79,0 +80 @@ int readKeyNonBlocking() {
+}
@@ -228 +229 @@ int main(int argc, char *argv[]) {
-    if (!changed)
+    if (!changed) {
@@ -229,0 +231 @@ int main(int argc, char *argv[]) {
+}
diff --git a/include/livekit/subscription_thread_dispatcher.h b/include/livekit/subscription_thread_dispatcher.h
index fbc531a..b5158e1 100644
--- a/include/livekit/subscription_thread_dispatcher.h
+++ b/include/livekit/subscription_thread_dispatcher.h
@@ -407 +407 @@ private:
-                                     const AudioFrameCallback& cb,
+                                     AudioFrameCallback cb,
@@ -416 +416 @@ private:
-                                     const VideoFrameCallback& cb,
+                                     VideoFrameCallback cb,
@@ -432 +432 @@ private:
-                        const DataFrameCallback& cb);
+                        DataFrameCallback cb);
diff --git a/examples/simple_joystick/utils.cpp b/examples/simple_joystick/utils.cpp
index cc0ef96..e7f7fc0 100644
--- a/examples/simple_joystick/utils.cpp
+++ b/examples/simple_joystick/utils.cpp
@@ -50 +50 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token) {
-      if (!v.empty())
+      if (!v.empty()) {
@@ -51,0 +52 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token) {
+}
@@ -54 +55 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token) {
-      if (!v.empty())
+      if (!v.empty()) {
@@ -55,0 +57 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token) {
+}
@@ -63 +65 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token) {
-    if (a.rfind("--", 0) == 0)
+    if (a.rfind("--", 0) == 0) {
@@ -64,0 +67 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token) {
+}
@@ -67 +70 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token) {
-  if (url.empty() && pos.size() >= 1)
+  if (url.empty() && pos.size() >= 1) {
@@ -69 +72,2 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token) {
-  if (token.empty() && pos.size() >= 2)
+}
+  if (token.empty() && pos.size() >= 2) {
@@ -70,0 +75 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token) {
+}
@@ -75 +80 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token) {
-    if (e)
+    if (e) {
@@ -76,0 +82 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token) {
+}
@@ -80 +86 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token) {
-    if (e)
+    if (e) {
@@ -81,0 +88 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token) {
+}
diff --git a/src/subscription_thread_dispatcher.cpp b/src/subscription_thread_dispatcher.cpp
index ee68365..2c7f771 100644
--- a/src/subscription_thread_dispatcher.cpp
+++ b/src/subscription_thread_dispatcher.cpp
@@ -34 +34 @@ const char *trackKindName(TrackKind kind) {
-  if (kind == TrackKind::KIND_AUDIO)
+  if (kind == TrackKind::KIND_AUDIO) {
@@ -36 +36,2 @@ const char *trackKindName(TrackKind kind) {
-  if (kind == TrackKind::KIND_VIDEO)
+}
+  if (kind == TrackKind::KIND_VIDEO) {
@@ -38 +39,2 @@ const char *trackKindName(TrackKind kind) {
-  if (kind == TrackKind::KIND_UNKNOWN)
+}
+  if (kind == TrackKind::KIND_UNKNOWN) {
@@ -39,0 +42 @@ const char *trackKindName(TrackKind kind) {
+}
@@ -90 +93 @@ void SubscriptionThreadDispatcher::setOnVideoFrameCallback(
-      RegisteredVideoCallback{std::move(callback), std::move(opts)};
+      RegisteredVideoCallback{std::move(callback), opts};
@@ -105 +108 @@ void SubscriptionThreadDispatcher::setOnVideoFrameCallback(
-      RegisteredVideoCallback{std::move(callback), std::move(opts)};
+      RegisteredVideoCallback{std::move(callback), opts};
@@ -478 +481 @@ std::thread SubscriptionThreadDispatcher::startAudioReaderLocked(
-    AudioFrameCallback cb, const AudioStream::Options &opts) {
+    const AudioFrameCallback& cb, const AudioStream::Options &opts) {
@@ -501 +504 @@ std::thread SubscriptionThreadDispatcher::startAudioReaderLocked(
-  auto stream_copy = stream;
+  const auto& stream_copy = stream;
@@ -529 +532 @@ std::thread SubscriptionThreadDispatcher::startVideoReaderLocked(
-    VideoFrameCallback cb, const VideoStream::Options &opts) {
+    const VideoFrameCallback& cb, const VideoStream::Options &opts) {
@@ -552 +555 @@ std::thread SubscriptionThreadDispatcher::startVideoReaderLocked(
-  auto stream_copy = stream;
+  const auto& stream_copy = stream;
@@ -623 +626 @@ std::thread SubscriptionThreadDispatcher::startDataReaderLocked(
-    const std::shared_ptr<RemoteDataTrack> &track, DataFrameCallback cb) {
+    const std::shared_ptr<RemoteDataTrack> &track, const DataFrameCallback& cb) {
diff --git a/bridge/tests/test_bridge_audio_track.cpp b/bridge/tests/test_bridge_audio_track.cpp
index 8e7274e..ea6aa1f 100644
--- a/bridge/tests/test_bridge_audio_track.cpp
+++ b/bridge/tests/test_bridge_audio_track.cpp
@@ -27,2 +27,2 @@
-namespace livekit_bridge {
-namespace test {
+
+namespace livekit_bridge::test {
@@ -117,2 +117,2 @@ TEST_F(BridgeAudioTrackTest, UnmuteOnReleasedTrackDoesNotCrash) {
-} // namespace test
-} // namespace livekit_bridge
+} // namespace livekit_bridge::test
+
diff --git a/examples/common/sdl_media.h b/examples/common/sdl_media.h
index a60bca6..b90325a 100644
--- a/examples/common/sdl_media.h
+++ b/examples/common/sdl_media.h
@@ -50 +50 @@ public:
-  bool isValid() const { return stream_ != nullptr; }
+  [[nodiscard]] bool isValid() const { return stream_ != nullptr; }
@@ -80 +80 @@ public:
-  bool isValid() const { return stream_ != nullptr; }
+  [[nodiscard]] bool isValid() const { return stream_ != nullptr; }
@@ -118 +118 @@ public:
-  bool isValid() const { return camera_ != nullptr; }
+  [[nodiscard]] bool isValid() const { return camera_ != nullptr; }
diff --git a/src/video_frame.cpp b/src/video_frame.cpp
index 5fdc83e..ddf6572 100644
--- a/src/video_frame.cpp
+++ b/src/video_frame.cpp
@@ -291 +291 @@ std::vector<VideoPlaneInfo> VideoFrame::planeInfos() const {
-  uintptr_t base = reinterpret_cast<uintptr_t>(data_.data());
+  auto base = reinterpret_cast<uintptr_t>(data_.data());
diff --git a/examples/common/sdl_media_manager.cpp b/examples/common/sdl_media_manager.cpp
index 380334f..1728a71 100644
--- a/examples/common/sdl_media_manager.cpp
+++ b/examples/common/sdl_media_manager.cpp
@@ -76 +76 @@ bool SDLMediaManager::startMic(
-    if (recDevs)
+    if (recDevs) {
@@ -77,0 +78 @@ bool SDLMediaManager::startMic(
+}
@@ -160 +161 @@ bool SDLMediaManager::startCamera(
-    if (cams)
+    if (cams) {
@@ -161,0 +163 @@ bool SDLMediaManager::startCamera(
+}
diff --git a/src/room.cpp b/src/room.cpp
index 919e126..a71068f 100644
--- a/src/room.cpp
+++ b/src/room.cpp
@@ -276,2 +276,2 @@ void Room::setOnAudioFrameCallback(const std::string &participant_identity,
-                                   AudioFrameCallback callback,
-                                   AudioStream::Options opts) {
+                                   const AudioFrameCallback& callback,
+                                   const AudioStream::Options& opts) {
@@ -286,2 +286,2 @@ void Room::setOnAudioFrameCallback(const std::string &participant_identity,
-                                   AudioFrameCallback callback,
-                                   AudioStream::Options opts) {
+                                   const AudioFrameCallback& callback,
+                                   const AudioStream::Options& opts) {
@@ -296 +296 @@ void Room::setOnVideoFrameCallback(const std::string &participant_identity,
-                                   VideoFrameCallback callback,
+                                   const VideoFrameCallback& callback,
@@ -306 +306 @@ void Room::setOnVideoFrameCallback(const std::string &participant_identity,
-                                   VideoFrameCallback callback,
+                                   const VideoFrameCallback& callback,
@@ -349 +349 @@ Room::addOnDataFrameCallback(const std::string &participant_identity,
-                             DataFrameCallback callback) {
+                             const DataFrameCallback& callback) {
diff --git a/include/livekit/video_frame.h b/include/livekit/video_frame.h
index d9632f3..2882cb5 100644
--- a/include/livekit/video_frame.h
+++ b/include/livekit/video_frame.h
@@ -78,3 +78,3 @@ public:
-  int width() const noexcept { return width_; }
-  int height() const noexcept { return height_; }
-  VideoBufferType type() const noexcept { return type_; }
+  [[nodiscard]] int width() const noexcept { return width_; }
+  [[nodiscard]] int height() const noexcept { return height_; }
+  [[nodiscard]] VideoBufferType type() const noexcept { return type_; }
@@ -83,2 +83,2 @@ public:
-  const std::uint8_t *data() const noexcept { return data_.data(); }
-  std::size_t dataSize() const noexcept { return data_.size(); }
+  [[nodiscard]] const std::uint8_t *data() const noexcept { return data_.data(); }
+  [[nodiscard]] std::size_t dataSize() const noexcept { return data_.size(); }
@@ -92 +92 @@ public:
-  std::vector<VideoPlaneInfo> planeInfos() const;
+  [[nodiscard]] std::vector<VideoPlaneInfo> planeInfos() const;
@@ -119 +119 @@ public:
-  VideoFrame convert(VideoBufferType dst, bool flip_y = false) const;
+  [[nodiscard]] VideoFrame convert(VideoBufferType dst, bool flip_y = false) const;
diff --git a/include/livekit/rpc_error.h b/include/livekit/rpc_error.h
index 2efb988..d2215cc 100644
--- a/include/livekit/rpc_error.h
+++ b/include/livekit/rpc_error.h
@@ -85 +85 @@ public:
-  std::uint32_t code() const noexcept;
+  [[nodiscard]] std::uint32_t code() const noexcept;
@@ -90 +90 @@ public:
-  const std::string &message() const noexcept;
+  [[nodiscard]] const std::string &message() const noexcept;
@@ -96 +96 @@ public:
-  const std::string &data() const noexcept;
+  [[nodiscard]] const std::string &data() const noexcept;
@@ -109 +109 @@ protected:
-  proto::RpcError toProto() const;
+  [[nodiscard]] proto::RpcError toProto() const;
diff --git a/src/track.cpp b/src/track.cpp
index 2dd403d..831a65f 100644
--- a/src/track.cpp
+++ b/src/track.cpp
@@ -34 +34 @@ void Track::setPublicationFields(std::optional<TrackSource> source,
-                                 std::optional<std::string> mime_type) {
+                                 const std::optional<std::string>& mime_type) {
diff --git a/examples/simple_rpc/main.cpp b/examples/simple_rpc/main.cpp
index b171f9b..edb0e13 100644
--- a/examples/simple_rpc/main.cpp
+++ b/examples/simple_rpc/main.cpp
@@ -144 +144 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
-      if (!v.empty())
+      if (!v.empty()) {
@@ -145,0 +146 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
+}
@@ -148 +149 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
-      if (!v.empty())
+      if (!v.empty()) {
@@ -149,0 +151 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
+}
@@ -152 +154 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
-      if (!v.empty())
+      if (!v.empty()) {
@@ -153,0 +156 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
+}
@@ -160 +163 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
-    if (a.rfind("--", 0) == 0)
+    if (a.rfind("--", 0) == 0) {
@@ -161,0 +165 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
+}
@@ -178 +182 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
-    if (e)
+    if (e) {
@@ -179,0 +184 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
+}
@@ -183 +188 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
-    if (e)
+    if (e) {
@@ -184,0 +190 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
+}
@@ -188 +194 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
-    if (e)
+    if (e) {
@@ -189,0 +196 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
+}
@@ -212 +219 @@ double parseNumberFromJson(const std::string &json) {
-  if (colon == std::string::npos)
+  if (colon == std::string::npos) {
@@ -213,0 +221 @@ double parseNumberFromJson(const std::string &json) {
+}
@@ -222 +230 @@ std::string parseStringFromJson(const std::string &json) {
-  if (colon == std::string::npos)
+  if (colon == std::string::npos) {
@@ -223,0 +232 @@ std::string parseStringFromJson(const std::string &json) {
+}
@@ -225 +234 @@ std::string parseStringFromJson(const std::string &json) {
-  if (first_quote == std::string::npos)
+  if (first_quote == std::string::npos) {
@@ -226,0 +236 @@ std::string parseStringFromJson(const std::string &json) {
+}
@@ -228 +238 @@ std::string parseStringFromJson(const std::string &json) {
-  if (second_quote == std::string::npos)
+  if (second_quote == std::string::npos) {
@@ -229,0 +240 @@ std::string parseStringFromJson(const std::string &json) {
+}
@@ -381 +392 @@ void performDivide(Room *room) {
-    std::string payload = "{\"dividend\":10,\"divisor\":0}";
+    std::string payload = R"({"dividend":10,"divisor":0})";
diff --git a/examples/simple_room/main.cpp b/examples/simple_room/main.cpp
index 717519a..327189e 100644
--- a/examples/simple_room/main.cpp
+++ b/examples/simple_room/main.cpp
@@ -93 +93 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
-      if (!v.empty())
+      if (!v.empty()) {
@@ -94,0 +95 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
+}
@@ -97 +98 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
-      if (!v.empty())
+      if (!v.empty()) {
@@ -98,0 +100 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
+}
@@ -101 +103 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
-      if (!v.empty())
+      if (!v.empty()) {
@@ -102,0 +105 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
+}
@@ -111 +114 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
-      if (a.rfind("--", 0) == 0)
+      if (a.rfind("--", 0) == 0) {
@@ -112,0 +116 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
+}
@@ -116 +120 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
-      if (url.empty())
+      if (url.empty()) {
@@ -118 +122,2 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
-      if (token.empty())
+}
+      if (token.empty()) {
@@ -119,0 +125 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
+}
@@ -126 +132 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
-    if (e)
+    if (e) {
@@ -127,0 +134 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
+}
@@ -131 +138 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
-    if (e)
+    if (e) {
@@ -132,0 +140 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
+}
@@ -136 +144 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
-    if (e)
+    if (e) {
@@ -137,0 +146 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
+}
diff --git a/src/tests/integration/test_logging.cpp b/src/tests/integration/test_logging.cpp
index 88e1616..9077d59 100644
--- a/src/tests/integration/test_logging.cpp
+++ b/src/tests/integration/test_logging.cpp
@@ -28,2 +28,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -296,2 +296,2 @@ TEST_F(LoggingTest, ConcurrentLogEmissionDoesNotCrash) {
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/include/livekit/local_track_publication.h b/include/livekit/local_track_publication.h
index 3e8c6ed..cc8ebcd 100644
--- a/include/livekit/local_track_publication.h
+++ b/include/livekit/local_track_publication.h
@@ -36 +36 @@ public:
-  std::shared_ptr<Track> track() const noexcept;
+  [[nodiscard]] std::shared_ptr<Track> track() const noexcept;
diff --git a/src/tests/integration/test_room.cpp b/src/tests/integration/test_room.cpp
index f815472..0ed0fcf 100644
--- a/src/tests/integration/test_room.cpp
+++ b/src/tests/integration/test_room.cpp
@@ -20,2 +20,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -163,2 +163,2 @@ TEST_F(RoomServerTest, ConnectWithInvalidUrl) {
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/src/tests/integration/test_sdk_initialization.cpp b/src/tests/integration/test_sdk_initialization.cpp
index 4d8fa02..0d2e615 100644
--- a/src/tests/integration/test_sdk_initialization.cpp
+++ b/src/tests/integration/test_sdk_initialization.cpp
@@ -20,2 +20,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -72,2 +72,2 @@ TEST_F(SDKInitializationTest, MultipleShutdowns) {
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/include/livekit/result.h b/include/livekit/result.h
index bc7f133..e321b03 100644
--- a/include/livekit/result.h
+++ b/include/livekit/result.h
@@ -46 +46 @@ public:
-            typename = std::enable_if_t<std::is_constructible<T, U &&>::value>>
+            typename = std::enable_if_t<std::is_constructible_v<T, U &&>>>
@@ -54 +54 @@ public:
-            typename = std::enable_if_t<std::is_constructible<E, F &&>::value>>
+            typename = std::enable_if_t<std::is_constructible_v<E, F &&>>>
@@ -61 +61 @@ public:
-  bool ok() const noexcept { return storage_.index() == 0; }
+  [[nodiscard]] bool ok() const noexcept { return storage_.index() == 0; }
@@ -63 +63 @@ public:
-  bool has_error() const noexcept { return !ok(); }
+  [[nodiscard]] bool has_error() const noexcept { return !ok(); }
@@ -134 +134 @@ public:
-            typename = std::enable_if_t<std::is_constructible<E, F &&>::value>>
+            typename = std::enable_if_t<std::is_constructible_v<E, F &&>>>
@@ -140 +140 @@ public:
-  bool ok() const noexcept { return !error_.has_value(); }
+  [[nodiscard]] bool ok() const noexcept { return !error_.has_value(); }
@@ -142 +142 @@ public:
-  bool has_error() const noexcept { return error_.has_value(); }
+  [[nodiscard]] bool has_error() const noexcept { return error_.has_value(); }
diff --git a/examples/bridge_human_robot/robot.cpp b/examples/bridge_human_robot/robot.cpp
index f3e2f02..1d54a02 100644
--- a/examples/bridge_human_robot/robot.cpp
+++ b/examples/bridge_human_robot/robot.cpp
@@ -331 +331 @@ int main(int argc, char *argv[]) {
-    if (url.empty())
+    if (url.empty()) {
@@ -332,0 +333 @@ int main(int argc, char *argv[]) {
+}
@@ -335 +336 @@ int main(int argc, char *argv[]) {
-    if (e)
+    if (e) {
@@ -336,0 +338 @@ int main(int argc, char *argv[]) {
+}
@@ -338 +340 @@ int main(int argc, char *argv[]) {
-    if (e)
+    if (e) {
@@ -339,0 +342 @@ int main(int argc, char *argv[]) {
+}
@@ -409 +412 @@ int main(int argc, char *argv[]) {
-    if (recDevs)
+    if (recDevs) {
@@ -410,0 +414 @@ int main(int argc, char *argv[]) {
+}
@@ -465 +469 @@ int main(int argc, char *argv[]) {
-    if (cams)
+    if (cams) {
@@ -466,0 +471 @@ int main(int argc, char *argv[]) {
+}
@@ -605 +610 @@ int main(int argc, char *argv[]) {
-        if (phase > kTwoPi)
+        if (phase > kTwoPi) {
@@ -606,0 +612 @@ int main(int argc, char *argv[]) {
+}
@@ -608 +614 @@ int main(int argc, char *argv[]) {
-        for (int ch = 0; ch < kChannels; ++ch)
+        for (int ch = 0; ch < kChannels; ++ch) {
@@ -609,0 +616 @@ int main(int argc, char *argv[]) {
+}
@@ -641 +648 @@ int main(int argc, char *argv[]) {
-  if (mic_thread.joinable())
+  if (mic_thread.joinable()) {
@@ -643 +650,2 @@ int main(int argc, char *argv[]) {
-  if (cam_thread.joinable())
+}
+  if (cam_thread.joinable()) {
@@ -645 +653,2 @@ int main(int argc, char *argv[]) {
-  if (sim_thread.joinable())
+}
+  if (sim_thread.joinable()) {
@@ -647 +656,2 @@ int main(int argc, char *argv[]) {
-  if (sim_audio_thread.joinable())
+}
+  if (sim_audio_thread.joinable()) {
@@ -648,0 +659 @@ int main(int argc, char *argv[]) {
+}
diff --git a/include/livekit/local_data_track.h b/include/livekit/local_data_track.h
index 6d128de..a9ad6d5 100644
--- a/include/livekit/local_data_track.h
+++ b/include/livekit/local_data_track.h
@@ -66 +66 @@ public:
-  const DataTrackInfo &info() const noexcept { return info_; }
+  [[nodiscard]] const DataTrackInfo &info() const noexcept { return info_; }
@@ -87 +87 @@ public:
-  bool isPublished() const;
+  [[nodiscard]] bool isPublished() const;
@@ -101 +101 @@ private:
-  uintptr_t ffi_handle_id() const noexcept { return handle_.get(); }
+  [[nodiscard]] uintptr_t ffi_handle_id() const noexcept { return handle_.get(); }
diff --git a/src/tests/stress/test_latency_measurement.cpp b/src/tests/stress/test_latency_measurement.cpp
index e93d210..cb5d6b0 100644
--- a/src/tests/stress/test_latency_measurement.cpp
+++ b/src/tests/stress/test_latency_measurement.cpp
@@ -23,2 +23,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -46 +46 @@ static double calculateEnergy(const std::vector<int16_t> &samples) {
-  if (samples.empty())
+  if (samples.empty()) {
@@ -47,0 +48 @@ static double calculateEnergy(const std::vector<int16_t> &samples) {
+}
@@ -63 +64 @@ static std::vector<int16_t> generateHighEnergyFrame(int samples_per_channel) {
-    int16_t sample =
+    auto sample =
@@ -855,2 +856,2 @@ TEST_F(LatencyMeasurementTest, FullDeplexAudioLatency) {
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/bridge/tests/test_bridge_video_track.cpp b/bridge/tests/test_bridge_video_track.cpp
index 08517b0..5056601 100644
--- a/bridge/tests/test_bridge_video_track.cpp
+++ b/bridge/tests/test_bridge_video_track.cpp
@@ -27,2 +27,2 @@
-namespace livekit_bridge {
-namespace test {
+
+namespace livekit_bridge::test {
@@ -113,2 +113,2 @@ TEST_F(BridgeVideoTrackTest, UnmuteOnReleasedTrackDoesNotCrash) {
-} // namespace test
-} // namespace livekit_bridge
+} // namespace livekit_bridge::test
+
diff --git a/examples/bridge_mute_unmute/receiver.cpp b/examples/bridge_mute_unmute/receiver.cpp
index 1abafbc..cc65769 100644
--- a/examples/bridge_mute_unmute/receiver.cpp
+++ b/examples/bridge_mute_unmute/receiver.cpp
@@ -64 +64 @@ int main(int argc, char *argv[]) {
-    if (e)
+    if (e) {
@@ -65,0 +66 @@ int main(int argc, char *argv[]) {
+}
@@ -67 +68 @@ int main(int argc, char *argv[]) {
-    if (e)
+    if (e) {
@@ -68,0 +70 @@ int main(int argc, char *argv[]) {
+}
@@ -123 +125 @@ int main(int argc, char *argv[]) {
-    if (recDevs)
+    if (recDevs) {
@@ -124,0 +127 @@ int main(int argc, char *argv[]) {
+}
@@ -174 +177 @@ int main(int argc, char *argv[]) {
-    if (cams)
+    if (cams) {
@@ -175,0 +179 @@ int main(int argc, char *argv[]) {
+}
@@ -252 +256 @@ int main(int argc, char *argv[]) {
-  if (mic_thread.joinable())
+  if (mic_thread.joinable()) {
@@ -254 +258,2 @@ int main(int argc, char *argv[]) {
-  if (cam_thread.joinable())
+}
+  if (cam_thread.joinable()) {
@@ -255,0 +261 @@ int main(int argc, char *argv[]) {
+}
diff --git a/include/livekit/audio_processing_module.h b/include/livekit/audio_processing_module.h
index 29eab33..0935c99 100644
--- a/include/livekit/audio_processing_module.h
+++ b/include/livekit/audio_processing_module.h
@@ -159 +159 @@ private:
-  bool valid() const noexcept { return handle_.valid(); }
+  [[nodiscard]] bool valid() const noexcept { return handle_.valid(); }
@@ -162 +162 @@ private:
-  std::uint64_t ffi_handle_id() const noexcept {
+  [[nodiscard]] std::uint64_t ffi_handle_id() const noexcept {
diff --git a/include/livekit/track_publication.h b/include/livekit/track_publication.h
index 5d0ff47..9cf1c78 100644
--- a/include/livekit/track_publication.h
+++ b/include/livekit/track_publication.h
@@ -50,9 +50,9 @@ public:
-  const std::string &sid() const noexcept { return sid_; }
-  const std::string &name() const noexcept { return name_; }
-  TrackKind kind() const noexcept { return kind_; }
-  TrackSource source() const noexcept { return source_; }
-  bool simulcasted() const noexcept { return simulcasted_; }
-  std::uint32_t width() const noexcept { return width_; }
-  std::uint32_t height() const noexcept { return height_; }
-  const std::string &mimeType() const noexcept { return mime_type_; }
-  bool muted() const noexcept { return muted_; }
+  [[nodiscard]] const std::string &sid() const noexcept { return sid_; }
+  [[nodiscard]] const std::string &name() const noexcept { return name_; }
+  [[nodiscard]] TrackKind kind() const noexcept { return kind_; }
+  [[nodiscard]] TrackSource source() const noexcept { return source_; }
+  [[nodiscard]] bool simulcasted() const noexcept { return simulcasted_; }
+  [[nodiscard]] std::uint32_t width() const noexcept { return width_; }
+  [[nodiscard]] std::uint32_t height() const noexcept { return height_; }
+  [[nodiscard]] const std::string &mimeType() const noexcept { return mime_type_; }
+  [[nodiscard]] bool muted() const noexcept { return muted_; }
@@ -61,2 +61,2 @@ public:
-  EncryptionType encryptionType() const noexcept { return encryption_type_; }
-  const std::vector<AudioTrackFeature> &audioFeatures() const noexcept {
+  [[nodiscard]] EncryptionType encryptionType() const noexcept { return encryption_type_; }
+  [[nodiscard]] const std::vector<AudioTrackFeature> &audioFeatures() const noexcept {
@@ -67 +67 @@ public:
-  uintptr_t ffiHandleId() const noexcept { return handle_.get(); }
+  [[nodiscard]] uintptr_t ffiHandleId() const noexcept { return handle_.get(); }
@@ -70 +70 @@ public:
-  std::shared_ptr<Track> track() const noexcept { return track_; }
+  [[nodiscard]] std::shared_ptr<Track> track() const noexcept { return track_; }

Have any feedback or feature suggestions? Share it here.

Copy link
Copy Markdown

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cpp-linter Review

Used clang-tidy v20.1.2

Click here for the full clang-tidy patch
diff --git a/include/livekit/remote_audio_track.h b/include/livekit/remote_audio_track.h
index 572e62c..5de6003 100644
--- a/include/livekit/remote_audio_track.h
+++ b/include/livekit/remote_audio_track.h
@@ -52 +52 @@ public:
-  std::string to_string() const;
+  [[nodiscard]] std::string to_string() const;
diff --git a/examples/common/sdl_media.cpp b/examples/common/sdl_media.cpp
index 4961f51..cc14d75 100644
--- a/examples/common/sdl_media.cpp
+++ b/examples/common/sdl_media.cpp
@@ -65 +65 @@ void SDLMicSource::pump() {
-  if (!stream_ || !callback_)
+  if (!stream_ || !callback_) {
@@ -66,0 +67 @@ void SDLMicSource::pump() {
+}
@@ -142 +143 @@ void DDLSpeakerSink::enqueue(const int16_t *samples,
-  if (!stream_ || !samples)
+  if (!stream_ || !samples) {
@@ -143,0 +145 @@ void DDLSpeakerSink::enqueue(const int16_t *samples,
+}
@@ -186 +188 @@ bool SDLCamSource::init() {
-    if (cams)
+    if (cams) {
@@ -187,0 +190 @@ bool SDLCamSource::init() {
+}
@@ -214 +217 @@ void SDLCamSource::pump() {
-  if (!camera_ || !callback_)
+  if (!camera_ || !callback_) {
@@ -215,0 +219 @@ void SDLCamSource::pump() {
+}
diff --git a/include/livekit/room.h b/include/livekit/room.h
index 688f9c6..c8e501d 100644
--- a/include/livekit/room.h
+++ b/include/livekit/room.h
@@ -247,2 +247,2 @@ public:
-                               TrackSource source, const AudioFrameCallback& callback,
-                               const AudioStream::Options& opts = {});
+                               TrackSource source, AudioFrameCallback callback,
+                               AudioStream::Options opts = {});
@@ -255,2 +255,2 @@ public:
-                               const AudioFrameCallback& callback,
-                               const AudioStream::Options& opts = {});
+                               AudioFrameCallback callback,
+                               AudioStream::Options opts = {});
@@ -262 +262 @@ public:
-                               TrackSource source, const VideoFrameCallback& callback,
+                               TrackSource source, VideoFrameCallback callback,
@@ -270 +270 @@ public:
-                               const VideoFrameCallback& callback,
+                               VideoFrameCallback callback,
@@ -302 +302 @@ public:
-                         const DataFrameCallback& callback);
+                         DataFrameCallback callback);
diff --git a/bridge/tests/test_bridge_video_track.cpp b/bridge/tests/test_bridge_video_track.cpp
index 08517b0..5056601 100644
--- a/bridge/tests/test_bridge_video_track.cpp
+++ b/bridge/tests/test_bridge_video_track.cpp
@@ -27,2 +27,2 @@
-namespace livekit_bridge {
-namespace test {
+
+namespace livekit_bridge::test {
@@ -113,2 +113,2 @@ TEST_F(BridgeVideoTrackTest, UnmuteOnReleasedTrackDoesNotCrash) {
-} // namespace test
-} // namespace livekit_bridge
+} // namespace livekit_bridge::test
+
diff --git a/include/livekit/remote_data_track.h b/include/livekit/remote_data_track.h
index 762140b..53986b0 100644
--- a/include/livekit/remote_data_track.h
+++ b/include/livekit/remote_data_track.h
@@ -61 +61 @@ public:
-  const DataTrackInfo &info() const noexcept { return info_; }
+  [[nodiscard]] const DataTrackInfo &info() const noexcept { return info_; }
@@ -64 +64 @@ public:
-  const std::string &publisherIdentity() const noexcept {
+  [[nodiscard]] const std::string &publisherIdentity() const noexcept {
@@ -69 +69 @@ public:
-  bool isPublished() const;
+  [[nodiscard]] bool isPublished() const;
@@ -90 +90 @@ private:
-  uintptr_t ffi_handle_id() const noexcept { return handle_.get(); }
+  [[nodiscard]] uintptr_t ffi_handle_id() const noexcept { return handle_.get(); }
diff --git a/include/livekit/track.h b/include/livekit/track.h
index 35b1abf..5b5e3a6 100644
--- a/include/livekit/track.h
+++ b/include/livekit/track.h
@@ -78,6 +78,6 @@ public:
-  const std::string &sid() const noexcept { return sid_; }
-  const std::string &name() const noexcept { return name_; }
-  TrackKind kind() const noexcept { return kind_; }
-  StreamState stream_state() const noexcept { return state_; }
-  bool muted() const noexcept { return muted_; }
-  bool remote() const noexcept { return remote_; }
+  [[nodiscard]] const std::string &sid() const noexcept { return sid_; }
+  [[nodiscard]] const std::string &name() const noexcept { return name_; }
+  [[nodiscard]] TrackKind kind() const noexcept { return kind_; }
+  [[nodiscard]] StreamState stream_state() const noexcept { return state_; }
+  [[nodiscard]] bool muted() const noexcept { return muted_; }
+  [[nodiscard]] bool remote() const noexcept { return remote_; }
@@ -86,5 +86,5 @@ public:
-  std::optional<TrackSource> source() const noexcept { return source_; }
-  std::optional<bool> simulcasted() const noexcept { return simulcasted_; }
-  std::optional<uint32_t> width() const noexcept { return width_; }
-  std::optional<uint32_t> height() const noexcept { return height_; }
-  std::optional<std::string> mime_type() const noexcept { return mime_type_; }
+  [[nodiscard]] std::optional<TrackSource> source() const noexcept { return source_; }
+  [[nodiscard]] std::optional<bool> simulcasted() const noexcept { return simulcasted_; }
+  [[nodiscard]] std::optional<uint32_t> width() const noexcept { return width_; }
+  [[nodiscard]] std::optional<uint32_t> height() const noexcept { return height_; }
+  [[nodiscard]] std::optional<std::string> mime_type() const noexcept { return mime_type_; }
@@ -93,2 +93,2 @@ public:
-  bool has_handle() const noexcept { return handle_.valid(); }
-  uintptr_t ffi_handle_id() const noexcept { return handle_.get(); }
+  [[nodiscard]] bool has_handle() const noexcept { return handle_.valid(); }
+  [[nodiscard]] uintptr_t ffi_handle_id() const noexcept { return handle_.get(); }
@@ -97 +97 @@ public:
-  std::future<std::vector<RtcStats>> getStats() const;
+  [[nodiscard]] std::future<std::vector<RtcStats>> getStats() const;
@@ -119 +119 @@ protected:
-                            const std::optional<std::string>& mime_type);
+                            std::optional<std::string> mime_type);
diff --git a/include/livekit/local_track_publication.h b/include/livekit/local_track_publication.h
index 3e8c6ed..cc8ebcd 100644
--- a/include/livekit/local_track_publication.h
+++ b/include/livekit/local_track_publication.h
@@ -36 +36 @@ public:
-  std::shared_ptr<Track> track() const noexcept;
+  [[nodiscard]] std::shared_ptr<Track> track() const noexcept;
diff --git a/bridge/tests/integration/test_bridge_rpc_roundtrip.cpp b/bridge/tests/integration/test_bridge_rpc_roundtrip.cpp
index e649450..b0012e4 100644
--- a/bridge/tests/integration/test_bridge_rpc_roundtrip.cpp
+++ b/bridge/tests/integration/test_bridge_rpc_roundtrip.cpp
@@ -20,2 +20,2 @@
-namespace livekit_bridge {
-namespace test {
+
+namespace livekit_bridge::test {
@@ -270,2 +270,2 @@ TEST_F(BridgeRemoteTrackControlTest, RemoteMuteNonexistentTrack) {
-} // namespace test
-} // namespace livekit_bridge
+} // namespace livekit_bridge::test
+
diff --git a/include/livekit/remote_track_publication.h b/include/livekit/remote_track_publication.h
index aa39408..9169a52 100644
--- a/include/livekit/remote_track_publication.h
+++ b/include/livekit/remote_track_publication.h
@@ -36 +36 @@ public:
-  std::shared_ptr<Track> track() const noexcept;
+  [[nodiscard]] std::shared_ptr<Track> track() const noexcept;
@@ -38 +38 @@ public:
-  bool subscribed() const noexcept { return subscribed_; }
+  [[nodiscard]] bool subscribed() const noexcept { return subscribed_; }
diff --git a/src/tests/integration/test_room.cpp b/src/tests/integration/test_room.cpp
index f815472..0ed0fcf 100644
--- a/src/tests/integration/test_room.cpp
+++ b/src/tests/integration/test_room.cpp
@@ -20,2 +20,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -163,2 +163,2 @@ TEST_F(RoomServerTest, ConnectWithInvalidUrl) {
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/src/ffi_client.h b/src/ffi_client.h
index bc5fd3e..120d9a5 100644
--- a/src/ffi_client.h
+++ b/src/ffi_client.h
@@ -170 +170 @@ private:
-    virtual bool matches(const proto::FfiEvent &event) const = 0;
+    [[nodiscard]] virtual bool matches(const proto::FfiEvent &event) const = 0;
@@ -179 +179 @@ private:
-    bool matches(const proto::FfiEvent &event) const override {
+    [[nodiscard]] bool matches(const proto::FfiEvent &event) const override {
diff --git a/include/livekit/remote_video_track.h b/include/livekit/remote_video_track.h
index ff65c4c..3e3d4a4 100644
--- a/include/livekit/remote_video_track.h
+++ b/include/livekit/remote_video_track.h
@@ -52 +52 @@ public:
-  std::string to_string() const;
+  [[nodiscard]] std::string to_string() const;
diff --git a/examples/bridge_rpc/custom_receiver.cpp b/examples/bridge_rpc/custom_receiver.cpp
index a98cbd3..74c595a 100644
--- a/examples/bridge_rpc/custom_receiver.cpp
+++ b/examples/bridge_rpc/custom_receiver.cpp
@@ -51 +51 @@ int main(int argc, char *argv[]) {
-    if (e)
+    if (e) {
@@ -52,0 +53 @@ int main(int argc, char *argv[]) {
+}
@@ -54 +55 @@ int main(int argc, char *argv[]) {
-    if (e)
+    if (e) {
@@ -55,0 +57 @@ int main(int argc, char *argv[]) {
+}
@@ -84 +86 @@ int main(int argc, char *argv[]) {
-        if (n % 10 == 0)
+        if (n % 10 == 0) {
@@ -86 +88 @@ int main(int argc, char *argv[]) {
-        else if (n % 5 == 0)
+        } else if (n % 5 == 0) {
@@ -87,0 +90 @@ int main(int argc, char *argv[]) {
+}
diff --git a/bridge/include/livekit_bridge/livekit_bridge.h b/bridge/include/livekit_bridge/livekit_bridge.h
index 3b84322..1f2d44a 100644
--- a/bridge/include/livekit_bridge/livekit_bridge.h
+++ b/bridge/include/livekit_bridge/livekit_bridge.h
@@ -226 +226 @@ public:
-                               const AudioFrameCallback& callback);
+                               AudioFrameCallback callback);
@@ -244 +244 @@ public:
-                               const VideoFrameCallback& callback);
+                               VideoFrameCallback callback);
diff --git a/examples/simple_joystick/utils.cpp b/examples/simple_joystick/utils.cpp
index cc0ef96..e7f7fc0 100644
--- a/examples/simple_joystick/utils.cpp
+++ b/examples/simple_joystick/utils.cpp
@@ -50 +50 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token) {
-      if (!v.empty())
+      if (!v.empty()) {
@@ -51,0 +52 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token) {
+}
@@ -54 +55 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token) {
-      if (!v.empty())
+      if (!v.empty()) {
@@ -55,0 +57 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token) {
+}
@@ -63 +65 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token) {
-    if (a.rfind("--", 0) == 0)
+    if (a.rfind("--", 0) == 0) {
@@ -64,0 +67 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token) {
+}
@@ -67 +70 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token) {
-  if (url.empty() && pos.size() >= 1)
+  if (url.empty() && pos.size() >= 1) {
@@ -69 +72,2 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token) {
-  if (token.empty() && pos.size() >= 2)
+}
+  if (token.empty() && pos.size() >= 2) {
@@ -70,0 +75 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token) {
+}
@@ -75 +80 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token) {
-    if (e)
+    if (e) {
@@ -76,0 +82 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token) {
+}
@@ -80 +86 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token) {
-    if (e)
+    if (e) {
@@ -81,0 +88 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token) {
+}
diff --git a/include/livekit/audio_frame.h b/include/livekit/audio_frame.h
index 2db2b9b..1e35b93 100644
--- a/include/livekit/audio_frame.h
+++ b/include/livekit/audio_frame.h
@@ -68 +68 @@ public:
-  const std::vector<std::int16_t> &data() const noexcept { return data_; }
+  [[nodiscard]] const std::vector<std::int16_t> &data() const noexcept { return data_; }
@@ -72 +72 @@ public:
-  std::size_t total_samples() const noexcept { return data_.size(); }
+  [[nodiscard]] std::size_t total_samples() const noexcept { return data_.size(); }
@@ -75 +75 @@ public:
-  int sample_rate() const noexcept { return sample_rate_; }
+  [[nodiscard]] int sample_rate() const noexcept { return sample_rate_; }
@@ -78 +78 @@ public:
-  int num_channels() const noexcept { return num_channels_; }
+  [[nodiscard]] int num_channels() const noexcept { return num_channels_; }
@@ -81 +81 @@ public:
-  int samples_per_channel() const noexcept { return samples_per_channel_; }
+  [[nodiscard]] int samples_per_channel() const noexcept { return samples_per_channel_; }
@@ -84 +84 @@ public:
-  double duration() const noexcept;
+  [[nodiscard]] double duration() const noexcept;
@@ -87 +87 @@ public:
-  std::string to_string() const;
+  [[nodiscard]] std::string to_string() const;
@@ -92 +92 @@ protected:
-  proto::AudioFrameBufferInfo toProto() const;
+  [[nodiscard]] proto::AudioFrameBufferInfo toProto() const;
diff --git a/src/tests/common/test_common.h b/src/tests/common/test_common.h
index 3133adc..34b25f7 100644
--- a/src/tests/common/test_common.h
+++ b/src/tests/common/test_common.h
@@ -37,2 +37,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -303 +303 @@ private:
-    if (sorted.empty())
+    if (sorted.empty()) {
@@ -304,0 +305 @@ private:
+}
@@ -306 +307 @@ private:
-    if (index >= sorted.size())
+    if (index >= sorted.size()) {
@@ -307,0 +309 @@ private:
+}
@@ -438,2 +440,2 @@ protected:
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/examples/bridge_human_robot/human.cpp b/examples/bridge_human_robot/human.cpp
index 714a77a..c8bba88 100644
--- a/examples/bridge_human_robot/human.cpp
+++ b/examples/bridge_human_robot/human.cpp
@@ -92 +92 @@ static void renderFrame(const livekit::VideoFrame &frame) {
-  if (!src || size == 0)
+  if (!src || size == 0) {
@@ -93,0 +94 @@ static void renderFrame(const livekit::VideoFrame &frame) {
+}
@@ -141 +142 @@ int main(int argc, char *argv[]) {
-    if (url.empty())
+    if (url.empty()) {
@@ -142,0 +144 @@ int main(int argc, char *argv[]) {
+}
@@ -145 +147 @@ int main(int argc, char *argv[]) {
-    if (e)
+    if (e) {
@@ -146,0 +149 @@ int main(int argc, char *argv[]) {
+}
@@ -148 +151 @@ int main(int argc, char *argv[]) {
-    if (e)
+    if (e) {
@@ -149,0 +153 @@ int main(int argc, char *argv[]) {
+}
@@ -219 +223 @@ int main(int argc, char *argv[]) {
-    if (samples.empty())
+    if (samples.empty()) {
@@ -220,0 +225 @@ int main(int argc, char *argv[]) {
+}
@@ -341 +346 @@ int main(int argc, char *argv[]) {
-        if (texture)
+        if (texture) {
@@ -342,0 +348 @@ int main(int argc, char *argv[]) {
+}
@@ -395 +401 @@ int main(int argc, char *argv[]) {
-  if (input_thread.joinable())
+  if (input_thread.joinable()) {
@@ -396,0 +403 @@ int main(int argc, char *argv[]) {
+}
@@ -408 +415 @@ int main(int argc, char *argv[]) {
-  if (texture)
+  if (texture) {
@@ -409,0 +417 @@ int main(int argc, char *argv[]) {
+}
diff --git a/examples/logging_levels/basic_usage.cpp b/examples/logging_levels/basic_usage.cpp
index 02cdb47..fc3451e 100644
--- a/examples/logging_levels/basic_usage.cpp
+++ b/examples/logging_levels/basic_usage.cpp
@@ -67 +67 @@ livekit::LogLevel parseLevel(const char *arg) {
-  if (std::strcmp(arg, "trace") == 0)
+  if (std::strcmp(arg, "trace") == 0) {
@@ -69 +69,2 @@ livekit::LogLevel parseLevel(const char *arg) {
-  if (std::strcmp(arg, "debug") == 0)
+}
+  if (std::strcmp(arg, "debug") == 0) {
@@ -71 +72,2 @@ livekit::LogLevel parseLevel(const char *arg) {
-  if (std::strcmp(arg, "info") == 0)
+}
+  if (std::strcmp(arg, "info") == 0) {
@@ -73 +75,2 @@ livekit::LogLevel parseLevel(const char *arg) {
-  if (std::strcmp(arg, "warn") == 0)
+}
+  if (std::strcmp(arg, "warn") == 0) {
@@ -75 +78,2 @@ livekit::LogLevel parseLevel(const char *arg) {
-  if (std::strcmp(arg, "error") == 0)
+}
+  if (std::strcmp(arg, "error") == 0) {
@@ -77 +81,2 @@ livekit::LogLevel parseLevel(const char *arg) {
-  if (std::strcmp(arg, "critical") == 0)
+}
+  if (std::strcmp(arg, "critical") == 0) {
@@ -79 +84,2 @@ livekit::LogLevel parseLevel(const char *arg) {
-  if (std::strcmp(arg, "off") == 0)
+}
+  if (std::strcmp(arg, "off") == 0) {
@@ -80,0 +87 @@ livekit::LogLevel parseLevel(const char *arg) {
+}
diff --git a/src/ffi_client.cpp b/src/ffi_client.cpp
index 9c20691..7ef11b4 100644
--- a/src/ffi_client.cpp
+++ b/src/ffi_client.cpp
@@ -654,2 +654 @@ FfiClient::publishDataTrackAsync(std::uint64_t local_participant_handle,
-        proto::OwnedLocalDataTrack track = cb.track();
-        pr.set_value(
+               pr.set_value(
diff --git a/examples/bridge_mute_unmute/receiver.cpp b/examples/bridge_mute_unmute/receiver.cpp
index 1abafbc..cc65769 100644
--- a/examples/bridge_mute_unmute/receiver.cpp
+++ b/examples/bridge_mute_unmute/receiver.cpp
@@ -64 +64 @@ int main(int argc, char *argv[]) {
-    if (e)
+    if (e) {
@@ -65,0 +66 @@ int main(int argc, char *argv[]) {
+}
@@ -67 +68 @@ int main(int argc, char *argv[]) {
-    if (e)
+    if (e) {
@@ -68,0 +70 @@ int main(int argc, char *argv[]) {
+}
@@ -123 +125 @@ int main(int argc, char *argv[]) {
-    if (recDevs)
+    if (recDevs) {
@@ -124,0 +127 @@ int main(int argc, char *argv[]) {
+}
@@ -174 +177 @@ int main(int argc, char *argv[]) {
-    if (cams)
+    if (cams) {
@@ -175,0 +179 @@ int main(int argc, char *argv[]) {
+}
@@ -252 +256 @@ int main(int argc, char *argv[]) {
-  if (mic_thread.joinable())
+  if (mic_thread.joinable()) {
@@ -254 +258,2 @@ int main(int argc, char *argv[]) {
-  if (cam_thread.joinable())
+}
+  if (cam_thread.joinable()) {
@@ -255,0 +261 @@ int main(int argc, char *argv[]) {
+}
diff --git a/src/tests/integration/test_media_multistream.cpp b/src/tests/integration/test_media_multistream.cpp
index 8b98fe9..91495fc 100644
--- a/src/tests/integration/test_media_multistream.cpp
+++ b/src/tests/integration/test_media_multistream.cpp
@@ -29,2 +29,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -241 +241 @@ void MediaMultiStreamIntegrationTest::runPublishTwoVideoAndTwoAudioTracks(
-TEST_F(MediaMultiStreamIntegrationTest,
+TEST_F(const MediaMultiStreamIntegrationTest&,
@@ -246 +246 @@ TEST_F(MediaMultiStreamIntegrationTest,
-TEST_F(MediaMultiStreamIntegrationTest,
+TEST_F(const MediaMultiStreamIntegrationTest&,
@@ -251,2 +251,2 @@ TEST_F(MediaMultiStreamIntegrationTest,
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/src/tests/integration/test_audio_processing_module.cpp b/src/tests/integration/test_audio_processing_module.cpp
index 4c4b48c..3035481 100644
--- a/src/tests/integration/test_audio_processing_module.cpp
+++ b/src/tests/integration/test_audio_processing_module.cpp
@@ -31,2 +31,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -925,2 +925,2 @@ TEST_F(AudioProcessingModuleTest, AGCWithNoiseSuppressionCombined) {
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/examples/bridge_rpc/custom_caller.cpp b/examples/bridge_rpc/custom_caller.cpp
index 4ff5d35..ae32fac 100644
--- a/examples/bridge_rpc/custom_caller.cpp
+++ b/examples/bridge_rpc/custom_caller.cpp
@@ -54 +54 @@ int main(int argc, char *argv[]) {
-    if (e)
+    if (e) {
@@ -55,0 +56 @@ int main(int argc, char *argv[]) {
+}
@@ -57 +58 @@ int main(int argc, char *argv[]) {
-    if (e)
+    if (e) {
@@ -58,0 +60 @@ int main(int argc, char *argv[]) {
+}
@@ -79 +81 @@ int main(int argc, char *argv[]) {
-  for (int i = 0; i < 30 && g_running.load(); ++i)
+  for (int i = 0; i < 30 && g_running.load(); ++i) {
@@ -80,0 +83 @@ int main(int argc, char *argv[]) {
+}
@@ -114 +117 @@ int main(int argc, char *argv[]) {
-    for (int i = 0; i < 10 && g_running.load(); ++i)
+    for (int i = 0; i < 10 && g_running.load(); ++i) {
@@ -115,0 +119 @@ int main(int argc, char *argv[]) {
+}
diff --git a/src/tests/integration/test_logging.cpp b/src/tests/integration/test_logging.cpp
index 88e1616..9077d59 100644
--- a/src/tests/integration/test_logging.cpp
+++ b/src/tests/integration/test_logging.cpp
@@ -28,2 +28,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -296,2 +296,2 @@ TEST_F(LoggingTest, ConcurrentLogEmissionDoesNotCrash) {
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/examples/simple_rpc/main.cpp b/examples/simple_rpc/main.cpp
index b171f9b..edb0e13 100644
--- a/examples/simple_rpc/main.cpp
+++ b/examples/simple_rpc/main.cpp
@@ -144 +144 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
-      if (!v.empty())
+      if (!v.empty()) {
@@ -145,0 +146 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
+}
@@ -148 +149 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
-      if (!v.empty())
+      if (!v.empty()) {
@@ -149,0 +151 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
+}
@@ -152 +154 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
-      if (!v.empty())
+      if (!v.empty()) {
@@ -153,0 +156 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
+}
@@ -160 +163 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
-    if (a.rfind("--", 0) == 0)
+    if (a.rfind("--", 0) == 0) {
@@ -161,0 +165 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
+}
@@ -178 +182 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
-    if (e)
+    if (e) {
@@ -179,0 +184 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
+}
@@ -183 +188 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
-    if (e)
+    if (e) {
@@ -184,0 +190 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
+}
@@ -188 +194 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
-    if (e)
+    if (e) {
@@ -189,0 +196 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
+}
@@ -212 +219 @@ double parseNumberFromJson(const std::string &json) {
-  if (colon == std::string::npos)
+  if (colon == std::string::npos) {
@@ -213,0 +221 @@ double parseNumberFromJson(const std::string &json) {
+}
@@ -222 +230 @@ std::string parseStringFromJson(const std::string &json) {
-  if (colon == std::string::npos)
+  if (colon == std::string::npos) {
@@ -223,0 +232 @@ std::string parseStringFromJson(const std::string &json) {
+}
@@ -225 +234 @@ std::string parseStringFromJson(const std::string &json) {
-  if (first_quote == std::string::npos)
+  if (first_quote == std::string::npos) {
@@ -226,0 +236 @@ std::string parseStringFromJson(const std::string &json) {
+}
@@ -228 +238 @@ std::string parseStringFromJson(const std::string &json) {
-  if (second_quote == std::string::npos)
+  if (second_quote == std::string::npos) {
@@ -229,0 +240 @@ std::string parseStringFromJson(const std::string &json) {
+}
@@ -381 +392 @@ void performDivide(Room *room) {
-    std::string payload = "{\"dividend\":10,\"divisor\":0}";
+    std::string payload = R"({"dividend":10,"divisor":0})";
diff --git a/include/livekit/result.h b/include/livekit/result.h
index bc7f133..e321b03 100644
--- a/include/livekit/result.h
+++ b/include/livekit/result.h
@@ -46 +46 @@ public:
-            typename = std::enable_if_t<std::is_constructible<T, U &&>::value>>
+            typename = std::enable_if_t<std::is_constructible_v<T, U &&>>>
@@ -54 +54 @@ public:
-            typename = std::enable_if_t<std::is_constructible<E, F &&>::value>>
+            typename = std::enable_if_t<std::is_constructible_v<E, F &&>>>
@@ -61 +61 @@ public:
-  bool ok() const noexcept { return storage_.index() == 0; }
+  [[nodiscard]] bool ok() const noexcept { return storage_.index() == 0; }
@@ -63 +63 @@ public:
-  bool has_error() const noexcept { return !ok(); }
+  [[nodiscard]] bool has_error() const noexcept { return !ok(); }
@@ -134 +134 @@ public:
-            typename = std::enable_if_t<std::is_constructible<E, F &&>::value>>
+            typename = std::enable_if_t<std::is_constructible_v<E, F &&>>>
@@ -140 +140 @@ public:
-  bool ok() const noexcept { return !error_.has_value(); }
+  [[nodiscard]] bool ok() const noexcept { return !error_.has_value(); }
@@ -142 +142 @@ public:
-  bool has_error() const noexcept { return error_.has_value(); }
+  [[nodiscard]] bool has_error() const noexcept { return error_.has_value(); }
diff --git a/include/livekit/participant.h b/include/livekit/participant.h
index 5987963..f61d64b 100644
--- a/include/livekit/participant.h
+++ b/include/livekit/participant.h
@@ -44,5 +44,5 @@ public:
-  const std::string &sid() const noexcept { return sid_; }
-  const std::string &name() const noexcept { return name_; }
-  const std::string &identity() const noexcept { return identity_; }
-  const std::string &metadata() const noexcept { return metadata_; }
-  const std::unordered_map<std::string, std::string> &
+  [[nodiscard]] const std::string &sid() const noexcept { return sid_; }
+  [[nodiscard]] const std::string &name() const noexcept { return name_; }
+  [[nodiscard]] const std::string &identity() const noexcept { return identity_; }
+  [[nodiscard]] const std::string &metadata() const noexcept { return metadata_; }
+  [[nodiscard]] const std::unordered_map<std::string, std::string> &
@@ -52,2 +52,2 @@ public:
-  ParticipantKind kind() const noexcept { return kind_; }
-  DisconnectReason disconnectReason() const noexcept { return reason_; }
+  [[nodiscard]] ParticipantKind kind() const noexcept { return kind_; }
+  [[nodiscard]] DisconnectReason disconnectReason() const noexcept { return reason_; }
@@ -55 +55 @@ public:
-  uintptr_t ffiHandleId() const noexcept { return handle_.get(); }
+  [[nodiscard]] uintptr_t ffiHandleId() const noexcept { return handle_.get(); }
@@ -58,2 +58,2 @@ public:
-  void set_name(std::string name) noexcept { name_ = std::move(name); }
-  void set_metadata(std::string metadata) noexcept {
+  void set_name(const std::string& name) noexcept { name_ = std::move(name); }
+  void set_metadata(const std::string& metadata) noexcept {
@@ -76 +76 @@ protected:
-  virtual std::shared_ptr<TrackPublication>
+  [[nodiscard]] virtual std::shared_ptr<TrackPublication>
diff --git a/src/tests/stress/test_audio_frame_stress.cpp b/src/tests/stress/test_audio_frame_stress.cpp
index 41f92e9..32000a4 100644
--- a/src/tests/stress/test_audio_frame_stress.cpp
+++ b/src/tests/stress/test_audio_frame_stress.cpp
@@ -25,2 +25,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -286,2 +286,2 @@ TEST_F(AudioFrameStressTest, SimulatedRealtimeProcessing) {
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/examples/simple_room/main.cpp b/examples/simple_room/main.cpp
index 717519a..327189e 100644
--- a/examples/simple_room/main.cpp
+++ b/examples/simple_room/main.cpp
@@ -93 +93 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
-      if (!v.empty())
+      if (!v.empty()) {
@@ -94,0 +95 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
+}
@@ -97 +98 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
-      if (!v.empty())
+      if (!v.empty()) {
@@ -98,0 +100 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
+}
@@ -101 +103 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
-      if (!v.empty())
+      if (!v.empty()) {
@@ -102,0 +105 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
+}
@@ -111 +114 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
-      if (a.rfind("--", 0) == 0)
+      if (a.rfind("--", 0) == 0) {
@@ -112,0 +116 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
+}
@@ -116 +120 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
-      if (url.empty())
+      if (url.empty()) {
@@ -118 +122,2 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
-      if (token.empty())
+}
+      if (token.empty()) {
@@ -119,0 +125 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
+}
@@ -126 +132 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
-    if (e)
+    if (e) {
@@ -127,0 +134 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
+}
@@ -131 +138 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
-    if (e)
+    if (e) {
@@ -132,0 +140 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
+}
@@ -136 +144 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
-    if (e)
+    if (e) {
@@ -137,0 +146 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
+}
diff --git a/include/livekit/local_video_track.h b/include/livekit/local_video_track.h
index a431740..72d747f 100644
--- a/include/livekit/local_video_track.h
+++ b/include/livekit/local_video_track.h
@@ -80 +80 @@ public:
-  std::string to_string() const;
+  [[nodiscard]] std::string to_string() const;
@@ -84 +84 @@ public:
-  std::shared_ptr<LocalTrackPublication> publication() const noexcept {
+  [[nodiscard]] std::shared_ptr<LocalTrackPublication> publication() const noexcept {
@@ -91 +91 @@ public:
-    local_publication_ = std::move(publication);
+    local_publication_ = publication;
diff --git a/include/livekit/data_stream.h b/include/livekit/data_stream.h
index 11d906c..ed375bd 100644
--- a/include/livekit/data_stream.h
+++ b/include/livekit/data_stream.h
@@ -81 +81 @@ public:
-  explicit TextStreamReader(TextStreamInfo info);
+  explicit TextStreamReader(const TextStreamInfo &info);
@@ -95 +95 @@ public:
-  const TextStreamInfo &info() const noexcept { return info_; }
+  [[nodiscard]] const TextStreamInfo &info() const noexcept { return info_; }
@@ -121 +121 @@ public:
-  explicit ByteStreamReader(ByteStreamInfo info);
+  explicit ByteStreamReader(const ByteStreamInfo &info);
@@ -131 +131 @@ public:
-  const ByteStreamInfo &info() const noexcept { return info_; }
+  [[nodiscard]] const ByteStreamInfo &info() const noexcept { return info_; }
@@ -159 +159 @@ public:
-  const std::string &streamId() const noexcept { return stream_id_; }
+  [[nodiscard]] const std::string &streamId() const noexcept { return stream_id_; }
@@ -162 +162 @@ public:
-  const std::string &topic() const noexcept { return topic_; }
+  [[nodiscard]] const std::string &topic() const noexcept { return topic_; }
@@ -165 +165 @@ public:
-  const std::string &mimeType() const noexcept { return mime_type_; }
+  [[nodiscard]] const std::string &mimeType() const noexcept { return mime_type_; }
@@ -168 +168 @@ public:
-  std::int64_t timestampMs() const noexcept { return timestamp_ms_; }
+  [[nodiscard]] std::int64_t timestampMs() const noexcept { return timestamp_ms_; }
@@ -171 +171 @@ public:
-  bool isClosed() const noexcept { return closed_; }
+  [[nodiscard]] bool isClosed() const noexcept { return closed_; }
@@ -241 +241 @@ public:
-  const TextStreamInfo &info() const noexcept { return info_; }
+  [[nodiscard]] const TextStreamInfo &info() const noexcept { return info_; }
@@ -266 +266 @@ public:
-  const ByteStreamInfo &info() const noexcept { return info_; }
+  [[nodiscard]] const ByteStreamInfo &info() const noexcept { return info_; }
diff --git a/include/livekit/video_source.h b/include/livekit/video_source.h
index 47715dc..62bb064 100644
--- a/include/livekit/video_source.h
+++ b/include/livekit/video_source.h
@@ -63,2 +63,2 @@ public:
-  int width() const noexcept { return width_; }
-  int height() const noexcept { return height_; }
+  [[nodiscard]] int width() const noexcept { return width_; }
+  [[nodiscard]] int height() const noexcept { return height_; }
@@ -67 +67 @@ public:
-  std::uint64_t ffi_handle_id() const noexcept { return handle_.get(); }
+  [[nodiscard]] std::uint64_t ffi_handle_id() const noexcept { return handle_.get(); }
diff --git a/include/livekit/subscription_thread_dispatcher.h b/include/livekit/subscription_thread_dispatcher.h
index fbc531a..b5158e1 100644
--- a/include/livekit/subscription_thread_dispatcher.h
+++ b/include/livekit/subscription_thread_dispatcher.h
@@ -407 +407 @@ private:
-                                     const AudioFrameCallback& cb,
+                                     AudioFrameCallback cb,
@@ -416 +416 @@ private:
-                                     const VideoFrameCallback& cb,
+                                     VideoFrameCallback cb,
@@ -432 +432 @@ private:
-                        const DataFrameCallback& cb);
+                        DataFrameCallback cb);
diff --git a/include/livekit/track_publication.h b/include/livekit/track_publication.h
index 5d0ff47..9cf1c78 100644
--- a/include/livekit/track_publication.h
+++ b/include/livekit/track_publication.h
@@ -50,9 +50,9 @@ public:
-  const std::string &sid() const noexcept { return sid_; }
-  const std::string &name() const noexcept { return name_; }
-  TrackKind kind() const noexcept { return kind_; }
-  TrackSource source() const noexcept { return source_; }
-  bool simulcasted() const noexcept { return simulcasted_; }
-  std::uint32_t width() const noexcept { return width_; }
-  std::uint32_t height() const noexcept { return height_; }
-  const std::string &mimeType() const noexcept { return mime_type_; }
-  bool muted() const noexcept { return muted_; }
+  [[nodiscard]] const std::string &sid() const noexcept { return sid_; }
+  [[nodiscard]] const std::string &name() const noexcept { return name_; }
+  [[nodiscard]] TrackKind kind() const noexcept { return kind_; }
+  [[nodiscard]] TrackSource source() const noexcept { return source_; }
+  [[nodiscard]] bool simulcasted() const noexcept { return simulcasted_; }
+  [[nodiscard]] std::uint32_t width() const noexcept { return width_; }
+  [[nodiscard]] std::uint32_t height() const noexcept { return height_; }
+  [[nodiscard]] const std::string &mimeType() const noexcept { return mime_type_; }
+  [[nodiscard]] bool muted() const noexcept { return muted_; }
@@ -61,2 +61,2 @@ public:
-  EncryptionType encryptionType() const noexcept { return encryption_type_; }
-  const std::vector<AudioTrackFeature> &audioFeatures() const noexcept {
+  [[nodiscard]] EncryptionType encryptionType() const noexcept { return encryption_type_; }
+  [[nodiscard]] const std::vector<AudioTrackFeature> &audioFeatures() const noexcept {
@@ -67 +67 @@ public:
-  uintptr_t ffiHandleId() const noexcept { return handle_.get(); }
+  [[nodiscard]] uintptr_t ffiHandleId() const noexcept { return handle_.get(); }
@@ -70 +70 @@ public:
-  std::shared_ptr<Track> track() const noexcept { return track_; }
+  [[nodiscard]] std::shared_ptr<Track> track() const noexcept { return track_; }
diff --git a/bridge/tests/test_bridge_audio_track.cpp b/bridge/tests/test_bridge_audio_track.cpp
index 8e7274e..ea6aa1f 100644
--- a/bridge/tests/test_bridge_audio_track.cpp
+++ b/bridge/tests/test_bridge_audio_track.cpp
@@ -27,2 +27,2 @@
-namespace livekit_bridge {
-namespace test {
+
+namespace livekit_bridge::test {
@@ -117,2 +117,2 @@ TEST_F(BridgeAudioTrackTest, UnmuteOnReleasedTrackDoesNotCrash) {
-} // namespace test
-} // namespace livekit_bridge
+} // namespace livekit_bridge::test
+
diff --git a/src/tests/integration/test_audio_frame.cpp b/src/tests/integration/test_audio_frame.cpp
index 9eba0be..dd11fd5 100644
--- a/src/tests/integration/test_audio_frame.cpp
+++ b/src/tests/integration/test_audio_frame.cpp
@@ -21,2 +21,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -169,2 +169,2 @@ TEST_F(AudioFrameTest, InvalidDataSizeThrows) {
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/src/lk_log.h b/src/lk_log.h
index 7c51596..e360ce3 100644
--- a/src/lk_log.h
+++ b/src/lk_log.h
@@ -23,2 +23,2 @@
-namespace livekit {
-namespace detail {
+
+namespace livekit::detail {
@@ -34,2 +34,2 @@ void shutdownLogger();
-} // namespace detail
-} // namespace livekit
+} // namespace livekit::detail
+
diff --git a/src/tests/common/audio_utils.h b/src/tests/common/audio_utils.h
index 1576b9a..5988b4d 100644
--- a/src/tests/common/audio_utils.h
+++ b/src/tests/common/audio_utils.h
@@ -27,2 +27,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -110,2 +110,2 @@ inline void fillToneFrame(AudioFrame &frame, double freq_hz, int sample_rate,
-  for (std::size_t i = 0; i < samples.size(); ++i) {
-    samples[i] = static_cast<std::int16_t>(std::sin(phase) * amplitude);
+  for (short & sample : samples) {
+    sample = static_cast<std::int16_t>(std::sin(phase) * amplitude);
@@ -119,2 +119,2 @@ inline void fillToneFrame(AudioFrame &frame, double freq_hz, int sample_rate,
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/include/livekit/e2ee.h b/include/livekit/e2ee.h
index e6473ae..f54f712 100644
--- a/include/livekit/e2ee.h
+++ b/include/livekit/e2ee.h
@@ -127 +127 @@ public:
-    const KeyProviderOptions &options() const;
+    [[nodiscard]] const KeyProviderOptions &options() const;
@@ -133 +133 @@ public:
-    std::vector<std::uint8_t> exportSharedKey(int key_index = 0) const;
+    [[nodiscard]] std::vector<std::uint8_t> exportSharedKey(int key_index = 0) const;
@@ -143 +143 @@ public:
-    std::vector<std::uint8_t> exportKey(const std::string &participant_identity,
+    [[nodiscard]] std::vector<std::uint8_t> exportKey(const std::string &participant_identity,
@@ -167,3 +167,3 @@ public:
-    const std::string &participantIdentity() const;
-    int keyIndex() const;
-    bool enabled() const;
+    [[nodiscard]] const std::string &participantIdentity() const;
+    [[nodiscard]] int keyIndex() const;
+    [[nodiscard]] bool enabled() const;
@@ -191 +191 @@ public:
-  bool enabled() const;
+  [[nodiscard]] bool enabled() const;
@@ -203 +203 @@ public:
-  const KeyProvider *keyProvider() const;
+  [[nodiscard]] const KeyProvider *keyProvider() const;
@@ -206 +206 @@ public:
-  std::vector<E2EEManager::FrameCryptor> frameCryptors() const;
+  [[nodiscard]] std::vector<E2EEManager::FrameCryptor> frameCryptors() const;
diff --git a/include/livekit/rpc_error.h b/include/livekit/rpc_error.h
index 2efb988..d2215cc 100644
--- a/include/livekit/rpc_error.h
+++ b/include/livekit/rpc_error.h
@@ -85 +85 @@ public:
-  std::uint32_t code() const noexcept;
+  [[nodiscard]] std::uint32_t code() const noexcept;
@@ -90 +90 @@ public:
-  const std::string &message() const noexcept;
+  [[nodiscard]] const std::string &message() const noexcept;
@@ -96 +96 @@ public:
-  const std::string &data() const noexcept;
+  [[nodiscard]] const std::string &data() const noexcept;
@@ -109 +109 @@ protected:
-  proto::RpcError toProto() const;
+  [[nodiscard]] proto::RpcError toProto() const;
diff --git a/examples/bridge_mute_unmute/caller.cpp b/examples/bridge_mute_unmute/caller.cpp
index a47b2e1..07673e6 100644
--- a/examples/bridge_mute_unmute/caller.cpp
+++ b/examples/bridge_mute_unmute/caller.cpp
@@ -70 +70 @@ static void storeFrame(const livekit::VideoFrame &frame) {
-  if (!src || size == 0)
+  if (!src || size == 0) {
@@ -71,0 +72 @@ static void storeFrame(const livekit::VideoFrame &frame) {
+}
@@ -92 +93 @@ int main(int argc, char *argv[]) {
-    if (positional.size() >= 3)
+    if (positional.size() >= 3) {
@@ -93,0 +95 @@ int main(int argc, char *argv[]) {
+}
@@ -96 +98 @@ int main(int argc, char *argv[]) {
-    if (e)
+    if (e) {
@@ -97,0 +100 @@ int main(int argc, char *argv[]) {
+}
@@ -99 +102 @@ int main(int argc, char *argv[]) {
-    if (e)
+    if (e) {
@@ -101 +104,2 @@ int main(int argc, char *argv[]) {
-    if (!positional.empty())
+}
+    if (!positional.empty()) {
@@ -102,0 +107 @@ int main(int argc, char *argv[]) {
+}
@@ -171 +176 @@ int main(int argc, char *argv[]) {
-        if (samples.empty())
+        if (samples.empty()) {
@@ -172,0 +178 @@ int main(int argc, char *argv[]) {
+}
@@ -205 +211 @@ int main(int argc, char *argv[]) {
-    for (int i = 0; i < 30 && toggle_running.load(); ++i)
+    for (int i = 0; i < 30 && toggle_running.load(); ++i) {
@@ -206,0 +213 @@ int main(int argc, char *argv[]) {
+}
@@ -249 +256 @@ int main(int argc, char *argv[]) {
-      for (int i = 0; i < 100 && toggle_running.load(); ++i)
+      for (int i = 0; i < 100 && toggle_running.load(); ++i) {
@@ -250,0 +258 @@ int main(int argc, char *argv[]) {
+}
@@ -284 +292 @@ int main(int argc, char *argv[]) {
-        if (texture)
+        if (texture) {
@@ -285,0 +294 @@ int main(int argc, char *argv[]) {
+}
@@ -319 +328 @@ int main(int argc, char *argv[]) {
-  if (toggle_thread.joinable())
+  if (toggle_thread.joinable()) {
@@ -320,0 +330 @@ int main(int argc, char *argv[]) {
+}
@@ -329 +339 @@ int main(int argc, char *argv[]) {
-  if (texture)
+  if (texture) {
@@ -330,0 +341 @@ int main(int argc, char *argv[]) {
+}
diff --git a/src/room.cpp b/src/room.cpp
index 919e126..a71068f 100644
--- a/src/room.cpp
+++ b/src/room.cpp
@@ -276,2 +276,2 @@ void Room::setOnAudioFrameCallback(const std::string &participant_identity,
-                                   AudioFrameCallback callback,
-                                   AudioStream::Options opts) {
+                                   const AudioFrameCallback& callback,
+                                   const AudioStream::Options& opts) {
@@ -286,2 +286,2 @@ void Room::setOnAudioFrameCallback(const std::string &participant_identity,
-                                   AudioFrameCallback callback,
-                                   AudioStream::Options opts) {
+                                   const AudioFrameCallback& callback,
+                                   const AudioStream::Options& opts) {
@@ -296 +296 @@ void Room::setOnVideoFrameCallback(const std::string &participant_identity,
-                                   VideoFrameCallback callback,
+                                   const VideoFrameCallback& callback,
@@ -306 +306 @@ void Room::setOnVideoFrameCallback(const std::string &participant_identity,
-                                   VideoFrameCallback callback,
+                                   const VideoFrameCallback& callback,
@@ -349 +349 @@ Room::addOnDataFrameCallback(const std::string &participant_identity,
-                             DataFrameCallback callback) {
+                             const DataFrameCallback& callback) {
diff --git a/examples/simple_data_stream/main.cpp b/examples/simple_data_stream/main.cpp
index f8144b7..5b37fd5 100644
--- a/examples/simple_data_stream/main.cpp
+++ b/examples/simple_data_stream/main.cpp
@@ -41 +41 @@ std::string randomHexId(std::size_t nbytes = 16) {
-    std::uint8_t b = static_cast<std::uint8_t>(rng() & 0xFF);
+    auto b = static_cast<std::uint8_t>(rng() & 0xFF);
diff --git a/src/track.cpp b/src/track.cpp
index 2dd403d..831a65f 100644
--- a/src/track.cpp
+++ b/src/track.cpp
@@ -34 +34 @@ void Track::setPublicationFields(std::optional<TrackSource> source,
-                                 std::optional<std::string> mime_type) {
+                                 const std::optional<std::string>& mime_type) {
diff --git a/examples/common/sdl_media_manager.cpp b/examples/common/sdl_media_manager.cpp
index 380334f..1728a71 100644
--- a/examples/common/sdl_media_manager.cpp
+++ b/examples/common/sdl_media_manager.cpp
@@ -76 +76 @@ bool SDLMediaManager::startMic(
-    if (recDevs)
+    if (recDevs) {
@@ -77,0 +78 @@ bool SDLMediaManager::startMic(
+}
@@ -160 +161 @@ bool SDLMediaManager::startCamera(
-    if (cams)
+    if (cams) {
@@ -161,0 +163 @@ bool SDLMediaManager::startCamera(
+}
diff --git a/include/livekit/audio_processing_module.h b/include/livekit/audio_processing_module.h
index 29eab33..0935c99 100644
--- a/include/livekit/audio_processing_module.h
+++ b/include/livekit/audio_processing_module.h
@@ -159 +159 @@ private:
-  bool valid() const noexcept { return handle_.valid(); }
+  [[nodiscard]] bool valid() const noexcept { return handle_.valid(); }
@@ -162 +162 @@ private:
-  std::uint64_t ffi_handle_id() const noexcept {
+  [[nodiscard]] std::uint64_t ffi_handle_id() const noexcept {
diff --git a/src/tests/integration/test_data_track.cpp b/src/tests/integration/test_data_track.cpp
index 983497b..a8b1cc7 100644
--- a/src/tests/integration/test_data_track.cpp
+++ b/src/tests/integration/test_data_track.cpp
@@ -37,2 +37,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -847,2 +847,2 @@ INSTANTIATE_TEST_SUITE_P(DataTrackScenarios, DataTrackTransportTest,
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/bridge/src/rpc_constants.cpp b/bridge/src/rpc_constants.cpp
index 03386fe..bf8dde3 100644
--- a/bridge/src/rpc_constants.cpp
+++ b/bridge/src/rpc_constants.cpp
@@ -19,3 +19,3 @@
-namespace livekit_bridge {
-namespace rpc {
-namespace track_control {
+
+
+namespace livekit_bridge::rpc::track_control {
@@ -39,3 +39,3 @@ std::string formatPayload(const char *action, const std::string &track_name) {
-} // namespace track_control
-} // namespace rpc
-} // namespace livekit_bridge
+} // namespace livekit_bridge::rpc::track_control
+
+
diff --git a/include/livekit/local_audio_track.h b/include/livekit/local_audio_track.h
index 9c46819..26ce63f 100644
--- a/include/livekit/local_audio_track.h
+++ b/include/livekit/local_audio_track.h
@@ -79 +79 @@ public:
-  std::string to_string() const;
+  [[nodiscard]] std::string to_string() const;
@@ -83 +83 @@ public:
-  std::shared_ptr<LocalTrackPublication> publication() const noexcept {
+  [[nodiscard]] std::shared_ptr<LocalTrackPublication> publication() const noexcept {
@@ -90 +90 @@ public:
-    local_publication_ = std::move(publication);
+    local_publication_ = publication;
diff --git a/src/video_stream.cpp b/src/video_stream.cpp
index ed65da9..5f25a65 100644
--- a/src/video_stream.cpp
+++ b/src/video_stream.cpp
@@ -50 +50 @@ VideoStream &VideoStream::operator=(VideoStream &&other) noexcept {
-  if (this == &other)
+  if (this == &other) {
@@ -51,0 +52 @@ VideoStream &VideoStream::operator=(VideoStream &&other) noexcept {
+}
diff --git a/src/subscription_thread_dispatcher.cpp b/src/subscription_thread_dispatcher.cpp
index ee68365..2c7f771 100644
--- a/src/subscription_thread_dispatcher.cpp
+++ b/src/subscription_thread_dispatcher.cpp
@@ -34 +34 @@ const char *trackKindName(TrackKind kind) {
-  if (kind == TrackKind::KIND_AUDIO)
+  if (kind == TrackKind::KIND_AUDIO) {
@@ -36 +36,2 @@ const char *trackKindName(TrackKind kind) {
-  if (kind == TrackKind::KIND_VIDEO)
+}
+  if (kind == TrackKind::KIND_VIDEO) {
@@ -38 +39,2 @@ const char *trackKindName(TrackKind kind) {
-  if (kind == TrackKind::KIND_UNKNOWN)
+}
+  if (kind == TrackKind::KIND_UNKNOWN) {
@@ -39,0 +42 @@ const char *trackKindName(TrackKind kind) {
+}
@@ -90 +93 @@ void SubscriptionThreadDispatcher::setOnVideoFrameCallback(
-      RegisteredVideoCallback{std::move(callback), std::move(opts)};
+      RegisteredVideoCallback{std::move(callback), opts};
@@ -105 +108 @@ void SubscriptionThreadDispatcher::setOnVideoFrameCallback(
-      RegisteredVideoCallback{std::move(callback), std::move(opts)};
+      RegisteredVideoCallback{std::move(callback), opts};
@@ -478 +481 @@ std::thread SubscriptionThreadDispatcher::startAudioReaderLocked(
-    AudioFrameCallback cb, const AudioStream::Options &opts) {
+    const AudioFrameCallback& cb, const AudioStream::Options &opts) {
@@ -501 +504 @@ std::thread SubscriptionThreadDispatcher::startAudioReaderLocked(
-  auto stream_copy = stream;
+  const auto& stream_copy = stream;
@@ -529 +532 @@ std::thread SubscriptionThreadDispatcher::startVideoReaderLocked(
-    VideoFrameCallback cb, const VideoStream::Options &opts) {
+    const VideoFrameCallback& cb, const VideoStream::Options &opts) {
@@ -552 +555 @@ std::thread SubscriptionThreadDispatcher::startVideoReaderLocked(
-  auto stream_copy = stream;
+  const auto& stream_copy = stream;
@@ -623 +626 @@ std::thread SubscriptionThreadDispatcher::startDataReaderLocked(
-    const std::shared_ptr<RemoteDataTrack> &track, DataFrameCallback cb) {
+    const std::shared_ptr<RemoteDataTrack> &track, const DataFrameCallback& cb) {
diff --git a/src/tests/integration/test_rpc.cpp b/src/tests/integration/test_rpc.cpp
index 1747eaf..1d1576a 100644
--- a/src/tests/integration/test_rpc.cpp
+++ b/src/tests/integration/test_rpc.cpp
@@ -29,2 +29,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -535,2 +535,2 @@ TEST_F(RpcIntegrationTest, OneMinuteIntegration) {
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/bridge/src/livekit_bridge.cpp b/bridge/src/livekit_bridge.cpp
index b15587e..3869398 100644
--- a/bridge/src/livekit_bridge.cpp
+++ b/bridge/src/livekit_bridge.cpp
@@ -242 +242 @@ void LiveKitBridge::setOnAudioFrameCallback(
-    AudioFrameCallback callback) {
+    const AudioFrameCallback& callback) {
@@ -255 +255 @@ void LiveKitBridge::setOnVideoFrameCallback(
-    VideoFrameCallback callback) {
+    const VideoFrameCallback& callback) {
diff --git a/src/tests/stress/test_rpc_stress.cpp b/src/tests/stress/test_rpc_stress.cpp
index 4e25a7b..659b458 100644
--- a/src/tests/stress/test_rpc_stress.cpp
+++ b/src/tests/stress/test_rpc_stress.cpp
@@ -22,2 +22,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -291 +291 @@ TEST_F(RpcStressTest, MaxPayloadStress) {
-      if (!running.load())
+      if (!running.load()) {
@@ -292,0 +293 @@ TEST_F(RpcStressTest, MaxPayloadStress) {
+}
@@ -477 +478 @@ TEST_F(RpcStressTest, SmallPayloadStress) {
-      if (!running.load())
+      if (!running.load()) {
@@ -478,0 +480 @@ TEST_F(RpcStressTest, SmallPayloadStress) {
+}
@@ -691 +693 @@ TEST_F(RpcStressTest, BidirectionalRpcStress) {
-      if (!running.load())
+      if (!running.load()) {
@@ -692,0 +695 @@ TEST_F(RpcStressTest, BidirectionalRpcStress) {
+}
@@ -838 +841 @@ TEST_F(RpcStressTest, HighThroughputBurst) {
-      if (!running.load())
+      if (!running.load()) {
@@ -839,0 +843 @@ TEST_F(RpcStressTest, HighThroughputBurst) {
+}
@@ -890,2 +894,2 @@ TEST_F(RpcStressTest, HighThroughputBurst) {
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/bridge/src/rpc_controller.h b/bridge/src/rpc_controller.h
index 97d096d..c2b0a40 100644
--- a/bridge/src/rpc_controller.h
+++ b/bridge/src/rpc_controller.h
@@ -72 +72 @@ public:
-  bool isEnabled() const { return lp_ != nullptr; }
+  [[nodiscard]] bool isEnabled() const { return lp_ != nullptr; }
diff --git a/src/tests/stress/test_latency_measurement.cpp b/src/tests/stress/test_latency_measurement.cpp
index e93d210..cb5d6b0 100644
--- a/src/tests/stress/test_latency_measurement.cpp
+++ b/src/tests/stress/test_latency_measurement.cpp
@@ -23,2 +23,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -46 +46 @@ static double calculateEnergy(const std::vector<int16_t> &samples) {
-  if (samples.empty())
+  if (samples.empty()) {
@@ -47,0 +48 @@ static double calculateEnergy(const std::vector<int16_t> &samples) {
+}
@@ -63 +64 @@ static std::vector<int16_t> generateHighEnergyFrame(int samples_per_channel) {
-    int16_t sample =
+    auto sample =
@@ -855,2 +856,2 @@ TEST_F(LatencyMeasurementTest, FullDeplexAudioLatency) {
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/src/tests/stress/test_room_stress.cpp b/src/tests/stress/test_room_stress.cpp
index 50cc986..602cb98 100644
--- a/src/tests/stress/test_room_stress.cpp
+++ b/src/tests/stress/test_room_stress.cpp
@@ -25,2 +25,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -241,2 +241,2 @@ TEST_F(RoomServerStressTest, RepeatedConnectDisconnect) {
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/src/video_frame.cpp b/src/video_frame.cpp
index 5fdc83e..ddf6572 100644
--- a/src/video_frame.cpp
+++ b/src/video_frame.cpp
@@ -291 +291 @@ std::vector<VideoPlaneInfo> VideoFrame::planeInfos() const {
-  uintptr_t base = reinterpret_cast<uintptr_t>(data_.data());
+  auto base = reinterpret_cast<uintptr_t>(data_.data());
diff --git a/examples/simple_joystick/sender.cpp b/examples/simple_joystick/sender.cpp
index a235c3d..50907cc 100644
--- a/examples/simple_joystick/sender.cpp
+++ b/examples/simple_joystick/sender.cpp
@@ -78 +78 @@ int readKeyNonBlocking() {
-    if (read(STDIN_FILENO, &ch, 1) == 1)
+    if (read(STDIN_FILENO, &ch, 1) == 1) {
@@ -79,0 +80 @@ int readKeyNonBlocking() {
+}
@@ -228 +229 @@ int main(int argc, char *argv[]) {
-    if (!changed)
+    if (!changed) {
@@ -229,0 +231 @@ int main(int argc, char *argv[]) {
+}
diff --git a/src/rpc_error.cpp b/src/rpc_error.cpp
index 1e521cd..96848ee 100644
--- a/src/rpc_error.cpp
+++ b/src/rpc_error.cpp
@@ -52 +52 @@ RpcError RpcError::fromProto(const proto::RpcError &err) {
-  return RpcError(err.code(), err.message(), err.data());
+  return {err.code(), err.message(), err.data()};
@@ -57 +57 @@ RpcError RpcError::builtIn(ErrorCode code, const std::string &data) {
-  return RpcError(code, msg ? std::string(msg) : std::string{}, data);
+  return {code, msg ? std::string(msg) : std::string{}, data};
diff --git a/src/data_stream.cpp b/src/data_stream.cpp
index 4db1312..cc2da47 100644
--- a/src/data_stream.cpp
+++ b/src/data_stream.cpp
@@ -6,0 +7 @@
+#include <utility>
@@ -36 +37 @@ std::vector<std::string> splitUtf8(const std::string &s,
-  if (s.empty())
+  if (s.empty()) {
@@ -37,0 +39 @@ std::vector<std::string> splitUtf8(const std::string &s,
+}
@@ -91 +93 @@ void fillBaseInfo(BaseStreamInfo &dst, const std::string &stream_id,
-TextStreamReader::TextStreamReader(const TextStreamInfo &info) : info_(info) {}
+TextStreamReader::TextStreamReader(TextStreamInfo info) : info_(std::move(info)) {}
@@ -96 +98 @@ void TextStreamReader::onChunkUpdate(const std::string &text) {
-    if (closed_)
+    if (closed_) {
@@ -97,0 +100 @@ void TextStreamReader::onChunkUpdate(const std::string &text) {
+}
@@ -130 +133 @@ std::string TextStreamReader::readAll() {
-  while (readNext(chunk))
+  while (readNext(chunk)) {
@@ -131,0 +135 @@ std::string TextStreamReader::readAll() {
+}
@@ -135 +139 @@ std::string TextStreamReader::readAll() {
-ByteStreamReader::ByteStreamReader(const ByteStreamInfo &info) : info_(info) {}
+ByteStreamReader::ByteStreamReader(ByteStreamInfo info) : info_(std::move(info)) {}
@@ -140 +144 @@ void ByteStreamReader::onChunkUpdate(const std::vector<std::uint8_t> &bytes) {
-    if (closed_)
+    if (closed_) {
@@ -141,0 +146 @@ void ByteStreamReader::onChunkUpdate(const std::vector<std::uint8_t> &bytes) {
+}
@@ -176 +181 @@ BaseStreamWriter::BaseStreamWriter(
-    LocalParticipant &local_participant, const std::string &topic,
+    LocalParticipant &local_participant, std::string topic,
@@ -179 +184 @@ BaseStreamWriter::BaseStreamWriter(
-    const std::string &mime_type,
+    std::string mime_type,
@@ -181 +186 @@ BaseStreamWriter::BaseStreamWriter(
-    const std::string &sender_identity)
+    std::string sender_identity)
@@ -184 +189 @@ BaseStreamWriter::BaseStreamWriter(
-      mime_type_(mime_type), topic_(topic),
+      mime_type_(std::move(mime_type)), topic_(std::move(topic)),
@@ -190 +195 @@ BaseStreamWriter::BaseStreamWriter(
-      sender_identity_(sender_identity) {
+      sender_identity_(std::move(sender_identity)) {
@@ -197 +202 @@ void BaseStreamWriter::ensureHeaderSent() {
-  if (header_sent_)
+  if (header_sent_) {
@@ -198,0 +204 @@ void BaseStreamWriter::ensureHeaderSent() {
+}
@@ -230 +236 @@ void BaseStreamWriter::sendChunk(const std::vector<std::uint8_t> &content) {
-  if (closed_)
+  if (closed_) {
@@ -231,0 +238 @@ void BaseStreamWriter::sendChunk(const std::vector<std::uint8_t> &content) {
+}
@@ -268 +275 @@ void BaseStreamWriter::close(
-  if (closed_)
+  if (closed_) {
@@ -269,0 +277 @@ void BaseStreamWriter::close(
+}
@@ -293 +301 @@ void TextStreamWriter::write(const std::string &text) {
-  if (closed_)
+  if (closed_) {
@@ -294,0 +303 @@ void TextStreamWriter::write(const std::string &text) {
+}
@@ -324 +333 @@ void ByteStreamWriter::write(const std::vector<std::uint8_t> &data) {
-  if (closed_)
+  if (closed_) {
@@ -325,0 +335 @@ void ByteStreamWriter::write(const std::vector<std::uint8_t> &data) {
+}
diff --git a/src/tests/integration/test_sdk_initialization.cpp b/src/tests/integration/test_sdk_initialization.cpp
index 4d8fa02..0d2e615 100644
--- a/src/tests/integration/test_sdk_initialization.cpp
+++ b/src/tests/integration/test_sdk_initialization.cpp
@@ -20,2 +20,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -72,2 +72,2 @@ TEST_F(SDKInitializationTest, MultipleShutdowns) {
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/src/tests/common/video_utils.h b/src/tests/common/video_utils.h
index eb743c5..8150300 100644
--- a/src/tests/common/video_utils.h
+++ b/src/tests/common/video_utils.h
@@ -26,2 +26,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -40 +40 @@ inline void fillWebcamLikeFrame(VideoFrame &frame, std::uint64_t frame_index) {
-  const std::uint8_t blue = static_cast<std::uint8_t>((frame_index * 3) % 255);
+  const auto blue = static_cast<std::uint8_t>((frame_index * 3) % 255);
@@ -128,2 +128,2 @@ inline void runVideoLoop(
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/bridge/include/livekit_bridge/rpc_constants.h b/bridge/include/livekit_bridge/rpc_constants.h
index 3511239..e200fd7 100644
--- a/bridge/include/livekit_bridge/rpc_constants.h
+++ b/bridge/include/livekit_bridge/rpc_constants.h
@@ -24,2 +24,2 @@
-namespace livekit_bridge {
-namespace rpc {
+
+
@@ -32 +32 @@ namespace rpc {
-namespace track_control {
+namespace livekit_bridge::rpc::track_control {
@@ -52,3 +52,3 @@ std::string formatPayload(const char *action, const std::string &track_name);
-} // namespace track_control
-} // namespace rpc
-} // namespace livekit_bridge
+} // namespace livekit_bridge::rpc::track_control
+
+
diff --git a/examples/bridge_human_robot/robot.cpp b/examples/bridge_human_robot/robot.cpp
index f3e2f02..1d54a02 100644
--- a/examples/bridge_human_robot/robot.cpp
+++ b/examples/bridge_human_robot/robot.cpp
@@ -331 +331 @@ int main(int argc, char *argv[]) {
-    if (url.empty())
+    if (url.empty()) {
@@ -332,0 +333 @@ int main(int argc, char *argv[]) {
+}
@@ -335 +336 @@ int main(int argc, char *argv[]) {
-    if (e)
+    if (e) {
@@ -336,0 +338 @@ int main(int argc, char *argv[]) {
+}
@@ -338 +340 @@ int main(int argc, char *argv[]) {
-    if (e)
+    if (e) {
@@ -339,0 +342 @@ int main(int argc, char *argv[]) {
+}
@@ -409 +412 @@ int main(int argc, char *argv[]) {
-    if (recDevs)
+    if (recDevs) {
@@ -410,0 +414 @@ int main(int argc, char *argv[]) {
+}
@@ -465 +469 @@ int main(int argc, char *argv[]) {
-    if (cams)
+    if (cams) {
@@ -466,0 +471 @@ int main(int argc, char *argv[]) {
+}
@@ -605 +610 @@ int main(int argc, char *argv[]) {
-        if (phase > kTwoPi)
+        if (phase > kTwoPi) {
@@ -606,0 +612 @@ int main(int argc, char *argv[]) {
+}
@@ -608 +614 @@ int main(int argc, char *argv[]) {
-        for (int ch = 0; ch < kChannels; ++ch)
+        for (int ch = 0; ch < kChannels; ++ch) {
@@ -609,0 +616 @@ int main(int argc, char *argv[]) {
+}
@@ -641 +648 @@ int main(int argc, char *argv[]) {
-  if (mic_thread.joinable())
+  if (mic_thread.joinable()) {
@@ -643 +650,2 @@ int main(int argc, char *argv[]) {
-  if (cam_thread.joinable())
+}
+  if (cam_thread.joinable()) {
@@ -645 +653,2 @@ int main(int argc, char *argv[]) {
-  if (sim_thread.joinable())
+}
+  if (sim_thread.joinable()) {
@@ -647 +656,2 @@ int main(int argc, char *argv[]) {
-  if (sim_audio_thread.joinable())
+}
+  if (sim_audio_thread.joinable()) {
@@ -648,0 +659 @@ int main(int argc, char *argv[]) {
+}
diff --git a/examples/common/sdl_media.h b/examples/common/sdl_media.h
index a60bca6..b90325a 100644
--- a/examples/common/sdl_media.h
+++ b/examples/common/sdl_media.h
@@ -50 +50 @@ public:
-  bool isValid() const { return stream_ != nullptr; }
+  [[nodiscard]] bool isValid() const { return stream_ != nullptr; }
@@ -80 +80 @@ public:
-  bool isValid() const { return stream_ != nullptr; }
+  [[nodiscard]] bool isValid() const { return stream_ != nullptr; }
@@ -118 +118 @@ public:
-  bool isValid() const { return camera_ != nullptr; }
+  [[nodiscard]] bool isValid() const { return camera_ != nullptr; }
diff --git a/src/audio_frame.cpp b/src/audio_frame.cpp
index 23ff01e..d165e73 100644
--- a/src/audio_frame.cpp
+++ b/src/audio_frame.cpp
@@ -72 +72 @@ AudioFrame::fromOwnedInfo(const proto::OwnedAudioFrameBuffer &owned) {
-  const std::int16_t *ptr =
+  const auto *ptr =
diff --git a/include/livekit/video_frame.h b/include/livekit/video_frame.h
index d9632f3..2882cb5 100644
--- a/include/livekit/video_frame.h
+++ b/include/livekit/video_frame.h
@@ -78,3 +78,3 @@ public:
-  int width() const noexcept { return width_; }
-  int height() const noexcept { return height_; }
-  VideoBufferType type() const noexcept { return type_; }
+  [[nodiscard]] int width() const noexcept { return width_; }
+  [[nodiscard]] int height() const noexcept { return height_; }
+  [[nodiscard]] VideoBufferType type() const noexcept { return type_; }
@@ -83,2 +83,2 @@ public:
-  const std::uint8_t *data() const noexcept { return data_.data(); }
-  std::size_t dataSize() const noexcept { return data_.size(); }
+  [[nodiscard]] const std::uint8_t *data() const noexcept { return data_.data(); }
+  [[nodiscard]] std::size_t dataSize() const noexcept { return data_.size(); }
@@ -92 +92 @@ public:
-  std::vector<VideoPlaneInfo> planeInfos() const;
+  [[nodiscard]] std::vector<VideoPlaneInfo> planeInfos() const;
@@ -119 +119 @@ public:
-  VideoFrame convert(VideoBufferType dst, bool flip_y = false) const;
+  [[nodiscard]] VideoFrame convert(VideoBufferType dst, bool flip_y = false) const;
diff --git a/include/livekit/local_data_track.h b/include/livekit/local_data_track.h
index 6d128de..a9ad6d5 100644
--- a/include/livekit/local_data_track.h
+++ b/include/livekit/local_data_track.h
@@ -66 +66 @@ public:
-  const DataTrackInfo &info() const noexcept { return info_; }
+  [[nodiscard]] const DataTrackInfo &info() const noexcept { return info_; }
@@ -87 +87 @@ public:
-  bool isPublished() const;
+  [[nodiscard]] bool isPublished() const;
@@ -101 +101 @@ private:
-  uintptr_t ffi_handle_id() const noexcept { return handle_.get(); }
+  [[nodiscard]] uintptr_t ffi_handle_id() const noexcept { return handle_.get(); }

Have any feedback or feature suggestions? Share it here.

Copy link
Copy Markdown

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cpp-linter Review

Used clang-tidy v20.1.2

Click here for the full clang-tidy patch
diff --git a/include/livekit/local_data_track.h b/include/livekit/local_data_track.h
index 6d128de..a9ad6d5 100644
--- a/include/livekit/local_data_track.h
+++ b/include/livekit/local_data_track.h
@@ -66 +66 @@ public:
-  const DataTrackInfo &info() const noexcept { return info_; }
+  [[nodiscard]] const DataTrackInfo &info() const noexcept { return info_; }
@@ -87 +87 @@ public:
-  bool isPublished() const;
+  [[nodiscard]] bool isPublished() const;
@@ -101 +101 @@ private:
-  uintptr_t ffi_handle_id() const noexcept { return handle_.get(); }
+  [[nodiscard]] uintptr_t ffi_handle_id() const noexcept { return handle_.get(); }
diff --git a/src/tests/integration/test_data_track.cpp b/src/tests/integration/test_data_track.cpp
index 983497b..a8b1cc7 100644
--- a/src/tests/integration/test_data_track.cpp
+++ b/src/tests/integration/test_data_track.cpp
@@ -37,2 +37,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -847,2 +847,2 @@ INSTANTIATE_TEST_SUITE_P(DataTrackScenarios, DataTrackTransportTest,
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/src/tests/integration/test_audio_processing_module.cpp b/src/tests/integration/test_audio_processing_module.cpp
index 4c4b48c..3035481 100644
--- a/src/tests/integration/test_audio_processing_module.cpp
+++ b/src/tests/integration/test_audio_processing_module.cpp
@@ -31,2 +31,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -925,2 +925,2 @@ TEST_F(AudioProcessingModuleTest, AGCWithNoiseSuppressionCombined) {
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/src/lk_log.h b/src/lk_log.h
index 7c51596..e360ce3 100644
--- a/src/lk_log.h
+++ b/src/lk_log.h
@@ -23,2 +23,2 @@
-namespace livekit {
-namespace detail {
+
+namespace livekit::detail {
@@ -34,2 +34,2 @@ void shutdownLogger();
-} // namespace detail
-} // namespace livekit
+} // namespace livekit::detail
+
diff --git a/include/livekit/rpc_error.h b/include/livekit/rpc_error.h
index 2efb988..d2215cc 100644
--- a/include/livekit/rpc_error.h
+++ b/include/livekit/rpc_error.h
@@ -85 +85 @@ public:
-  std::uint32_t code() const noexcept;
+  [[nodiscard]] std::uint32_t code() const noexcept;
@@ -90 +90 @@ public:
-  const std::string &message() const noexcept;
+  [[nodiscard]] const std::string &message() const noexcept;
@@ -96 +96 @@ public:
-  const std::string &data() const noexcept;
+  [[nodiscard]] const std::string &data() const noexcept;
@@ -109 +109 @@ protected:
-  proto::RpcError toProto() const;
+  [[nodiscard]] proto::RpcError toProto() const;
diff --git a/src/tests/integration/test_sdk_initialization.cpp b/src/tests/integration/test_sdk_initialization.cpp
index 4d8fa02..0d2e615 100644
--- a/src/tests/integration/test_sdk_initialization.cpp
+++ b/src/tests/integration/test_sdk_initialization.cpp
@@ -20,2 +20,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -72,2 +72,2 @@ TEST_F(SDKInitializationTest, MultipleShutdowns) {
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/src/tests/common/test_common.h b/src/tests/common/test_common.h
index 3133adc..f02f1a4 100644
--- a/src/tests/common/test_common.h
+++ b/src/tests/common/test_common.h
@@ -37,2 +37,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -438,2 +438,2 @@ protected:
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/include/livekit/remote_audio_track.h b/include/livekit/remote_audio_track.h
index 572e62c..5de6003 100644
--- a/include/livekit/remote_audio_track.h
+++ b/include/livekit/remote_audio_track.h
@@ -52 +52 @@ public:
-  std::string to_string() const;
+  [[nodiscard]] std::string to_string() const;
diff --git a/bridge/src/livekit_bridge.cpp b/bridge/src/livekit_bridge.cpp
index b15587e..3869398 100644
--- a/bridge/src/livekit_bridge.cpp
+++ b/bridge/src/livekit_bridge.cpp
@@ -242 +242 @@ void LiveKitBridge::setOnAudioFrameCallback(
-    AudioFrameCallback callback) {
+    const AudioFrameCallback& callback) {
@@ -255 +255 @@ void LiveKitBridge::setOnVideoFrameCallback(
-    VideoFrameCallback callback) {
+    const VideoFrameCallback& callback) {
diff --git a/include/livekit/local_track_publication.h b/include/livekit/local_track_publication.h
index 3e8c6ed..cc8ebcd 100644
--- a/include/livekit/local_track_publication.h
+++ b/include/livekit/local_track_publication.h
@@ -36 +36 @@ public:
-  std::shared_ptr<Track> track() const noexcept;
+  [[nodiscard]] std::shared_ptr<Track> track() const noexcept;
diff --git a/include/livekit/remote_video_track.h b/include/livekit/remote_video_track.h
index ff65c4c..3e3d4a4 100644
--- a/include/livekit/remote_video_track.h
+++ b/include/livekit/remote_video_track.h
@@ -52 +52 @@ public:
-  std::string to_string() const;
+  [[nodiscard]] std::string to_string() const;
diff --git a/include/livekit/data_stream.h b/include/livekit/data_stream.h
index 11d906c..ed375bd 100644
--- a/include/livekit/data_stream.h
+++ b/include/livekit/data_stream.h
@@ -81 +81 @@ public:
-  explicit TextStreamReader(TextStreamInfo info);
+  explicit TextStreamReader(const TextStreamInfo &info);
@@ -95 +95 @@ public:
-  const TextStreamInfo &info() const noexcept { return info_; }
+  [[nodiscard]] const TextStreamInfo &info() const noexcept { return info_; }
@@ -121 +121 @@ public:
-  explicit ByteStreamReader(ByteStreamInfo info);
+  explicit ByteStreamReader(const ByteStreamInfo &info);
@@ -131 +131 @@ public:
-  const ByteStreamInfo &info() const noexcept { return info_; }
+  [[nodiscard]] const ByteStreamInfo &info() const noexcept { return info_; }
@@ -159 +159 @@ public:
-  const std::string &streamId() const noexcept { return stream_id_; }
+  [[nodiscard]] const std::string &streamId() const noexcept { return stream_id_; }
@@ -162 +162 @@ public:
-  const std::string &topic() const noexcept { return topic_; }
+  [[nodiscard]] const std::string &topic() const noexcept { return topic_; }
@@ -165 +165 @@ public:
-  const std::string &mimeType() const noexcept { return mime_type_; }
+  [[nodiscard]] const std::string &mimeType() const noexcept { return mime_type_; }
@@ -168 +168 @@ public:
-  std::int64_t timestampMs() const noexcept { return timestamp_ms_; }
+  [[nodiscard]] std::int64_t timestampMs() const noexcept { return timestamp_ms_; }
@@ -171 +171 @@ public:
-  bool isClosed() const noexcept { return closed_; }
+  [[nodiscard]] bool isClosed() const noexcept { return closed_; }
@@ -241 +241 @@ public:
-  const TextStreamInfo &info() const noexcept { return info_; }
+  [[nodiscard]] const TextStreamInfo &info() const noexcept { return info_; }
@@ -266 +266 @@ public:
-  const ByteStreamInfo &info() const noexcept { return info_; }
+  [[nodiscard]] const ByteStreamInfo &info() const noexcept { return info_; }
diff --git a/include/livekit/video_frame.h b/include/livekit/video_frame.h
index d9632f3..2882cb5 100644
--- a/include/livekit/video_frame.h
+++ b/include/livekit/video_frame.h
@@ -78,3 +78,3 @@ public:
-  int width() const noexcept { return width_; }
-  int height() const noexcept { return height_; }
-  VideoBufferType type() const noexcept { return type_; }
+  [[nodiscard]] int width() const noexcept { return width_; }
+  [[nodiscard]] int height() const noexcept { return height_; }
+  [[nodiscard]] VideoBufferType type() const noexcept { return type_; }
@@ -83,2 +83,2 @@ public:
-  const std::uint8_t *data() const noexcept { return data_.data(); }
-  std::size_t dataSize() const noexcept { return data_.size(); }
+  [[nodiscard]] const std::uint8_t *data() const noexcept { return data_.data(); }
+  [[nodiscard]] std::size_t dataSize() const noexcept { return data_.size(); }
@@ -92 +92 @@ public:
-  std::vector<VideoPlaneInfo> planeInfos() const;
+  [[nodiscard]] std::vector<VideoPlaneInfo> planeInfos() const;
@@ -119 +119 @@ public:
-  VideoFrame convert(VideoBufferType dst, bool flip_y = false) const;
+  [[nodiscard]] VideoFrame convert(VideoBufferType dst, bool flip_y = false) const;
diff --git a/include/livekit/remote_track_publication.h b/include/livekit/remote_track_publication.h
index aa39408..9169a52 100644
--- a/include/livekit/remote_track_publication.h
+++ b/include/livekit/remote_track_publication.h
@@ -36 +36 @@ public:
-  std::shared_ptr<Track> track() const noexcept;
+  [[nodiscard]] std::shared_ptr<Track> track() const noexcept;
@@ -38 +38 @@ public:
-  bool subscribed() const noexcept { return subscribed_; }
+  [[nodiscard]] bool subscribed() const noexcept { return subscribed_; }
diff --git a/src/rpc_error.cpp b/src/rpc_error.cpp
index 1e521cd..96848ee 100644
--- a/src/rpc_error.cpp
+++ b/src/rpc_error.cpp
@@ -52 +52 @@ RpcError RpcError::fromProto(const proto::RpcError &err) {
-  return RpcError(err.code(), err.message(), err.data());
+  return {err.code(), err.message(), err.data()};
@@ -57 +57 @@ RpcError RpcError::builtIn(ErrorCode code, const std::string &data) {
-  return RpcError(code, msg ? std::string(msg) : std::string{}, data);
+  return {code, msg ? std::string(msg) : std::string{}, data};
diff --git a/bridge/tests/integration/test_bridge_rpc_roundtrip.cpp b/bridge/tests/integration/test_bridge_rpc_roundtrip.cpp
index e649450..b0012e4 100644
--- a/bridge/tests/integration/test_bridge_rpc_roundtrip.cpp
+++ b/bridge/tests/integration/test_bridge_rpc_roundtrip.cpp
@@ -20,2 +20,2 @@
-namespace livekit_bridge {
-namespace test {
+
+namespace livekit_bridge::test {
@@ -270,2 +270,2 @@ TEST_F(BridgeRemoteTrackControlTest, RemoteMuteNonexistentTrack) {
-} // namespace test
-} // namespace livekit_bridge
+} // namespace livekit_bridge::test
+
diff --git a/include/livekit/audio_processing_module.h b/include/livekit/audio_processing_module.h
index 29eab33..0935c99 100644
--- a/include/livekit/audio_processing_module.h
+++ b/include/livekit/audio_processing_module.h
@@ -159 +159 @@ private:
-  bool valid() const noexcept { return handle_.valid(); }
+  [[nodiscard]] bool valid() const noexcept { return handle_.valid(); }
@@ -162 +162 @@ private:
-  std::uint64_t ffi_handle_id() const noexcept {
+  [[nodiscard]] std::uint64_t ffi_handle_id() const noexcept {
diff --git a/src/room.cpp b/src/room.cpp
index 919e126..a71068f 100644
--- a/src/room.cpp
+++ b/src/room.cpp
@@ -276,2 +276,2 @@ void Room::setOnAudioFrameCallback(const std::string &participant_identity,
-                                   AudioFrameCallback callback,
-                                   AudioStream::Options opts) {
+                                   const AudioFrameCallback& callback,
+                                   const AudioStream::Options& opts) {
@@ -286,2 +286,2 @@ void Room::setOnAudioFrameCallback(const std::string &participant_identity,
-                                   AudioFrameCallback callback,
-                                   AudioStream::Options opts) {
+                                   const AudioFrameCallback& callback,
+                                   const AudioStream::Options& opts) {
@@ -296 +296 @@ void Room::setOnVideoFrameCallback(const std::string &participant_identity,
-                                   VideoFrameCallback callback,
+                                   const VideoFrameCallback& callback,
@@ -306 +306 @@ void Room::setOnVideoFrameCallback(const std::string &participant_identity,
-                                   VideoFrameCallback callback,
+                                   const VideoFrameCallback& callback,
@@ -349 +349 @@ Room::addOnDataFrameCallback(const std::string &participant_identity,
-                             DataFrameCallback callback) {
+                             const DataFrameCallback& callback) {
diff --git a/include/livekit/result.h b/include/livekit/result.h
index bc7f133..e321b03 100644
--- a/include/livekit/result.h
+++ b/include/livekit/result.h
@@ -46 +46 @@ public:
-            typename = std::enable_if_t<std::is_constructible<T, U &&>::value>>
+            typename = std::enable_if_t<std::is_constructible_v<T, U &&>>>
@@ -54 +54 @@ public:
-            typename = std::enable_if_t<std::is_constructible<E, F &&>::value>>
+            typename = std::enable_if_t<std::is_constructible_v<E, F &&>>>
@@ -61 +61 @@ public:
-  bool ok() const noexcept { return storage_.index() == 0; }
+  [[nodiscard]] bool ok() const noexcept { return storage_.index() == 0; }
@@ -63 +63 @@ public:
-  bool has_error() const noexcept { return !ok(); }
+  [[nodiscard]] bool has_error() const noexcept { return !ok(); }
@@ -134 +134 @@ public:
-            typename = std::enable_if_t<std::is_constructible<E, F &&>::value>>
+            typename = std::enable_if_t<std::is_constructible_v<E, F &&>>>
@@ -140 +140 @@ public:
-  bool ok() const noexcept { return !error_.has_value(); }
+  [[nodiscard]] bool ok() const noexcept { return !error_.has_value(); }
@@ -142 +142 @@ public:
-  bool has_error() const noexcept { return error_.has_value(); }
+  [[nodiscard]] bool has_error() const noexcept { return error_.has_value(); }
diff --git a/include/livekit/participant.h b/include/livekit/participant.h
index 5987963..f61d64b 100644
--- a/include/livekit/participant.h
+++ b/include/livekit/participant.h
@@ -44,5 +44,5 @@ public:
-  const std::string &sid() const noexcept { return sid_; }
-  const std::string &name() const noexcept { return name_; }
-  const std::string &identity() const noexcept { return identity_; }
-  const std::string &metadata() const noexcept { return metadata_; }
-  const std::unordered_map<std::string, std::string> &
+  [[nodiscard]] const std::string &sid() const noexcept { return sid_; }
+  [[nodiscard]] const std::string &name() const noexcept { return name_; }
+  [[nodiscard]] const std::string &identity() const noexcept { return identity_; }
+  [[nodiscard]] const std::string &metadata() const noexcept { return metadata_; }
+  [[nodiscard]] const std::unordered_map<std::string, std::string> &
@@ -52,2 +52,2 @@ public:
-  ParticipantKind kind() const noexcept { return kind_; }
-  DisconnectReason disconnectReason() const noexcept { return reason_; }
+  [[nodiscard]] ParticipantKind kind() const noexcept { return kind_; }
+  [[nodiscard]] DisconnectReason disconnectReason() const noexcept { return reason_; }
@@ -55 +55 @@ public:
-  uintptr_t ffiHandleId() const noexcept { return handle_.get(); }
+  [[nodiscard]] uintptr_t ffiHandleId() const noexcept { return handle_.get(); }
@@ -58,2 +58,2 @@ public:
-  void set_name(std::string name) noexcept { name_ = std::move(name); }
-  void set_metadata(std::string metadata) noexcept {
+  void set_name(const std::string& name) noexcept { name_ = std::move(name); }
+  void set_metadata(const std::string& metadata) noexcept {
@@ -76 +76 @@ protected:
-  virtual std::shared_ptr<TrackPublication>
+  [[nodiscard]] virtual std::shared_ptr<TrackPublication>
diff --git a/include/livekit/local_video_track.h b/include/livekit/local_video_track.h
index a431740..72d747f 100644
--- a/include/livekit/local_video_track.h
+++ b/include/livekit/local_video_track.h
@@ -80 +80 @@ public:
-  std::string to_string() const;
+  [[nodiscard]] std::string to_string() const;
@@ -84 +84 @@ public:
-  std::shared_ptr<LocalTrackPublication> publication() const noexcept {
+  [[nodiscard]] std::shared_ptr<LocalTrackPublication> publication() const noexcept {
@@ -91 +91 @@ public:
-    local_publication_ = std::move(publication);
+    local_publication_ = publication;
diff --git a/src/tests/stress/test_room_stress.cpp b/src/tests/stress/test_room_stress.cpp
index 50cc986..602cb98 100644
--- a/src/tests/stress/test_room_stress.cpp
+++ b/src/tests/stress/test_room_stress.cpp
@@ -25,2 +25,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -241,2 +241,2 @@ TEST_F(RoomServerStressTest, RepeatedConnectDisconnect) {
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/src/tests/integration/test_logging.cpp b/src/tests/integration/test_logging.cpp
index 88e1616..9077d59 100644
--- a/src/tests/integration/test_logging.cpp
+++ b/src/tests/integration/test_logging.cpp
@@ -28,2 +28,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -296,2 +296,2 @@ TEST_F(LoggingTest, ConcurrentLogEmissionDoesNotCrash) {
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/src/subscription_thread_dispatcher.cpp b/src/subscription_thread_dispatcher.cpp
index ee68365..7c548e8 100644
--- a/src/subscription_thread_dispatcher.cpp
+++ b/src/subscription_thread_dispatcher.cpp
@@ -90 +90 @@ void SubscriptionThreadDispatcher::setOnVideoFrameCallback(
-      RegisteredVideoCallback{std::move(callback), std::move(opts)};
+      RegisteredVideoCallback{std::move(callback), opts};
@@ -105 +105 @@ void SubscriptionThreadDispatcher::setOnVideoFrameCallback(
-      RegisteredVideoCallback{std::move(callback), std::move(opts)};
+      RegisteredVideoCallback{std::move(callback), opts};
@@ -478 +478 @@ std::thread SubscriptionThreadDispatcher::startAudioReaderLocked(
-    AudioFrameCallback cb, const AudioStream::Options &opts) {
+    const AudioFrameCallback& cb, const AudioStream::Options &opts) {
@@ -501 +501 @@ std::thread SubscriptionThreadDispatcher::startAudioReaderLocked(
-  auto stream_copy = stream;
+  const auto& stream_copy = stream;
@@ -529 +529 @@ std::thread SubscriptionThreadDispatcher::startVideoReaderLocked(
-    VideoFrameCallback cb, const VideoStream::Options &opts) {
+    const VideoFrameCallback& cb, const VideoStream::Options &opts) {
@@ -552 +552 @@ std::thread SubscriptionThreadDispatcher::startVideoReaderLocked(
-  auto stream_copy = stream;
+  const auto& stream_copy = stream;
@@ -623 +623 @@ std::thread SubscriptionThreadDispatcher::startDataReaderLocked(
-    const std::shared_ptr<RemoteDataTrack> &track, DataFrameCallback cb) {
+    const std::shared_ptr<RemoteDataTrack> &track, const DataFrameCallback& cb) {
diff --git a/src/audio_frame.cpp b/src/audio_frame.cpp
index 23ff01e..d165e73 100644
--- a/src/audio_frame.cpp
+++ b/src/audio_frame.cpp
@@ -72 +72 @@ AudioFrame::fromOwnedInfo(const proto::OwnedAudioFrameBuffer &owned) {
-  const std::int16_t *ptr =
+  const auto *ptr =
diff --git a/src/tests/common/audio_utils.h b/src/tests/common/audio_utils.h
index 1576b9a..5988b4d 100644
--- a/src/tests/common/audio_utils.h
+++ b/src/tests/common/audio_utils.h
@@ -27,2 +27,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -110,2 +110,2 @@ inline void fillToneFrame(AudioFrame &frame, double freq_hz, int sample_rate,
-  for (std::size_t i = 0; i < samples.size(); ++i) {
-    samples[i] = static_cast<std::int16_t>(std::sin(phase) * amplitude);
+  for (short & sample : samples) {
+    sample = static_cast<std::int16_t>(std::sin(phase) * amplitude);
@@ -119,2 +119,2 @@ inline void fillToneFrame(AudioFrame &frame, double freq_hz, int sample_rate,
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/src/tests/common/video_utils.h b/src/tests/common/video_utils.h
index eb743c5..8150300 100644
--- a/src/tests/common/video_utils.h
+++ b/src/tests/common/video_utils.h
@@ -26,2 +26,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -40 +40 @@ inline void fillWebcamLikeFrame(VideoFrame &frame, std::uint64_t frame_index) {
-  const std::uint8_t blue = static_cast<std::uint8_t>((frame_index * 3) % 255);
+  const auto blue = static_cast<std::uint8_t>((frame_index * 3) % 255);
@@ -128,2 +128,2 @@ inline void runVideoLoop(
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/bridge/src/rpc_constants.cpp b/bridge/src/rpc_constants.cpp
index 03386fe..bf8dde3 100644
--- a/bridge/src/rpc_constants.cpp
+++ b/bridge/src/rpc_constants.cpp
@@ -19,3 +19,3 @@
-namespace livekit_bridge {
-namespace rpc {
-namespace track_control {
+
+
+namespace livekit_bridge::rpc::track_control {
@@ -39,3 +39,3 @@ std::string formatPayload(const char *action, const std::string &track_name) {
-} // namespace track_control
-} // namespace rpc
-} // namespace livekit_bridge
+} // namespace livekit_bridge::rpc::track_control
+
+
diff --git a/src/video_frame.cpp b/src/video_frame.cpp
index 5fdc83e..ddf6572 100644
--- a/src/video_frame.cpp
+++ b/src/video_frame.cpp
@@ -291 +291 @@ std::vector<VideoPlaneInfo> VideoFrame::planeInfos() const {
-  uintptr_t base = reinterpret_cast<uintptr_t>(data_.data());
+  auto base = reinterpret_cast<uintptr_t>(data_.data());
diff --git a/bridge/tests/test_bridge_video_track.cpp b/bridge/tests/test_bridge_video_track.cpp
index 08517b0..5056601 100644
--- a/bridge/tests/test_bridge_video_track.cpp
+++ b/bridge/tests/test_bridge_video_track.cpp
@@ -27,2 +27,2 @@
-namespace livekit_bridge {
-namespace test {
+
+namespace livekit_bridge::test {
@@ -113,2 +113,2 @@ TEST_F(BridgeVideoTrackTest, UnmuteOnReleasedTrackDoesNotCrash) {
-} // namespace test
-} // namespace livekit_bridge
+} // namespace livekit_bridge::test
+
diff --git a/include/livekit/audio_frame.h b/include/livekit/audio_frame.h
index 2db2b9b..1e35b93 100644
--- a/include/livekit/audio_frame.h
+++ b/include/livekit/audio_frame.h
@@ -68 +68 @@ public:
-  const std::vector<std::int16_t> &data() const noexcept { return data_; }
+  [[nodiscard]] const std::vector<std::int16_t> &data() const noexcept { return data_; }
@@ -72 +72 @@ public:
-  std::size_t total_samples() const noexcept { return data_.size(); }
+  [[nodiscard]] std::size_t total_samples() const noexcept { return data_.size(); }
@@ -75 +75 @@ public:
-  int sample_rate() const noexcept { return sample_rate_; }
+  [[nodiscard]] int sample_rate() const noexcept { return sample_rate_; }
@@ -78 +78 @@ public:
-  int num_channels() const noexcept { return num_channels_; }
+  [[nodiscard]] int num_channels() const noexcept { return num_channels_; }
@@ -81 +81 @@ public:
-  int samples_per_channel() const noexcept { return samples_per_channel_; }
+  [[nodiscard]] int samples_per_channel() const noexcept { return samples_per_channel_; }
@@ -84 +84 @@ public:
-  double duration() const noexcept;
+  [[nodiscard]] double duration() const noexcept;
@@ -87 +87 @@ public:
-  std::string to_string() const;
+  [[nodiscard]] std::string to_string() const;
@@ -92 +92 @@ protected:
-  proto::AudioFrameBufferInfo toProto() const;
+  [[nodiscard]] proto::AudioFrameBufferInfo toProto() const;
diff --git a/bridge/include/livekit_bridge/rpc_constants.h b/bridge/include/livekit_bridge/rpc_constants.h
index 3511239..e200fd7 100644
--- a/bridge/include/livekit_bridge/rpc_constants.h
+++ b/bridge/include/livekit_bridge/rpc_constants.h
@@ -24,2 +24,2 @@
-namespace livekit_bridge {
-namespace rpc {
+
+
@@ -32 +32 @@ namespace rpc {
-namespace track_control {
+namespace livekit_bridge::rpc::track_control {
@@ -52,3 +52,3 @@ std::string formatPayload(const char *action, const std::string &track_name);
-} // namespace track_control
-} // namespace rpc
-} // namespace livekit_bridge
+} // namespace livekit_bridge::rpc::track_control
+
+
diff --git a/include/livekit/track_publication.h b/include/livekit/track_publication.h
index 5d0ff47..9cf1c78 100644
--- a/include/livekit/track_publication.h
+++ b/include/livekit/track_publication.h
@@ -50,9 +50,9 @@ public:
-  const std::string &sid() const noexcept { return sid_; }
-  const std::string &name() const noexcept { return name_; }
-  TrackKind kind() const noexcept { return kind_; }
-  TrackSource source() const noexcept { return source_; }
-  bool simulcasted() const noexcept { return simulcasted_; }
-  std::uint32_t width() const noexcept { return width_; }
-  std::uint32_t height() const noexcept { return height_; }
-  const std::string &mimeType() const noexcept { return mime_type_; }
-  bool muted() const noexcept { return muted_; }
+  [[nodiscard]] const std::string &sid() const noexcept { return sid_; }
+  [[nodiscard]] const std::string &name() const noexcept { return name_; }
+  [[nodiscard]] TrackKind kind() const noexcept { return kind_; }
+  [[nodiscard]] TrackSource source() const noexcept { return source_; }
+  [[nodiscard]] bool simulcasted() const noexcept { return simulcasted_; }
+  [[nodiscard]] std::uint32_t width() const noexcept { return width_; }
+  [[nodiscard]] std::uint32_t height() const noexcept { return height_; }
+  [[nodiscard]] const std::string &mimeType() const noexcept { return mime_type_; }
+  [[nodiscard]] bool muted() const noexcept { return muted_; }
@@ -61,2 +61,2 @@ public:
-  EncryptionType encryptionType() const noexcept { return encryption_type_; }
-  const std::vector<AudioTrackFeature> &audioFeatures() const noexcept {
+  [[nodiscard]] EncryptionType encryptionType() const noexcept { return encryption_type_; }
+  [[nodiscard]] const std::vector<AudioTrackFeature> &audioFeatures() const noexcept {
@@ -67 +67 @@ public:
-  uintptr_t ffiHandleId() const noexcept { return handle_.get(); }
+  [[nodiscard]] uintptr_t ffiHandleId() const noexcept { return handle_.get(); }
@@ -70 +70 @@ public:
-  std::shared_ptr<Track> track() const noexcept { return track_; }
+  [[nodiscard]] std::shared_ptr<Track> track() const noexcept { return track_; }
diff --git a/src/ffi_client.h b/src/ffi_client.h
index bc5fd3e..120d9a5 100644
--- a/src/ffi_client.h
+++ b/src/ffi_client.h
@@ -170 +170 @@ private:
-    virtual bool matches(const proto::FfiEvent &event) const = 0;
+    [[nodiscard]] virtual bool matches(const proto::FfiEvent &event) const = 0;
@@ -179 +179 @@ private:
-    bool matches(const proto::FfiEvent &event) const override {
+    [[nodiscard]] bool matches(const proto::FfiEvent &event) const override {
diff --git a/src/tests/integration/test_media_multistream.cpp b/src/tests/integration/test_media_multistream.cpp
index 8b98fe9..91495fc 100644
--- a/src/tests/integration/test_media_multistream.cpp
+++ b/src/tests/integration/test_media_multistream.cpp
@@ -29,2 +29,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -241 +241 @@ void MediaMultiStreamIntegrationTest::runPublishTwoVideoAndTwoAudioTracks(
-TEST_F(MediaMultiStreamIntegrationTest,
+TEST_F(const MediaMultiStreamIntegrationTest&,
@@ -246 +246 @@ TEST_F(MediaMultiStreamIntegrationTest,
-TEST_F(MediaMultiStreamIntegrationTest,
+TEST_F(const MediaMultiStreamIntegrationTest&,
@@ -251,2 +251,2 @@ TEST_F(MediaMultiStreamIntegrationTest,
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/include/livekit/track.h b/include/livekit/track.h
index 35b1abf..5b5e3a6 100644
--- a/include/livekit/track.h
+++ b/include/livekit/track.h
@@ -78,6 +78,6 @@ public:
-  const std::string &sid() const noexcept { return sid_; }
-  const std::string &name() const noexcept { return name_; }
-  TrackKind kind() const noexcept { return kind_; }
-  StreamState stream_state() const noexcept { return state_; }
-  bool muted() const noexcept { return muted_; }
-  bool remote() const noexcept { return remote_; }
+  [[nodiscard]] const std::string &sid() const noexcept { return sid_; }
+  [[nodiscard]] const std::string &name() const noexcept { return name_; }
+  [[nodiscard]] TrackKind kind() const noexcept { return kind_; }
+  [[nodiscard]] StreamState stream_state() const noexcept { return state_; }
+  [[nodiscard]] bool muted() const noexcept { return muted_; }
+  [[nodiscard]] bool remote() const noexcept { return remote_; }
@@ -86,5 +86,5 @@ public:
-  std::optional<TrackSource> source() const noexcept { return source_; }
-  std::optional<bool> simulcasted() const noexcept { return simulcasted_; }
-  std::optional<uint32_t> width() const noexcept { return width_; }
-  std::optional<uint32_t> height() const noexcept { return height_; }
-  std::optional<std::string> mime_type() const noexcept { return mime_type_; }
+  [[nodiscard]] std::optional<TrackSource> source() const noexcept { return source_; }
+  [[nodiscard]] std::optional<bool> simulcasted() const noexcept { return simulcasted_; }
+  [[nodiscard]] std::optional<uint32_t> width() const noexcept { return width_; }
+  [[nodiscard]] std::optional<uint32_t> height() const noexcept { return height_; }
+  [[nodiscard]] std::optional<std::string> mime_type() const noexcept { return mime_type_; }
@@ -93,2 +93,2 @@ public:
-  bool has_handle() const noexcept { return handle_.valid(); }
-  uintptr_t ffi_handle_id() const noexcept { return handle_.get(); }
+  [[nodiscard]] bool has_handle() const noexcept { return handle_.valid(); }
+  [[nodiscard]] uintptr_t ffi_handle_id() const noexcept { return handle_.get(); }
@@ -97 +97 @@ public:
-  std::future<std::vector<RtcStats>> getStats() const;
+  [[nodiscard]] std::future<std::vector<RtcStats>> getStats() const;
@@ -119 +119 @@ protected:
-                            const std::optional<std::string>& mime_type);
+                            std::optional<std::string> mime_type);
diff --git a/src/data_stream.cpp b/src/data_stream.cpp
index 4db1312..7d1a22e 100644
--- a/src/data_stream.cpp
+++ b/src/data_stream.cpp
@@ -6,0 +7 @@
+#include <utility>
@@ -91 +92 @@ void fillBaseInfo(BaseStreamInfo &dst, const std::string &stream_id,
-TextStreamReader::TextStreamReader(const TextStreamInfo &info) : info_(info) {}
+TextStreamReader::TextStreamReader(TextStreamInfo info) : info_(std::move(info)) {}
@@ -135 +136 @@ std::string TextStreamReader::readAll() {
-ByteStreamReader::ByteStreamReader(const ByteStreamInfo &info) : info_(info) {}
+ByteStreamReader::ByteStreamReader(ByteStreamInfo info) : info_(std::move(info)) {}
@@ -176 +177 @@ BaseStreamWriter::BaseStreamWriter(
-    LocalParticipant &local_participant, const std::string &topic,
+    LocalParticipant &local_participant, std::string topic,
@@ -179 +180 @@ BaseStreamWriter::BaseStreamWriter(
-    const std::string &mime_type,
+    std::string mime_type,
@@ -181 +182 @@ BaseStreamWriter::BaseStreamWriter(
-    const std::string &sender_identity)
+    std::string sender_identity)
@@ -184 +185 @@ BaseStreamWriter::BaseStreamWriter(
-      mime_type_(mime_type), topic_(topic),
+      mime_type_(std::move(mime_type)), topic_(std::move(topic)),
@@ -190 +191 @@ BaseStreamWriter::BaseStreamWriter(
-      sender_identity_(sender_identity) {
+      sender_identity_(std::move(sender_identity)) {
diff --git a/src/tests/stress/test_rpc_stress.cpp b/src/tests/stress/test_rpc_stress.cpp
index 4e25a7b..0a5d71c 100644
--- a/src/tests/stress/test_rpc_stress.cpp
+++ b/src/tests/stress/test_rpc_stress.cpp
@@ -22,2 +22,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -890,2 +890,2 @@ TEST_F(RpcStressTest, HighThroughputBurst) {
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/include/livekit/e2ee.h b/include/livekit/e2ee.h
index e6473ae..f54f712 100644
--- a/include/livekit/e2ee.h
+++ b/include/livekit/e2ee.h
@@ -127 +127 @@ public:
-    const KeyProviderOptions &options() const;
+    [[nodiscard]] const KeyProviderOptions &options() const;
@@ -133 +133 @@ public:
-    std::vector<std::uint8_t> exportSharedKey(int key_index = 0) const;
+    [[nodiscard]] std::vector<std::uint8_t> exportSharedKey(int key_index = 0) const;
@@ -143 +143 @@ public:
-    std::vector<std::uint8_t> exportKey(const std::string &participant_identity,
+    [[nodiscard]] std::vector<std::uint8_t> exportKey(const std::string &participant_identity,
@@ -167,3 +167,3 @@ public:
-    const std::string &participantIdentity() const;
-    int keyIndex() const;
-    bool enabled() const;
+    [[nodiscard]] const std::string &participantIdentity() const;
+    [[nodiscard]] int keyIndex() const;
+    [[nodiscard]] bool enabled() const;
@@ -191 +191 @@ public:
-  bool enabled() const;
+  [[nodiscard]] bool enabled() const;
@@ -203 +203 @@ public:
-  const KeyProvider *keyProvider() const;
+  [[nodiscard]] const KeyProvider *keyProvider() const;
@@ -206 +206 @@ public:
-  std::vector<E2EEManager::FrameCryptor> frameCryptors() const;
+  [[nodiscard]] std::vector<E2EEManager::FrameCryptor> frameCryptors() const;
diff --git a/examples/common/sdl_media.h b/examples/common/sdl_media.h
index a60bca6..b90325a 100644
--- a/examples/common/sdl_media.h
+++ b/examples/common/sdl_media.h
@@ -50 +50 @@ public:
-  bool isValid() const { return stream_ != nullptr; }
+  [[nodiscard]] bool isValid() const { return stream_ != nullptr; }
@@ -80 +80 @@ public:
-  bool isValid() const { return stream_ != nullptr; }
+  [[nodiscard]] bool isValid() const { return stream_ != nullptr; }
@@ -118 +118 @@ public:
-  bool isValid() const { return camera_ != nullptr; }
+  [[nodiscard]] bool isValid() const { return camera_ != nullptr; }
diff --git a/examples/simple_data_stream/main.cpp b/examples/simple_data_stream/main.cpp
index f8144b7..5b37fd5 100644
--- a/examples/simple_data_stream/main.cpp
+++ b/examples/simple_data_stream/main.cpp
@@ -41 +41 @@ std::string randomHexId(std::size_t nbytes = 16) {
-    std::uint8_t b = static_cast<std::uint8_t>(rng() & 0xFF);
+    auto b = static_cast<std::uint8_t>(rng() & 0xFF);
diff --git a/src/tests/integration/test_audio_frame.cpp b/src/tests/integration/test_audio_frame.cpp
index 9eba0be..dd11fd5 100644
--- a/src/tests/integration/test_audio_frame.cpp
+++ b/src/tests/integration/test_audio_frame.cpp
@@ -21,2 +21,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -169,2 +169,2 @@ TEST_F(AudioFrameTest, InvalidDataSizeThrows) {
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/src/tests/integration/test_room.cpp b/src/tests/integration/test_room.cpp
index f815472..0ed0fcf 100644
--- a/src/tests/integration/test_room.cpp
+++ b/src/tests/integration/test_room.cpp
@@ -20,2 +20,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -163,2 +163,2 @@ TEST_F(RoomServerTest, ConnectWithInvalidUrl) {
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/include/livekit/remote_data_track.h b/include/livekit/remote_data_track.h
index 762140b..53986b0 100644
--- a/include/livekit/remote_data_track.h
+++ b/include/livekit/remote_data_track.h
@@ -61 +61 @@ public:
-  const DataTrackInfo &info() const noexcept { return info_; }
+  [[nodiscard]] const DataTrackInfo &info() const noexcept { return info_; }
@@ -64 +64 @@ public:
-  const std::string &publisherIdentity() const noexcept {
+  [[nodiscard]] const std::string &publisherIdentity() const noexcept {
@@ -69 +69 @@ public:
-  bool isPublished() const;
+  [[nodiscard]] bool isPublished() const;
@@ -90 +90 @@ private:
-  uintptr_t ffi_handle_id() const noexcept { return handle_.get(); }
+  [[nodiscard]] uintptr_t ffi_handle_id() const noexcept { return handle_.get(); }
diff --git a/src/tests/stress/test_latency_measurement.cpp b/src/tests/stress/test_latency_measurement.cpp
index e93d210..8f332bb 100644
--- a/src/tests/stress/test_latency_measurement.cpp
+++ b/src/tests/stress/test_latency_measurement.cpp
@@ -23,2 +23,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -63 +63 @@ static std::vector<int16_t> generateHighEnergyFrame(int samples_per_channel) {
-    int16_t sample =
+    auto sample =
@@ -855,2 +855,2 @@ TEST_F(LatencyMeasurementTest, FullDeplexAudioLatency) {
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/src/track.cpp b/src/track.cpp
index 2dd403d..831a65f 100644
--- a/src/track.cpp
+++ b/src/track.cpp
@@ -34 +34 @@ void Track::setPublicationFields(std::optional<TrackSource> source,
-                                 std::optional<std::string> mime_type) {
+                                 const std::optional<std::string>& mime_type) {
diff --git a/src/tests/integration/test_rpc.cpp b/src/tests/integration/test_rpc.cpp
index 1747eaf..1d1576a 100644
--- a/src/tests/integration/test_rpc.cpp
+++ b/src/tests/integration/test_rpc.cpp
@@ -29,2 +29,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -535,2 +535,2 @@ TEST_F(RpcIntegrationTest, OneMinuteIntegration) {
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/bridge/src/rpc_controller.h b/bridge/src/rpc_controller.h
index 97d096d..c2b0a40 100644
--- a/bridge/src/rpc_controller.h
+++ b/bridge/src/rpc_controller.h
@@ -72 +72 @@ public:
-  bool isEnabled() const { return lp_ != nullptr; }
+  [[nodiscard]] bool isEnabled() const { return lp_ != nullptr; }
diff --git a/src/ffi_client.cpp b/src/ffi_client.cpp
index 9c20691..7ef11b4 100644
--- a/src/ffi_client.cpp
+++ b/src/ffi_client.cpp
@@ -654,2 +654 @@ FfiClient::publishDataTrackAsync(std::uint64_t local_participant_handle,
-        proto::OwnedLocalDataTrack track = cb.track();
-        pr.set_value(
+               pr.set_value(
diff --git a/src/tests/stress/test_audio_frame_stress.cpp b/src/tests/stress/test_audio_frame_stress.cpp
index 41f92e9..32000a4 100644
--- a/src/tests/stress/test_audio_frame_stress.cpp
+++ b/src/tests/stress/test_audio_frame_stress.cpp
@@ -25,2 +25,2 @@
-namespace livekit {
-namespace test {
+
+namespace livekit::test {
@@ -286,2 +286,2 @@ TEST_F(AudioFrameStressTest, SimulatedRealtimeProcessing) {
-} // namespace test
-} // namespace livekit
+} // namespace livekit::test
+
diff --git a/include/livekit/local_audio_track.h b/include/livekit/local_audio_track.h
index 9c46819..26ce63f 100644
--- a/include/livekit/local_audio_track.h
+++ b/include/livekit/local_audio_track.h
@@ -79 +79 @@ public:
-  std::string to_string() const;
+  [[nodiscard]] std::string to_string() const;
@@ -83 +83 @@ public:
-  std::shared_ptr<LocalTrackPublication> publication() const noexcept {
+  [[nodiscard]] std::shared_ptr<LocalTrackPublication> publication() const noexcept {
@@ -90 +90 @@ public:
-    local_publication_ = std::move(publication);
+    local_publication_ = publication;
diff --git a/bridge/tests/test_bridge_audio_track.cpp b/bridge/tests/test_bridge_audio_track.cpp
index 8e7274e..ea6aa1f 100644
--- a/bridge/tests/test_bridge_audio_track.cpp
+++ b/bridge/tests/test_bridge_audio_track.cpp
@@ -27,2 +27,2 @@
-namespace livekit_bridge {
-namespace test {
+
+namespace livekit_bridge::test {
@@ -117,2 +117,2 @@ TEST_F(BridgeAudioTrackTest, UnmuteOnReleasedTrackDoesNotCrash) {
-} // namespace test
-} // namespace livekit_bridge
+} // namespace livekit_bridge::test
+
diff --git a/include/livekit/video_source.h b/include/livekit/video_source.h
index 47715dc..62bb064 100644
--- a/include/livekit/video_source.h
+++ b/include/livekit/video_source.h
@@ -63,2 +63,2 @@ public:
-  int width() const noexcept { return width_; }
-  int height() const noexcept { return height_; }
+  [[nodiscard]] int width() const noexcept { return width_; }
+  [[nodiscard]] int height() const noexcept { return height_; }
@@ -67 +67 @@ public:
-  std::uint64_t ffi_handle_id() const noexcept { return handle_.get(); }
+  [[nodiscard]] std::uint64_t ffi_handle_id() const noexcept { return handle_.get(); }
diff --git a/examples/simple_rpc/main.cpp b/examples/simple_rpc/main.cpp
index b171f9b..8d39fc6 100644
--- a/examples/simple_rpc/main.cpp
+++ b/examples/simple_rpc/main.cpp
@@ -381 +381 @@ void performDivide(Room *room) {
-    std::string payload = "{\"dividend\":10,\"divisor\":0}";
+    std::string payload = R"({"dividend":10,"divisor":0})";

Have any feedback or feature suggestions? Share it here.

Copy link
Copy Markdown
Contributor

@stephen-derosa stephen-derosa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im curious your thoughts on automating a way to get this cool new dev-friendly work on clang/compile commands implemented into other repos as well such as cpp-examples-collection or the pan_tilt_demo.

name: windows-x64
build_cmd: .\build.cmd release-examples
build_dir: build-release
# - os: ubuntu-24.04-arm
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a note to remove

libssl-dev \
libprotobuf-dev protobuf-compiler \
libabsl-dev \
libspdlog-dev \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we already have a lot of these deps in other stages -- should we just add clang-tidy to a stage(s) that already has deps of the lib?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants