Skip to content

Commit cb94b0d

Browse files
use raw pointers for consistency
1 parent f802b7b commit cb94b0d

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

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

165169
/// Returns the current connection state of the room.
166170
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)