Skip to content

Commit 4bdc8ec

Browse files
compiling
1 parent 74e4b99 commit 4bdc8ec

5 files changed

Lines changed: 48 additions & 45 deletions

File tree

bridge/src/bridge_data_track.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
#include "livekit_bridge/bridge_data_track.h"
1818

19+
#include "lk_log.h"
20+
1921
#include "livekit/data_frame.h"
2022
#include "livekit/local_data_track.h"
2123
#include "livekit/local_participant.h"
@@ -44,7 +46,7 @@ bool BridgeDataTrack::pushFrame(const std::vector<std::uint8_t> &payload,
4446
try {
4547
return track_->tryPush(frame);
4648
} catch (const std::exception &e) {
47-
LK_LOG_ERROR("[BridgeDataTrack] tryPush error: " << e.what());
49+
LK_LOG_ERROR("[BridgeDataTrack] tryPush error: {}", e.what());
4850
return false;
4951
}
5052
}
@@ -63,7 +65,7 @@ bool BridgeDataTrack::pushFrame(const std::uint8_t *data, std::size_t size,
6365
try {
6466
return track_->tryPush(frame);
6567
} catch (const std::exception &e) {
66-
LK_LOG_ERROR("[BridgeDataTrack] tryPush error: " << e.what());
68+
LK_LOG_ERROR("[BridgeDataTrack] tryPush error: {}", e.what());
6769
return false;
6870
}
6971
}

bridge/src/bridge_room_delegate.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919

2020
#include "bridge_room_delegate.h"
2121

22+
#include "lk_log.h"
23+
2224
#include "livekit/remote_data_track.h"
2325
#include "livekit/remote_participant.h"
2426
#include "livekit/remote_track_publication.h"
2527
#include "livekit/track.h"
2628
#include "livekit_bridge/livekit_bridge.h"
2729

28-
#include <iostream>
29-
3030
namespace livekit_bridge {
3131

3232
void BridgeRoomDelegate::onTrackSubscribed(
@@ -62,9 +62,9 @@ void BridgeRoomDelegate::onRemoteDataTrackPublished(
6262
return;
6363
}
6464

65-
LK_LOG_INFO("[BridgeRoomDelegate] onRemoteDataTrackPublished: \""
66-
<< ev.track->info().name << "\" from \""
67-
<< ev.track->publisherIdentity() << "\"");
65+
LK_LOG_INFO("[BridgeRoomDelegate] onRemoteDataTrackPublished: \"{}\" from "
66+
"\"{}\"",
67+
ev.track->info().name, ev.track->publisherIdentity());
6868
bridge_.onRemoteDataTrackPublished(ev.track);
6969
}
7070

bridge/src/livekit_bridge.cpp

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -307,11 +307,10 @@ LiveKitBridge::createDataTrack(const std::string &name) {
307307
"LiveKitBridge::createDataTrack: not connected to a room");
308308
}
309309

310-
LK_LOG_INFO("[LiveKitBridge] Publishing data track \"" << name << "\"...");
310+
LK_LOG_INFO("[LiveKitBridge] Publishing data track \"{}\"...", name);
311311
auto track = room_->localParticipant()->publishDataTrack(name);
312-
LK_LOG_INFO("[LiveKitBridge] Data track \"" << name << "\" published "
313-
<< "(sid=" << track->info().sid
314-
<< ").");
312+
LK_LOG_INFO("[LiveKitBridge] Data track \"{}\" published (sid={}).", name,
313+
track->info().sid);
315314

