Skip to content

Commit 4983274

Browse files
use raw pointers for consistency
1 parent c476757 commit 4983274

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
@@ -162,7 +162,11 @@ class LIVEKIT_API Room {
162162
RemoteParticipant* remoteParticipant(const std::string& identity) const;
163163

164164
/// Returns a snapshot of all current remote participants.
165-
std::vector<std::shared_ptr<RemoteParticipant>> remoteParticipants() const;
165+
///
166+
/// @return Vector of non-null pointers to the current remote participants.
167+
/// The pointers are owned by the Room and remain valid until the
168+
/// corresponding participant disconnects.
169+
std::vector<RemoteParticipant*> remoteParticipants() const;
166170

167171
/// Returns the current connection state of the room.
168172
ConnectionState connectionState() const;

‎src/room.cpp‎

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

249-
std::vector<std::shared_ptr<RemoteParticipant>> Room::remoteParticipants() const {
249+
std::vector<RemoteParticipant*> Room::remoteParticipants() const {
250250
const std::scoped_lock<std::mutex> guard(lock_);
251-
std::vector<std::shared_ptr<RemoteParticipant>> out;
251+
std::vector<RemoteParticipant*> out;
252252
out.reserve(remote_participants_.size());
253253
for (const auto& kv : remote_participants_) {
254-
out.push_back(kv.second);
254+
out.push_back(kv.second.get());
255255
}
256256
return out;
257257
}

0 commit comments

Comments
 (0)