Skip to content

Commit 16527ed

Browse files
use raw pointers for consistency
1 parent e40a189 commit 16527ed

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

‎include/livekit/room.h‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,11 @@ class LIVEKIT_API Room {
178178
RemoteParticipant* remoteParticipant(const std::string& identity) const;
179179

180180
/// Returns a snapshot of all current remote participants.
181-
std::vector<std::shared_ptr<RemoteParticipant>> remoteParticipants() const;
181+
///
182+
/// @return Vector of non-null pointers to the current remote participants.
183+
/// The pointers are owned by the Room and remain valid until the
184+
/// corresponding participant disconnects.
185+
std::vector<RemoteParticipant*> remoteParticipants() const;
182186

183187
/// Returns the current connection state of the room.
184188
ConnectionState connectionState() const;

‎src/room.cpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,12 +310,12 @@ RemoteParticipant* Room::remoteParticipant(const std::string& identity) const {
310310
return it == remote_participants_.end() ? nullptr : it->second.get();
311311
}
312312

313-
std::vector<std::shared_ptr<RemoteParticipant>> Room::remoteParticipants() const {
313+
std::vector<RemoteParticipant*> Room::remoteParticipants() const {
314314
const std::scoped_lock<std::mutex> guard(lock_);
315-
std::vector<std::shared_ptr<RemoteParticipant>> out;
315+
std::vector<RemoteParticipant*> out;
316316
out.reserve(remote_participants_.size());
317317
for (const auto& kv : remote_participants_) {
318-
out.push_back(kv.second);
318+
out.push_back(kv.second.get());
319319
}
320320
return out;
321321
}

0 commit comments

Comments
 (0)