提交 a1360000 authored 作者: José Luis Millán's avatar José Luis Millán

Producer: associate RtpStreamRecv with its corresponding profiles

上级 1e797687
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <map> #include <map>
#include <string> #include <string>
#include <unordered_set> #include <unordered_set>
#include <set>
#include <vector> #include <vector>
namespace RTC namespace RTC
...@@ -89,7 +90,7 @@ namespace RTC ...@@ -89,7 +90,7 @@ namespace RTC
void CreateRtpStream(RTC::RtpEncodingParameters& encoding); void CreateRtpStream(RTC::RtpEncodingParameters& encoding);
void ClearRtpStreams(); void ClearRtpStreams();
void ApplyRtpMapping(RTC::RtpPacket* packet) const; void ApplyRtpMapping(RTC::RtpPacket* packet) const;
RTC::RtpEncodingParameters::Profile GetRtpProfile(RTC::RtpPacket* packet); RTC::RtpEncodingParameters::Profile GetRtpProfile(RTC::RtpStreamRecv* rtpStream, RTC::RtpPacket* packet);
/* Pure virtual methods inherited from RTC::RtpStreamRecv::Listener. */ /* Pure virtual methods inherited from RTC::RtpStreamRecv::Listener. */
public: public:
...@@ -117,7 +118,7 @@ namespace RTC ...@@ -117,7 +118,7 @@ namespace RTC
// Allocated by this. // Allocated by this.
std::map<uint32_t, RTC::RtpStreamRecv*> rtpStreams; std::map<uint32_t, RTC::RtpStreamRecv*> rtpStreams;
std::map<uint32_t, RTC::RtpStreamRecv*> mapRtxStreams; std::map<uint32_t, RTC::RtpStreamRecv*> mapRtxStreams;
std::map<uint32_t, RTC::RtpEncodingParameters::Profile> rtpProfiles; std::map<RTC::RtpStreamRecv*, std::set<RTC::RtpEncodingParameters::Profile>> rtpProfiles;
Timer* fullFrameRequestBlockTimer{ nullptr }; Timer* fullFrameRequestBlockTimer{ nullptr };
// Others. // Others.
std::vector<RtpEncodingParameters> outputEncodings; std::vector<RtpEncodingParameters> outputEncodings;
......
...@@ -315,7 +315,7 @@ namespace RTC ...@@ -315,7 +315,7 @@ namespace RTC
try try
{ {
profile = GetRtpProfile(packet); profile = GetRtpProfile(rtpStream, packet);
} }
catch (const MediaSoupError& error) catch (const MediaSoupError& error)
{ {
...@@ -612,14 +612,16 @@ namespace RTC ...@@ -612,14 +612,16 @@ namespace RTC
} }
} }
RTC::RtpEncodingParameters::Profile Producer::GetRtpProfile(RTC::RtpPacket* packet) RTC::RtpEncodingParameters::Profile Producer::GetRtpProfile(RTC::RtpStreamRecv* rtpStream, RTC::RtpPacket* packet)
{ {
auto ssrc = packet->GetSsrc(); auto ssrc = packet->GetSsrc();
// The SSRC is already mapped to a profile. // The stream is already mapped to a profile.
if (this->rtpProfiles.find(ssrc) != this->rtpProfiles.end()) if (this->rtpProfiles.find(rtpStream) != this->rtpProfiles.end())
{ {
return this->rtpProfiles[ssrc]; auto it = this->rtpProfiles[rtpStream].begin();
return *it;
} }
// Look for the encoding associated with the SSRC. // Look for the encoding associated with the SSRC.
...@@ -628,7 +630,7 @@ namespace RTC ...@@ -628,7 +630,7 @@ namespace RTC
{ {
if (encoding.ssrc == ssrc) if (encoding.ssrc == ssrc)
{ {
this->rtpProfiles[ssrc] = encoding.profile; this->rtpProfiles[rtpStream].insert(encoding.profile);
return encoding.profile; return encoding.profile;
} }
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论