-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathremote_participant.cpp
More file actions
59 lines (50 loc) · 1.87 KB
/
remote_participant.cpp
File metadata and controls
59 lines (50 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
* Copyright 2025 LiveKit
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an “AS IS” BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "livekit/remote_participant.h"
#include <ostream>
#include <sstream>
#include <utility>
#include "livekit/remote_track_publication.h"
namespace livekit {
RemoteParticipant::RemoteParticipant(
FfiHandle handle, std::string sid, std::string name, std::string identity,
std::string metadata,
std::unordered_map<std::string, std::string> attributes,
ParticipantKind kind, DisconnectReason reason)
: Participant(std::move(handle), std::move(sid), std::move(name),
std::move(identity), std::move(metadata),
std::move(attributes), kind, reason),
track_publications_() {}
std::string RemoteParticipant::to_string() const {
std::ostringstream oss;
oss << "rtc.RemoteParticipant(sid=" << sid() << ", identity=" << identity()
<< ", name=" << name() << ")";
return oss.str();
}
std::ostream &operator<<(std::ostream &os,
const RemoteParticipant &participant) {
os << participant.to_string();
return os;
}
std::shared_ptr<TrackPublication>
RemoteParticipant::findTrackPublication(const std::string &sid) const {
auto it = track_publications_.find(sid);
if (it == track_publications_.end()) {
return nullptr;
}
return std::static_pointer_cast<TrackPublication>(it->second);
}
} // namespace livekit