Conversation
4fb7db7 to
e53271c
Compare
…ntain permissions' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
e53271c to
84d67e7
Compare
Cpp-Linter Report
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
stephen-derosa
left a comment
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
just a note to remove
| libssl-dev \ | ||
| libprotobuf-dev protobuf-compiler \ | ||
| libabsl-dev \ | ||
| libspdlog-dev \ |
There was a problem hiding this comment.
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?
No description provided.