Skip to content

Commit

Permalink
Remove PeerConnection::getMidFromSsrc()
Browse files Browse the repository at this point in the history
  • Loading branch information
SE2Dev committed Jul 15, 2022
1 parent 97e4d3b commit b8a0b43
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 54 deletions.
51 changes: 0 additions & 51 deletions src/impl/peerconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -546,57 +546,6 @@ void PeerConnection::forwardMedia(message_ptr message) {
}
}

optional<std::string> PeerConnection::getMidFromSsrc(uint32_t ssrc) {
if (auto it = mMidFromSsrc.find(ssrc); it != mMidFromSsrc.end())
return it->second;

{
std::lock_guard lock(mRemoteDescriptionMutex);
if (!mRemoteDescription)
return nullopt;

for (unsigned int i = 0; i < mRemoteDescription->mediaCount(); ++i) {
if (auto found =
std::visit(rtc::overloaded{[&](Description::Application *) -> optional<string> {
return std::nullopt;
},
[&](Description::Media *media) -> optional<string> {
return media->hasSSRC(ssrc)
? std::make_optional(media->mid())
: nullopt;
}},
mRemoteDescription->media(i))) {

mMidFromSsrc.emplace(ssrc, *found);
return *found;
}
}
}
{
std::lock_guard lock(mLocalDescriptionMutex);
if (!mLocalDescription)
return nullopt;
for (unsigned int i = 0; i < mLocalDescription->mediaCount(); ++i) {
if (auto found =
std::visit(rtc::overloaded{[&](Description::Application *) -> optional<string> {
return std::nullopt;
},
[&](Description::Media *media) -> optional<string> {
return media->hasSSRC(ssrc)
? std::make_optional(media->mid())
: nullopt;
}},
mLocalDescription->media(i))) {

mMidFromSsrc.emplace(ssrc, *found);
return *found;
}
}
}

return nullopt;
}

void PeerConnection::forwardBufferedAmount(uint16_t stream, size_t amount) {
if (auto channel = findDataChannel(stream))
channel->triggerBufferedAmount(amount);
Expand Down
3 changes: 0 additions & 3 deletions src/impl/peerconnection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ struct PeerConnection : std::enable_shared_from_this<PeerConnection> {
void forwardMessage(message_ptr message);
void forwardMedia(message_ptr message);
void forwardBufferedAmount(uint16_t stream, size_t amount);
optional<string> getMidFromSsrc(uint32_t ssrc);

shared_ptr<DataChannel> emplaceDataChannel(string label, DataChannelInit init);
shared_ptr<DataChannel> findDataChannel(uint16_t stream);
Expand Down Expand Up @@ -151,8 +150,6 @@ struct PeerConnection : std::enable_shared_from_this<PeerConnection> {

Queue<shared_ptr<DataChannel>> mPendingDataChannels;
Queue<shared_ptr<Track>> mPendingTracks;

std::unordered_map<uint32_t, string> mMidFromSsrc; // cache
};

} // namespace rtc::impl
Expand Down

0 comments on commit b8a0b43

Please sign in to comment.