提交 0de6be31 authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo 提交者: José Luis Millán

Peer.cpp: add GetRtpSender(ssrc)

上级 094cdb33
......@@ -51,6 +51,7 @@ namespace RTC
* @param peerName Name of the receiver Peer.
*/
void AddRtpSender(RTC::RtpSender* rtpSender, std::string& peerName, RTC::RtpParameters* rtpParameters);
RTC::RtpSender* GetRtpSender(uint32_t ssrc);
// TODO: Temporal stuff to route RTCP everywhere
std::unordered_map<uint32_t, RTC::Transport*>& GetTransports();
......
......@@ -469,6 +469,34 @@ namespace RTC
this->notifier->Emit(this->peerId, "newrtpsender", event_data);
}
RTC::RtpSender* Peer::GetRtpSender(uint32_t ssrc)
{
MS_TRACE();
for (auto it = this->rtpSenders.begin(); it != this->rtpSenders.end(); ++it)
{
auto rtpSender = it->second;
auto rtpParameters = rtpSender->GetParameters();
if (!rtpParameters)
continue;
for (auto it2 = rtpParameters->encodings.begin(); it2 != rtpParameters->encodings.end(); ++it2)
{
auto& encoding = *it2;
if (encoding.ssrc == ssrc)
return rtpSender;
else if (encoding.hasFec && encoding.fec.ssrc == ssrc)
return rtpSender;
else if (encoding.hasRtx && encoding.rtx.ssrc == ssrc)
return rtpSender;
}
}
return nullptr;
}
RTC::Transport* Peer::GetTransportFromRequest(Channel::Request* request, uint32_t* transportId)
{
MS_TRACE();
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论