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 4 times, most recently from e53271c to 84d67e7 Compare April 8, 2026 19:45
@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: 186 concern(s)
  • 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 {
          |            ^
  • 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/track.h:34:12: warning: [performance-enum-size]

    enum 'TrackKind' 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

       34 | enum class TrackKind {
          |            ^
  • include/livekit/track.h:40:12: warning: [performance-enum-size]

    enum 'TrackSource' 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

       40 | enum class TrackSource {
          |            ^
  • include/livekit/track.h:48:12: warning: [performance-enum-size]

    enum 'StreamState' 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

       48 | enum class StreamState {
          |            ^
  • include/livekit/track.h:54:12: warning: [performance-enum-size]

    enum 'AudioTrackFeature' 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

       54 | enum class AudioTrackFeature {
          |            ^
  • bridge/include/livekit_bridge/rpc_constants.h:24:1: warning: [modernize-concat-nested-namespaces]

    nested namespaces can be concatenated

       24 | namespace livekit_bridge {
          | ^~~~~~~~~~~~~~~~~~~~~~~~~~
       25 | namespace rpc {
          | ~~~~~~~~~~~~~~~
       26 | 
       27 | /// Built-in RPC method name used by remote track control.
       28 | /// Allows remote participants to mute or unmute tracks
       29 | /// published by this bridge. Must be called after connect().
       30 | /// Audio/video tracks support mute and unmute. Data tracks
       31 | /// only support mute and unmute.
       32 | namespace track_control {
          | ~~~~~~~~~~~~~~~~~~~~~~~
          | namespace livekit_bridge::rpc::track_control
  • bridge/include/livekit_bridge/rpc_constants.h:34:12: warning: [performance-enum-size]

    enum 'Action' 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

       34 | enum class Action { kActionMute, kActionUnmute };
          |            ^
  • examples/ping_pong/json_converters.cpp:21:10: error: [clang-diagnostic-error]

    'nlohmann/json.hpp' file not found

       21 | #include <nlohmann/json.hpp>
          |          ^~~~~~~~~~~~~~~~~~~
  • 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>( )
  • bridge/tests/test_bridge_audio_track.cpp:20:10: error: [clang-diagnostic-error]

    'gtest/gtest.h' file not found

       20 | #include <gtest/gtest.h>
          |          ^~~~~~~~~~~~~~~
  • bridge/tests/test_bridge_audio_track.cpp:27:1: warning: [modernize-concat-nested-namespaces]

    nested namespaces can be concatenated

       27 | namespace livekit_bridge {
          | ^~~~~~~~~~~~~~~~~~~~~~~~~~
       28 | namespace test {
          | ~~~~~~~~~~~~~~
          | namespace livekit_bridge::test
  • 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
  • src/data_stream.cpp:91:36: warning: [modernize-pass-by-value]

    pass by value and use std::move

        7 | TextStreamReader::TextStreamReader(const TextStreamInfo &info) : info_(info) {}
          |                                    ^~~~~~~~~~~~~~~~~~~~~~                  
          |                                    TextStreamInfo                      std::move( )
  • src/data_stream.cpp:135:36: warning: [modernize-pass-by-value]

    pass by value and use std::move

      135 | ByteStreamReader::ByteStreamReader(const ByteStreamInfo &info) : info_(info) {}
          |                                    ^~~~~~~~~~~~~~~~~~~~~~                  
          |                                    ByteStreamInfo                      std::move( )
  • src/data_stream.cpp:176:42: warning: [modernize-pass-by-value]

    pass by value and use std::move

      176 |     LocalParticipant &local_participant, const std::string &topic,
          |                                          ^~~~~~~~~~~~~~~~~~~
          |                                          std::string 
      177 |     const std::map<std::string, std::string> &attributes,
      178 |     const std::string &stream_id, std::optional<std::size_t> total_size,
      179 |     const std::string &mime_type,
      180 |     const std::vector<std::string> &destination_identities,
      181 |     const std::string &sender_identity)
      182 |     : local_participant_(local_participant),
      183 |       stream_id_(stream_id.empty() ? generateRandomId() : stream_id),
      184 |       mime_type_(mime_type), topic_(topic),
          |                                          
          |                                     std::move( )
  • src/data_stream.cpp:179:5: warning: [modernize-pass-by-value]

    pass by value and use std::move

      179 |     const std::string &mime_type,
          |     ^~~~~~~~~~~~~~~~~~~
          |     std::string 
      180 |     const std::vector<std::string> &destination_identities,
      181 |     const std::string &sender_identity)
      182 |     : local_participant_(local_participant),
      183 |       stream_id_(stream_id.empty() ? generateRandomId() : stream_id),
      184 |       mime_type_(mime_type), topic_(topic),
          |                           
          |                  std::move( )
  • src/data_stream.cpp:181:5: warning: [modernize-pass-by-value]

    pass by value and use std::move

      181 |     const std::string &sender_identity)
          |     ^~~~~~~~~~~~~~~~~~~
          |     std::string 
      182 |     : local_participant_(local_participant),
      183 |       stream_id_(stream_id.empty() ? generateRandomId() : stream_id),
      184 |       mime_type_(mime_type), topic_(topic),
      185 |       timestamp_ms_(std::chrono::duration_cast<std::chrono::milliseconds>(
      186 |                         std::chrono::system_clock::now().time_since_epoch())
      187 |                         .count()),
      188 |       total_size_(total_size), attributes_(attributes),
      189 |       destination_identities_(destination_identities),
      190 |       sender_identity_(sender_identity) {
          |                                       
          |                        std::move(     )
  • 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 {
          |              ^
  • 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/video_stream.cpp:105:42: error: [bugprone-narrowing-conversions]

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

      105 |     FfiClient::instance().RemoveListener(listener_id_);
          |                                          ^
  • 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            &
  • examples/bridge_human_robot/robot.cpp:527:34: warning: [bugprone-implicit-widening-of-multiplication-result]

    performing an implicit widening conversion to type 'const std::size_t' (aka 'const unsigned long') of a multiplication performed in type 'int'

      527 |     const std::size_t buf_size = kSimWidth * kSimHeight * 4;
          |                                  ^
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/examples/bridge_human_robot/robot.cpp:527:34: note: make conversion explicit to silence this warning
       48 |     const std::size_t buf_size = kSimWidth * kSimHeight * 4;
          |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~
          |                                  static_cast<const std::size_t>( )
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/examples/bridge_human_robot/robot.cpp:527:34: note: perform multiplication in a wider type
      527 |     const std::size_t buf_size = kSimWidth * kSimHeight * 4;
          |                                  ^~~~~~~~~~~~~~~~~~~~~~
          |                                  static_cast<long>(    )
  • src/room_proto_converter.cpp:59:3: warning: [bugprone-branch-clone]

    switch has 2 consecutive identical branches

       59 |   case proto::KIND_RELIABLE:
          |   ^
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/room_proto_converter.cpp:62:36: note: last of these clones ends here
       62 |     return DataPacketKind::Reliable;
          |                                    ^
  • src/room_proto_converter.cpp:77:14: warning: [performance-no-int-to-ptr]

    integer to pointer cast pessimizes optimization opportunities

       77 |   auto ptr = reinterpret_cast<const std::uint8_t *>(buf.data_ptr());
          |              ^
  • src/room_proto_converter.cpp:389:16: warning: [performance-no-int-to-ptr]

    integer to pointer cast pessimizes optimization opportunities

      389 |     auto ptr = reinterpret_cast<const std::uint8_t *>(info.data_ptr());
          |                ^
  • src/room_proto_converter.cpp:403:13: error: [bugprone-narrowing-conversions]

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

      403 |   ev.code = in.sip_dtmf().code();
          |             ^
  • 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_);
          |                                          ^
  • examples/simple_rpc/main.cpp:381:27: warning: [modernize-raw-string-literal]

    escaped string literal can be written as a raw string literal

      381 |     std::string payload = "{\"dividend\":10,\"divisor\":0}";
          |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          |                           R"({"dividend":10,"divisor":0})"
  • examples/common/sdl_media.h:19:10: error: [clang-diagnostic-error]

    'SDL3/SDL.h' file not found

       19 | #include <SDL3/SDL.h>
          |          ^~~~~~~~~~~~
  • 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 };
          |              ^
  • src/stats.cpp:52:3: warning: [bugprone-branch-clone]

    switch has 2 consecutive identical branches

       52 |   case P::LIMITATION_OTHER:
          |   ^
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/stats.cpp:55:42: note: last of these clones ends here
       55 |     return QualityLimitationReason::Other;
          |                                          ^
  • examples/bridge_mute_unmute/caller.cpp:298: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'

      298 |             std::memcpy(static_cast<std::uint8_t *>(pixels) + y * pitch,
          |                         ^
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/examples/bridge_mute_unmute/caller.cpp:298:63: note: make conversion explicit to silence this warning
       46 |             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_mute_unmute/caller.cpp:298:63: note: perform multiplication in a wider type
      298 |             std::memcpy(static_cast<std::uint8_t *>(pixels) + y * pitch,
          |                                                               ^        
          |                                                               static_cast<ptrdiff_t>( )
  • examples/ping_pong/utils.h:38:10: warning: [modernize-return-braced-init-list]

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

       38 |   return std::vector<std::uint8_t>(json.begin(), json.end());
          |          ^
  • examples/ping_pong/utils.h:42:10: warning: [modernize-return-braced-init-list]

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

       42 |   return std::string(payload.begin(), payload.end());
          |          ^
  • include/livekit/room_event_types.h:43:12: warning: [performance-enum-size]

    enum 'ConnectionQuality' 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

       43 | enum class ConnectionQuality {
          |            ^
  • include/livekit/room_event_types.h:53:12: warning: [performance-enum-size]

    enum 'ConnectionState' 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

       53 | enum class ConnectionState {
          |            ^
  • include/livekit/room_event_types.h:65:12: warning: [performance-enum-size]

    enum 'DataPacketKind' 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

       65 | enum class DataPacketKind {
          |            ^
  • include/livekit/room_event_types.h:75:12: warning: [performance-enum-size]

    enum 'EncryptionState' 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

       75 | enum class EncryptionState {
          |            ^
  • include/livekit/room_event_types.h:90:12: warning: [performance-enum-size]

    enum 'DisconnectReason' 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

       90 | enum class DisconnectReason {
          |            ^
  • include/livekit/room_event_types.h:222:14: warning: [performance-enum-size]

    enum 'ContentType' 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

      222 |   enum class ContentType {
          |              ^
  • include/livekit/room_event_types.h:231:14: warning: [performance-enum-size]

    enum 'OperationType' 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

      231 |   enum class OperationType {
          |              ^
  • src/ffi_client.cpp:654:36: warning: [performance-unnecessary-copy-initialization]

    the variable 'track' is copy-constructed from a const reference but is never used; consider removing the statement

      654 |         proto::OwnedLocalDataTrack track = cb.track();
          |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
      655 |         pr.set_value(
  • src/ffi_client.cpp:683:7: warning: [bugprone-empty-catch]

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

      683 |     } catch (const std::exception &e) {
          |       ^
  • src/ffi_client.cpp:726:7: warning: [bugprone-empty-catch]

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

      726 |     } catch (const std::exception &e) {
          |       ^
  • 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 {
          |            ^
  • 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             &
  • 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: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/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/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/src/rpc_constants.cpp:19:1: warning: [modernize-concat-nested-namespaces]

    nested namespaces can be concatenated

       19 | namespace livekit_bridge {
          | ^~~~~~~~~~~~~~~~~~~~~~~~~~
       20 | namespace rpc {
          | ~~~~~~~~~~~~~~~
       21 | namespace track_control {
          | ~~~~~~~~~~~~~~~~~~~~~~~
          | namespace livekit_bridge::rpc::track_control
  • src/tests/stress/test_latency_measurement.cpp:23:1: warning: [modernize-concat-nested-namespaces]

    nested namespaces can be concatenated

       23 | namespace livekit {
          | ^~~~~~~~~~~~~~~~~~~
       24 | namespace test {
          | ~~~~~~~~~~~~~~
          | namespace livekit::test
  • src/tests/stress/test_latency_measurement.cpp:63:5: warning: [modernize-use-auto]

    use auto when initializing with a cast to avoid duplicating the type name

       63 |     int16_t sample =
          |     ^~~~~~~
          |     auto
  • src/tests/stress/test_latency_measurement.cpp:447:31: error: [bugprone-narrowing-conversions]

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

      447 |           double latency_ms = (receive_time_us - send_time_us) / 1000.0;
          |                               ^
  • src/tests/stress/test_latency_measurement.cpp:669:26: error: [bugprone-narrowing-conversions]

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

      669 |       double a_to_b_ms = (detect_us - send_from_a_us) / 1000.0;
          |                          ^
  • src/tests/stress/test_latency_measurement.cpp:735:26: error: [bugprone-narrowing-conversions]

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

      735 |       double b_to_a_ms = (receive_us - send_from_b_us) / 1000.0;
          |                          ^
  • src/tests/stress/test_latency_measurement.cpp:743:25: error: [bugprone-narrowing-conversions]

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

      743 |         double rtt_ms = (receive_us - send_from_a_us) / 1000.0;
          |                         ^
  • src/tests/stress/test_latency_measurement.cpp:786:40: warning: [bugprone-branch-clone]

    repeated branch body in conditional chain

      786 |       if (waiting_for_response.load()) {
          |                                        ^
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/tests/stress/test_latency_measurement.cpp:789:8: note: end of the original
      789 |       } else if (!waiting_for_response.load() && pulses_sent < kTotalPulses) {
          |        ^
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/tests/stress/test_latency_measurement.cpp:814:14: note: clone 1 starts here
      814 |       } else {
          |              ^
  • src/tests/common/audio_utils.h:27:1: warning: [modernize-concat-nested-namespaces]

    nested namespaces can be concatenated

       27 | namespace livekit {
          | ^~~~~~~~~~~~~~~~~~~
       28 | namespace test {
          | ~~~~~~~~~~~~~~
          | namespace livekit::test
  • src/tests/common/audio_utils.h:110:3: warning: [modernize-loop-convert]

    use range-based for loop instead

      110 |   for (std::size_t i = 0; i < samples.size(); ++i) {
          |   ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          |       (short & sample : samples)
      111 |     samples[i] = static_cast<std::int16_t>(std::sin(phase) * amplitude);
          |     ~~~~~~~~~~
          |     sample
  • src/track.cpp:34:61: warning: [performance-unnecessary-value-param]

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

       34 |                                  std::optional<std::string> mime_type) {
          |                                                             ^
          |                                  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>
          |          ^~~~~~~~~~~~~~~
  • bridge/tests/test_rpc_controller.cpp:20:10: error: [clang-diagnostic-error]

    'gtest/gtest.h' file not found

       20 | #include <gtest/gtest.h>
          |          ^~~~~~~~~~~~~~~
  • include/livekit/data_track_error.h:31:12: warning: [performance-enum-size]

    enum 'PublishDataTrackErrorCode' uses a larger base type ('std::uint32_t' (aka 'unsigned 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

       31 | enum class PublishDataTrackErrorCode : std::uint32_t {
          |            ^
  • include/livekit/data_track_error.h:52:12: warning: [performance-enum-size]

    enum 'LocalDataTrackTryPushErrorCode' uses a larger base type ('std::uint32_t' (aka 'unsigned 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

       52 | enum class LocalDataTrackTryPushErrorCode : std::uint32_t {
          |            ^
  • include/livekit/data_track_error.h:68:12: warning: [performance-enum-size]

    enum 'SubscribeDataTrackErrorCode' uses a larger base type ('std::uint32_t' (aka 'unsigned 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

       68 | enum class SubscribeDataTrackErrorCode : std::uint32_t {
          |            ^
  • src/ffi_client.h:191:9: warning: [bugprone-empty-catch]

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

      191 |       } catch (const std::future_error &) {
          |         ^
  • 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_audio_frame.cpp:17:10: error: [clang-diagnostic-error]

    'gtest/gtest.h' file not found

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

    nested namespaces can be concatenated

       21 | namespace livekit {
          | ^~~~~~~~~~~~~~~~~~~
       22 | namespace test {
          | ~~~~~~~~~~~~~~
          | namespace livekit::test
  • 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: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      &
  • src/video_utils.cpp:149:21: warning: [performance-no-int-to-ptr]

    integer to pointer cast pessimizes optimization opportunities

      149 |   const auto *src = reinterpret_cast<const std::uint8_t *>(src_ptr);
          |                     ^
  • 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            &
  • 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: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
  • src/tests/integration/test_media_multistream.cpp:29:1: warning: [modernize-concat-nested-namespaces]

    nested namespaces can be concatenated

       29 | namespace livekit {
          | ^~~~~~~~~~~~~~~~~~~
       30 | namespace test {
          | ~~~~~~~~~~~~~~
          | namespace livekit::test
  • src/tests/integration/test_media_multistream.cpp:111:21: warning: [bugprone-unused-local-non-trivial-variable]

    unused local variable 'receiver_identity' of type 'const std::string' (aka 'const basic_string')

      111 |   const std::string receiver_identity =
          |                     ^
  • src/tests/integration/test_media_multistream.cpp:224:13: warning: [bugprone-misplaced-widening-cast]

    either cast from 'int' to 'std::size_t' (aka 'unsigned long') is ineffective, or there is loss of precision before the conversion

      224 |             static_cast<std::size_t>(kVideoTrackCount + kAudioTrackCount));
          |             ^
  • src/tests/integration/test_media_multistream.cpp:241:39: warning: [performance-unnecessary-value-param]

    the parameter Using this CPP SDK Wrapper #1 is copied for each invocation but only used as a const reference; consider making it a const reference

      241 | TEST_F(MediaMultiStreamIntegrationTest,
          |                                       ^
          |        const                          &
  • src/tests/integration/test_media_multistream.cpp:246:39: warning: [performance-unnecessary-value-param]

    the parameter Using this CPP SDK Wrapper #1 is copied for each invocation but only used as a const reference; consider making it a const reference

      246 | TEST_F(MediaMultiStreamIntegrationTest,
          |                                       ^
          |        const                          &
  • src/tests/stress/test_audio_frame_stress.cpp:19:10: error: [clang-diagnostic-error]

    'gtest/gtest.h' file not found

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

    nested namespaces can be concatenated

       25 | namespace livekit {
          | ^~~~~~~~~~~~~~~~~~~
       26 | namespace test {
          | ~~~~~~~~~~~~~~
          | namespace livekit::test
  • 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);
          |                                          ^
  • src/video_frame.cpp:32:3: warning: [bugprone-branch-clone]

    switch has 2 consecutive identical branches

       32 |   case VideoBufferType::RGB24:
          |   ^
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/video_frame.cpp:38:21: note: last of these clones ends here
       38 |     return w * h * 3;
          |                     ^
  • src/video_frame.cpp:46:40: warning: [bugprone-branch-clone]

    repeated branch body in conditional chain

       46 |     if (type == VideoBufferType::I420) {
          |                                        ^
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/video_frame.cpp:49:6: note: end of the original
       49 |     } else if (type == VideoBufferType::NV12) {
          |      ^
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/video_frame.cpp:49:47: note: clone 1 starts here
       49 |     } else if (type == VideoBufferType::NV12) {
          |                                               ^
  • src/video_frame.cpp:291:3: warning: [modernize-use-auto]

    use auto when initializing with a cast to avoid duplicating the type name

      291 |   uintptr_t base = reinterpret_cast<uintptr_t>(data_.data());
          |   ^~~~~~~~~
          |   auto
  • src/video_frame.cpp:338:26: warning: [performance-no-int-to-ptr]

    integer to pointer cast pessimizes optimization opportunities

      338 |     const auto src_ptr = reinterpret_cast<const std::uint8_t *>(
          |                          ^
  • 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);
          |                          ^~~~~~~~~~           ~
  • include/livekit/local_audio_track.h:90: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

       90 |     local_publication_ = std::move(publication);
          |                          ^~~~~~~~~~           ~
  • 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;
          |                                       ^
  • src/audio_frame.cpp:72:9: warning: [modernize-use-auto]

    use auto when initializing with a cast to avoid duplicating the type name

       72 |   const std::int16_t *ptr =
          |         ^~~~~~~~~~~~
          |         auto
  • src/audio_frame.cpp:73:7: warning: [performance-no-int-to-ptr]

    integer to pointer cast pessimizes optimization opportunities

       73 |       reinterpret_cast<const std::int16_t *>(info.data_ptr());
          |       ^
  • src/tests/stress/test_rpc_stress.cpp:22:1: warning: [modernize-concat-nested-namespaces]

    nested namespaces can be concatenated

       22 | namespace livekit {
          | ^~~~~~~~~~~~~~~~~~~
       23 | namespace test {
          | ~~~~~~~~~~~~~~
          | namespace livekit::test
  • src/tests/stress/test_rpc_stress.cpp:26:39: warning: [bugprone-implicit-widening-of-multiplication-result]

    performing an implicit widening conversion to type 'const size_t' (aka 'const unsigned long') of a multiplication performed in type 'int'

       26 | constexpr size_t kMaxRpcPayloadSize = 15 * 1024;
          |                                       ^
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/tests/stress/test_rpc_stress.cpp:26:39: note: make conversion explicit to silence this warning
       18 | #include <fstream>
       19 | #include <random>
       20 | #include <sstream>
       21 | 
       22 | namespace livekit {
       23 | namespace test {
       24 | 
       25 | // Maximum RPC payload size (15KB)
       26 | constexpr size_t kMaxRpcPayloadSize = 15 * 1024;
          |                                       ^~~~~~~~~
          |                                       static_cast<const size_t>( )
    /home/runner/work/client-sdk-cpp/client-sdk-cpp/src/tests/stress/test_rpc_stress.cpp:26:39: note: perform multiplication in a wider type
       26 | constexpr size_t kMaxRpcPayloadSize = 15 * 1024;
          |                                       ^~
          |                                       static_cast<long>( )
  • src/tests/stress/test_rpc_stress.cpp:119:40: error: [bugprone-narrowing-conversions]

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

      119 |   static thread_local std::mt19937 gen(rd());
          |                                        ^
  • examples/common/sdl_media_manager.h:23:10: error: [clang-diagnostic-error]

    'SDL3/SDL.h' file not found

       23 | #include <SDL3/SDL.h>
          |          ^~~~~~~~~~~~
  • examples/simple_data_stream/main.cpp:41:5: warning: [modernize-use-auto]

    use auto when initializing with a cast to avoid duplicating the type name

       41 |     std::uint8_t b = static_cast<std::uint8_t>(rng() & 0xFF);
          |     ^~~~~~~~~~~~
          |     auto
  • examples/simple_data_stream/main.cpp:151:9: warning: [bugprone-empty-catch]

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

      151 |       } catch (...) {
          |         ^
  • 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) {
          |     ^
  • src/tests/integration/test_room.cpp:17:10: error: [clang-diagnostic-error]

    'gtest/gtest.h' file not found

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

    nested namespaces can be concatenated

       20 | namespace livekit {
          | ^~~~~~~~~~~~~~~~~~~
       21 | namespace test {
          | ~~~~~~~~~~~~~~
          | namespace livekit::test
  • include/livekit/stats.h:52:12: warning: [performance-enum-size]

    enum 'DataChannelState' 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

       52 | enum class DataChannelState {
          |            ^
  • include/livekit/stats.h:60:12: warning: [performance-enum-size]

    enum 'QualityLimitationReason' 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

       60 | enum class QualityLimitationReason {
          |            ^
  • include/livekit/stats.h:67:12: warning: [performance-enum-size]

    enum 'IceRole' 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

       67 | enum class IceRole {
          |            ^
  • include/livekit/stats.h:73:12: warning: [performance-enum-size]

    enum 'DtlsTransportState' 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

       73 | enum class DtlsTransportState {
          |            ^
  • include/livekit/stats.h:82:12: warning: [performance-enum-size]

    enum 'IceTransportState' 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

       82 | enum class IceTransportState {
          |            ^
  • include/livekit/stats.h:93:12: warning: [performance-enum-size]

    enum 'DtlsRole' 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

       93 | enum class DtlsRole {
          |            ^
  • include/livekit/stats.h:99:12: warning: [performance-enum-size]

    enum 'IceCandidatePairState' 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

       99 | enum class IceCandidatePairState {
          |            ^
  • include/livekit/stats.h:108:12: warning: [performance-enum-size]

    enum 'IceCandidateType' 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

      108 | enum class IceCandidateType {
          |            ^
  • include/livekit/stats.h:116:12: warning: [performance-enum-size]

    enum 'IceServerTransportProtocol' 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

      116 | enum class IceServerTransportProtocol {
          |            ^
  • include/livekit/stats.h:123:12: warning: [performance-enum-size]

    enum 'IceTcpCandidateType' 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

      123 | enum class IceTcpCandidateType {
          |            ^
  • 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: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);
          |                                                           ^

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?

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

Only 1 out of 170 clang-tidy concerns fit within this pull request's diff.

Click here for the full clang-tidy patch
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/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/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/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/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/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_br0����+} // namespace livekit_bridge::rpc::track_control
+
+
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/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/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_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/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/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/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/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_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/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/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/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/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/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/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/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/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/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_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/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})";
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/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/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/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/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/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/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/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_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/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/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/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/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/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/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/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/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/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/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/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_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/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/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/ffi_client.cpp b/src/ffi_client.cpp
index 82f4d1c..026aeef 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/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/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/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/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/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/data_stream.h b/include/livekit/data_stream.h
index 11d906c..3e17af5 100644
--- a/include/livekit/data_stream.h
+++ b/include/livekit/data_stream.h
@@ -95 +95 @@ public:
-  const TextStreamInfo &info() const noexcept { return info_; }
+  [[nodiscard]] const TextStreamInfo &info() const noexcept { return 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;

Have any feedback or feature suggestions? Share it here.

track_(std::move(track)), publication_(std::move(publication)),
participant_(participant) {}
participant_(participant) {
std::cout << "Bad name use: " << name << "\n"; // Should invoke clang-tidy warning
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

clang-tidy diagnostic

bridge/src/bridge_audio_track.cpp:42:42: error: [bugprone-use-after-move]

'name' used after it was moved

   42 |         std::cout << "Bad name use: " << name << "\n"; // Should invoke clang-tidy warning
      |                                          ^
/home/runner/work/client-sdk-cpp/client-sdk-cpp/bridge/src/bridge_audio_track.cpp:38:7: note: move occurred here
   38 |     : name_(std::move(name)), sample_rate_(sample_rate),
      |       ^

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

Only 1 out of 159 clang-tidy concerns fit within this pull request's diff.

Click here for the full clang-tidy patch
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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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})";
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/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/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/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/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_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/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/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/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/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/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..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/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/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/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/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/track.h b/include/livekit/track.h
index 35b1abf..d9e5916 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;
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/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/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/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/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/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/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_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/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/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/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/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/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.cpp b/src/ffi_client.cpp
index 82f4d1c..026aeef 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/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_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/data_stream.h b/include/livekit/data_stream.h
index 11d906c..3e17af5 100644
--- a/include/livekit/data_stream.h
+++ b/include/livekit/data_stream.h
@@ -95 +95 @@ public:
-  const TextStreamInfo &info() const noexcept { return info_; }
+  [[nodiscard]] const TextStreamInfo &info() const noexcept { return 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_; }

Have any feedback or feature suggestions? Share it here.

track_(std::move(track)), publication_(std::move(publication)),
participant_(participant) {}
participant_(participant) {
std::cout << "Bad name use: " << name << "\n"; // Should invoke clang-tidy warning
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

clang-tidy diagnostic

bridge/src/bridge_audio_track.cpp:42:42: error: [bugprone-use-after-move]

'name' used after it was moved

   42 |         std::cout << "Bad name use: " << name << "\n"; // Should invoke clang-tidy warning
      |                                          ^
/home/runner/work/client-sdk-cpp/client-sdk-cpp/bridge/src/bridge_audio_track.cpp:38:7: note: move occurred here
   38 |     : name_(std::move(name)), sample_rate_(sample_rate),
      |       ^

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

Only 1 out of 89 clang-tidy concerns fit within this pull request's diff.

Click here for the full clang-tidy patch
diff --git a/include/livekit/track.h b/include/livekit/track.h
index 35b1abf..7630f6e 100644
--- a/include/livekit/track.h
+++ b/include/livekit/track.h
@@ -119 +119 @@ protected:
-                            const std::optional<std::string>& mime_type);
+                            std::optional<std::string> mime_type);
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/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/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/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/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/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_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})";
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/src/ffi_client.cpp b/src/ffi_client.cpp
index 82f4d1c..026aeef 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/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/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/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/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/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/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/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/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/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_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/include/livekit/participant.h b/include/livekit/participant.h
index 5987963..960ef5f 100644
--- a/include/livekit/participant.h
+++ b/include/livekit/participant.h
@@ -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 {
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/include/livekit/result.h b/include/livekit/result.h
index bc7f133..f12a589 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 &&>>>
@@ -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 &&>>>
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/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/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/include/livekit/local_video_track.h b/include/livekit/local_video_track.h
index a431740..a351aac 100644
--- a/include/livekit/local_video_track.h
+++ b/include/livekit/local_video_track.h
@@ -91 +91 @@ public:
-    local_publication_ = std::move(publication);
+    local_publication_ = publication;
diff --git a/include/livekit/local_audio_track.h b/include/livekit/local_audio_track.h
index 9c46819..ca3e9c7 100644
--- a/include/livekit/local_audio_track.h
+++ b/include/livekit/local_audio_track.h
@@ -90 +90 @@ public:
-    local_publication_ = std::move(publication);
+    local_publication_ = publication;
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/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/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_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_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/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/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/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/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
+

Have any feedback or feature suggestions? Share it here.

track_(std::move(track)), publication_(std::move(publication)),
participant_(participant) {}
participant_(participant) {
std::cout << "Bad name use: " << name << "\n"; // Should invoke clang-tidy warning
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

clang-tidy diagnostic

bridge/src/bridge_audio_track.cpp:42:42: error: [bugprone-use-after-move]

'name' used after it was moved

   42 |         std::cout << "Bad name use: " << name << "\n"; // Should invoke clang-tidy warning
      |                                          ^
/home/runner/work/client-sdk-cpp/client-sdk-cpp/bridge/src/bridge_audio_track.cpp:38:7: note: move occurred here
   38 |     : name_(std::move(name)), sample_rate_(sample_rate),
      |       ^

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