提交 b4c2c41f authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Merge branch 'rtp-data'

......@@ -30,6 +30,15 @@ namespace RTC
virtual void onRtpSenderClosed(RtpSender* rtpSender) = 0;
};
private:
struct Data
{
std::string muxId;
RTC::RtpCodecMime mediaMime;
uint32_t mediaSsrc = 0;
// TODO: Add much more and move supportedPayloadTypes here.
};
private:
// Container of RTP packets to retransmit.
static std::vector<RTC::RtpPacket*> rtpRetransmissionContainer;
......
......@@ -52,6 +52,7 @@
'src/RTC/RtpDictionaries/RtpFecParameters.cpp',
'src/RTC/RtpDictionaries/RtpHeaderExtension.cpp',
'src/RTC/RtpDictionaries/RtpHeaderExtensionParameters.cpp',
'src/RTC/RtpDictionaries/RtpHeaderExtensionUri.cpp',
'src/RTC/RtpDictionaries/RtpParameters.cpp',
'src/RTC/RtpDictionaries/RtpRtxParameters.cpp',
'src/RTC/RTCP/Packet.cpp',
......
......@@ -41,8 +41,9 @@ namespace RTC
{
RtpHeaderExtension headerExtension(json_array[i]);
// Append to the headerExtensions vector.
this->headerExtensions.push_back(headerExtension);
// If a known header extension, append to the headerExtensions vector.
if (headerExtension.type != RtpHeaderExtensionUri::Type::UNKNOWN)
this->headerExtensions.push_back(headerExtension);
}
}
......@@ -114,7 +115,7 @@ namespace RTC
for (auto& supportedHeaderExtension : supportedHeaderExtensions)
{
if (
headerExtension.uri == supportedHeaderExtension.uri &&
headerExtension.type == supportedHeaderExtension.type &&
(
headerExtension.kind == supportedHeaderExtension.kind ||
supportedHeaderExtension.kind == RTC::Media::Kind::ALL
......
......@@ -38,6 +38,9 @@ namespace RTC
if (this->uri.empty())
MS_THROW_ERROR("empty RtpHeaderExtension.uri");
// Get the type.
this->type = RTC::RtpHeaderExtensionUri::GetType(this->uri);
// `preferredId` is mandatory.
if (!data[k_preferredId].isUInt())
MS_THROW_ERROR("missing RtpHeaderExtension.preferredId");
......
......@@ -29,6 +29,9 @@ namespace RTC
if (this->uri.empty())
MS_THROW_ERROR("empty RtpHeaderExtensionParameters.uri");
// Get the type.
this->type = RTC::RtpHeaderExtensionUri::GetType(this->uri);
// `id` is mandatory.
if (!data[k_id].isUInt())
MS_THROW_ERROR("missing RtpHeaderExtensionParameters.id");
......
#define MS_CLASS "RTC::RtpHeaderExtensionUri"
// #define MS_LOG_DEV
#include "RTC/RtpDictionaries.hpp"
#include "Utils.hpp"
#include "Logger.hpp"
namespace RTC
{
/* Class variables. */
std::unordered_map<std::string, RtpHeaderExtensionUri::Type> RtpHeaderExtensionUri::string2Type =
{
{ "urn:ietf:params:rtp-hdrext:ssrc-audio-level", RtpHeaderExtensionUri::Type::SSRC_AUDIO_LEVEL },
{ "urn:ietf:params:rtp-hdrext:toffset", RtpHeaderExtensionUri::Type::TO_OFFSET },
{ "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time", RtpHeaderExtensionUri::Type::ABS_SEND_TIME },
{ "urn:3gpp:video-orientation", RtpHeaderExtensionUri::Type::VIDEO_ORIENTATION },
{ "urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id", RtpHeaderExtensionUri::Type::RTP_STREAM_ID }
};
/* Class methods. */
RtpHeaderExtensionUri::Type RtpHeaderExtensionUri::GetType(std::string& uri)
{
MS_TRACE();
// Force lowcase names.
Utils::String::ToLowerCase(uri);
auto it = RtpHeaderExtensionUri::string2Type.find(uri);
if (it != RtpHeaderExtensionUri::string2Type.end())
return it->second;
else
return RtpHeaderExtensionUri::Type::UNKNOWN;
}
}
......@@ -71,8 +71,9 @@ namespace RTC
{
RTC::RtpHeaderExtensionParameters headerExtension(json_array[i]);
// Append to the headerExtensions vector.
this->headerExtensions.push_back(headerExtension);
// If a known header extension, append to the headerExtensions vector.
if (headerExtension.type != RtpHeaderExtensionUri::Type::UNKNOWN)
this->headerExtensions.push_back(headerExtension);
}
}
......@@ -230,7 +231,7 @@ namespace RTC
{
for (auto& supportedHeaderExtension : supportedHeaderExtensions)
{
if (headerExtension.uri == supportedHeaderExtension.uri)
if (headerExtension.type == supportedHeaderExtension.type)
{
// Set the same id and other properties.
headerExtension.id = supportedHeaderExtension.preferredId;
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论