316315
auto bridge_track = std::shared_ptr<BridgeDataTrack>(
317316
new BridgeDataTrack(name, std::move(track), room_->localParticipant()));
@@ -358,8 +357,9 @@ void LiveKitBridge::setOnDataFrameCallback(
358357
std::thread old_thread;
359358
{
360359
std::lock_guard<std::mutex> lock(mutex_);
361-
LK_LOG_INFO("[LiveKitBridge] Registered data callback for (\""
362-
<< participant_identity << "\", \"" << track_name << "\").");
360+
LK_LOG_INFO(
361+
"[LiveKitBridge] Registered data callback for (\"{}\", \"{}\").",
362+
participant_identity, track_name);
363363
DataCallbackKey key{participant_identity, track_name};
364364
data_callbacks_[key] = std::move(callback);
365365

@@ -446,9 +446,9 @@ void LiveKitBridge::onTrackSubscribed(
446446
old_thread = startVideoReader(key, track, it->second);
447447
}
448448
} else {
449-
LK_LOG_INFO("[LiveKitBridge] Track subscribed: \""
450-
<< track->name() << "\" from \"" << participant_identity
451-
<< "\" (sid=" << track->sid() << ")");
449+
LK_LOG_INFO(
450+
"[LiveKitBridge] Track subscribed: \"{}\" from \"{}\" (sid={})",
451+
track->name(), participant_identity, track->sid());
452452
}
453453
}
454454
// If this key already had a reader (e.g. track was re-subscribed), the old
@@ -475,10 +475,10 @@ void LiveKitBridge::onTrackUnsubscribed(const std::string &participant_identity,
475475

476476
void LiveKitBridge::onRemoteDataTrackPublished(
477477
std::shared_ptr<livekit::RemoteDataTrack> track) {
478-
LK_LOG_INFO("[LiveKitBridge] Remote data track published: \""
479-
<< track->info().name << "\" from \""
480-
<< track->publisherIdentity() << "\" (sid=" << track->info().sid
481-
<< ")");
478+
LK_LOG_INFO("[LiveKitBridge] Remote data track published: \"{}\" from \"{}\" "
479+
"(sid={})",
480+
track->info().name, track->publisherIdentity(),
481+
track->info().sid);
482482

483483
std::thread old_thread;
484484
std::string identity;
@@ -493,15 +493,14 @@ void LiveKitBridge::onRemoteDataTrackPublished(
493493

494494
auto it = data_callbacks_.find(key);
495495
if (it != data_callbacks_.end()) {
496-
LK_LOG_INFO("[LiveKitBridge] Found matching callback for ("
497-
<< key.identity << ", " << key.track_name
498-
<< "), starting data reader.");
496+
LK_LOG_INFO("[LiveKitBridge] Found matching callback for ({}, {}), "
497+
"starting data reader.",
498+
key.identity, key.track_name);
499499
old_thread = startDataReader(key, track, it->second);
500500
} else {
501-
LK_LOG_INFO(
502-
"[LiveKitBridge] No callback registered yet for ("
503-
<< key.identity << ", " << key.track_name
504-
<< "); storing as pending (will start when callback is set).");
501+
LK_LOG_INFO("[LiveKitBridge] No callback registered yet for ({}, {}); "
502+
"storing as pending (will start when callback is set).",
503+
key.identity, key.track_name);
505504
pending_remote_data_tracks_[key] = track;
506505
}
507506
}
@@ -625,21 +624,22 @@ std::thread LiveKitBridge::startDataReader(
625624
DataFrameCallback cb) {
626625
auto old_thread = extractDataReaderThread(key);
627626

628-
LK_LOG_INFO("[LiveKitBridge] Subscribing to data track \""
629-
<< key.track_name << "\" from \"" << key.identity << "\"...");
627+
LK_LOG_INFO("[LiveKitBridge] Subscribing to data track \"{}\" from \"{}\"...",
628+
key.track_name, key.identity);
630629

631630
std::shared_ptr<livekit::DataTrackSubscription> subscription;
632631
try {
633632
subscription = track->subscribe();
634633
} catch (const std::exception &e) {
635-
LK_LOG_ERROR("[LiveKitBridge] Failed to subscribe to data track \""
636-
<< key.track_name << "\" from \"" << key.identity
637-
<< "\": " << e.what());
634+
LK_LOG_ERROR("[LiveKitBridge] Failed to subscribe to data track \"{}\" "
635+
"from \"{}\": {}",
636+
key.track_name, key.identity, e.what());
638637
return old_thread;
639638
}
640639

641-
LK_LOG_INFO("[LiveKitBridge] Subscribed to data track \""
642-
<< key.track_name << "\"; starting reader thread.");
640+
LK_LOG_INFO("[LiveKitBridge] Subscribed to data track \"{}\"; starting "
641+
"reader thread.",
642+
key.track_name);
643643

644644
auto sub_copy = subscription;
645645
auto track_name = key.track_name;
@@ -649,19 +649,20 @@ std::thread LiveKitBridge::startDataReader(
649649
reader.remote_track = track;
650650
reader.subscription = std::move(subscription);
651651
reader.thread = std::thread([sub_copy, cb, track_name, identity]() {
652-
LK_LOG_INFO("[LiveKitBridge] Data reader thread running for \""
653-
<< track_name << "\" from \"" << identity << "\".");
652+
LK_LOG_INFO(
653+
"[LiveKitBridge] Data reader thread running for \"{}\" from \"{}\".",
654+
track_name, identity);
654655
livekit::DataFrame frame;
655656
while (sub_copy->read(frame)) {
656657
try {
657658
cb(frame.payload, frame.user_timestamp);
658659
} catch (const std::exception &e) {
659-
LK_LOG_ERROR("[LiveKitBridge] Data callback exception: " << e.what()
660-
<< ");
660+
LK_LOG_ERROR("[LiveKitBridge] Data callback exception: {}", e.what());
661661
}
662662
}
663-
LK_LOG_INFO("[LiveKitBridge] Data reader thread exiting for \""
664-
<< track_name << "\" from \"" << identity << "\".");
663+
LK_LOG_INFO(
664+
"[LiveKitBridge] Data reader thread exiting for \"{}\" from \"{}\".",
665+
track_name, identity);
665666
});
666667

667668
active_data_readers_[key] = std::move(reader);

src/ffi_client.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ FfiClient::connectAsync(const std::string &url, const std::string &token,
324324
auto *opts = connect->mutable_options();
325325
opts->set_auto_subscribe(options.auto_subscribe);
326326
opts->set_dynacast(options.dynacast);
327-
opts->set_single_peer_connection(options.single_peer_connection);
327+
// opts->set_single_peer_connection(options.single_peer_connection);
328328
LK_LOG_INFO("[FfiClient] connectAsync: auto_subscribe={}, dynacast={}, "
329329
"single_peer_connection={}",
330330
options.auto_subscribe, options.dynacast,

src/room.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -604,10 +604,10 @@ void Room::OnEvent(const FfiEvent &event) {
604604
const auto &rdtp = re.remote_data_track_published();
605605
auto remote_track =
606606
std::shared_ptr<RemoteDataTrack>(new RemoteDataTrack(rdtp.track()));
607-
LK_LOG_INFO("[Room] RoomEvent::kRemoteDataTrackPublished: \""
608-
<< remote_track->info().name << "\" from \""
609-
<< remote_track->publisherIdentity()
610-
<< "\" (sid=" << remote_track->info().sid << ")");
607+
LK_LOG_INFO("[Room] RoomEvent::kRemoteDataTrackPublished: \"{}\" from "
608+
"\"{}\" (sid={})",
609+
remote_track->info().name, remote_track->publisherIdentity(),
610+
remote_track->info().sid);
611611
RemoteDataTrackPublishedEvent ev;
612612
ev.track = remote_track;
613613
if (delegate_snapshot) {

0 commit comments

Comments
 (0)