зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1347911 - Add support for ssrc groups to SdpAttributeList; r=bwc
Differential Revision: https://phabricator.services.mozilla.com/D69270 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
2765f304a9
Коммит
c60f2fd639
|
@ -327,6 +327,15 @@ const SdpSsrcAttributeList& RsdparsaSdpAttributeList::GetSsrc() const {
|
|||
return *static_cast<const SdpSsrcAttributeList*>(attr);
|
||||
}
|
||||
|
||||
const SdpSsrcGroupAttributeList& RsdparsaSdpAttributeList::GetSsrcGroup()
|
||||
const {
|
||||
if (!HasAttribute(SdpAttribute::kSsrcGroupAttribute)) {
|
||||
MOZ_CRASH();
|
||||
}
|
||||
const SdpAttribute* attr = GetAttribute(SdpAttribute::kSsrcGroupAttribute);
|
||||
return *static_cast<const SdpSsrcGroupAttributeList*>(attr);
|
||||
}
|
||||
|
||||
void RsdparsaSdpAttributeList::LoadAttribute(RustAttributeList* attributeList,
|
||||
AttributeType type) {
|
||||
if (!mAttributes[type]) {
|
||||
|
@ -423,6 +432,8 @@ void RsdparsaSdpAttributeList::LoadAttribute(RustAttributeList* attributeList,
|
|||
LoadCandidate(attributeList);
|
||||
return;
|
||||
case SdpAttribute::kSsrcGroupAttribute:
|
||||
LoadSsrcGroup(attributeList);
|
||||
return;
|
||||
case SdpAttribute::kConnectionAttribute:
|
||||
case SdpAttribute::kIceMismatchAttribute:
|
||||
case SdpAttribute::kLabelAttribute:
|
||||
|
@ -586,6 +597,45 @@ void RsdparsaSdpAttributeList::LoadSsrc(RustAttributeList* attributeList) {
|
|||
SetAttribute(ssrcs.release());
|
||||
}
|
||||
|
||||
void RsdparsaSdpAttributeList::LoadSsrcGroup(RustAttributeList* attributeList) {
|
||||
size_t numSsrcGroups = sdp_get_ssrc_group_count(attributeList);
|
||||
if (numSsrcGroups == 0) {
|
||||
return;
|
||||
}
|
||||
auto rustSsrcGroups = MakeUnique<RustSdpAttributeSsrcGroup[]>(numSsrcGroups);
|
||||
sdp_get_ssrc_groups(attributeList, numSsrcGroups, rustSsrcGroups.get());
|
||||
auto ssrcGroups = MakeUnique<SdpSsrcGroupAttributeList>();
|
||||
for (size_t i = 0; i < numSsrcGroups; i++) {
|
||||
RustSdpAttributeSsrcGroup& ssrcGroup = rustSsrcGroups[i];
|
||||
SdpSsrcGroupAttributeList::Semantics semantic;
|
||||
switch (ssrcGroup.semantic) {
|
||||
case RustSdpAttributeSsrcGroupSemantic ::kRustDup:
|
||||
semantic = SdpSsrcGroupAttributeList::kDup;
|
||||
break;
|
||||
case RustSdpAttributeSsrcGroupSemantic ::kRustFec:
|
||||
semantic = SdpSsrcGroupAttributeList::kFec;
|
||||
break;
|
||||
case RustSdpAttributeSsrcGroupSemantic ::kRustFecFr:
|
||||
semantic = SdpSsrcGroupAttributeList::kFecFr;
|
||||
break;
|
||||
case RustSdpAttributeSsrcGroupSemantic ::kRustFid:
|
||||
semantic = SdpSsrcGroupAttributeList::kFid;
|
||||
break;
|
||||
case RustSdpAttributeSsrcGroupSemantic ::kRustSim:
|
||||
semantic = SdpSsrcGroupAttributeList::kSim;
|
||||
break;
|
||||
}
|
||||
std::vector<uint32_t> ssrcs;
|
||||
for (size_t i = 0; i < ssrc_vec_len(ssrcGroup.ssrcs); ++i) {
|
||||
uint32_t ssrc;
|
||||
ssrc_vec_get_id(ssrcGroup.ssrcs, i, &ssrc);
|
||||
ssrcs.push_back(ssrc);
|
||||
}
|
||||
ssrcGroups->PushEntry(semantic, ssrcs);
|
||||
}
|
||||
SetAttribute(ssrcGroups.release());
|
||||
}
|
||||
|
||||
struct FmtDefaults {
|
||||
uint32_t minimumChannels = 0;
|
||||
};
|
||||
|
|
|
@ -42,6 +42,7 @@ class RsdparsaSdpAttributeList : public SdpAttributeList {
|
|||
const SdpRemoteCandidatesAttribute& GetRemoteCandidates() const override;
|
||||
const SdpSetupAttribute& GetSetup() const override;
|
||||
const SdpSsrcAttributeList& GetSsrc() const override;
|
||||
const SdpSsrcGroupAttributeList& GetSsrcGroup() const override;
|
||||
const SdpDtlsMessageAttribute& GetDtlsMessage() const override;
|
||||
|
||||
// These attributes can appear multiple times, so the returned
|
||||
|
@ -118,6 +119,7 @@ class RsdparsaSdpAttributeList : public SdpAttributeList {
|
|||
void LoadDtlsMessage(RustAttributeList* attributeList);
|
||||
void LoadSetup(RustAttributeList* attributeList);
|
||||
void LoadSsrc(RustAttributeList* attributeList);
|
||||
void LoadSsrcGroup(RustAttributeList* attributeList);
|
||||
void LoadRtpmap(RustAttributeList* attributeList);
|
||||
void LoadFmtp(RustAttributeList* attributeList);
|
||||
void LoadPtime(RustAttributeList* attributeList);
|
||||
|
|
|
@ -1624,7 +1624,8 @@ class SdpSsrcGroupAttributeList : public SdpAttribute {
|
|||
kFec, // RFC5576
|
||||
kFid, // RFC5576
|
||||
kFecFr, // RFC5956
|
||||
kDup // RFC7104
|
||||
kDup, // RFC7104
|
||||
kSim // non-standard, used by hangouts
|
||||
};
|
||||
|
||||
struct SsrcGroup {
|
||||
|
@ -1659,6 +1660,9 @@ inline std::ostream& operator<<(std::ostream& os,
|
|||
case SdpSsrcGroupAttributeList::kDup:
|
||||
os << "DUP";
|
||||
break;
|
||||
case SdpSsrcGroupAttributeList::kSim:
|
||||
os << "SIM";
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT(false);
|
||||
os << "?";
|
||||
|
|
|
@ -62,6 +62,7 @@ class SdpAttributeList {
|
|||
virtual uint32_t GetSctpPort() const = 0;
|
||||
virtual uint32_t GetMaxMessageSize() const = 0;
|
||||
virtual const SdpSsrcAttributeList& GetSsrc() const = 0;
|
||||
virtual const SdpSsrcGroupAttributeList& GetSsrcGroup() const = 0;
|
||||
|
||||
// These attributes are effectively simple types, so we'll make life
|
||||
// easy by just returning their value.
|
||||
|
|
|
@ -467,6 +467,55 @@ void SipccSdpAttributeList::LoadSsrc(sdp_t* sdp, uint16_t level) {
|
|||
}
|
||||
}
|
||||
|
||||
void SipccSdpAttributeList::LoadSsrcGroup(sdp_t* sdp, uint16_t level) {
|
||||
auto ssrcGroups = MakeUnique<SdpSsrcGroupAttributeList>();
|
||||
|
||||
for (uint16_t i = 1; i < UINT16_MAX; ++i) {
|
||||
sdp_attr_t* attr = sdp_find_attr(sdp, level, 0, SDP_ATTR_SSRC_GROUP, i);
|
||||
|
||||
if (!attr) {
|
||||
break;
|
||||
}
|
||||
|
||||
sdp_ssrc_group_t* ssrc_group = &(attr->attr.ssrc_group);
|
||||
|
||||
SdpSsrcGroupAttributeList::Semantics semantic;
|
||||
switch (ssrc_group->semantic) {
|
||||
case SDP_SSRC_GROUP_ATTR_FEC:
|
||||
semantic = SdpSsrcGroupAttributeList::kFec;
|
||||
break;
|
||||
case SDP_SSRC_GROUP_ATTR_FID:
|
||||
semantic = SdpSsrcGroupAttributeList::kFid;
|
||||
break;
|
||||
case SDP_SSRC_GROUP_ATTR_FECFR:
|
||||
semantic = SdpSsrcGroupAttributeList::kFecFr;
|
||||
break;
|
||||
case SDP_SSRC_GROUP_ATTR_DUP:
|
||||
semantic = SdpSsrcGroupAttributeList::kDup;
|
||||
break;
|
||||
case SDP_SSRC_GROUP_ATTR_SIM:
|
||||
semantic = SdpSsrcGroupAttributeList::kSim;
|
||||
break;
|
||||
case SDP_MAX_SSRC_GROUP_ATTR_VAL:
|
||||
continue;
|
||||
case SDP_SSRC_GROUP_ATTR_UNSUPPORTED:
|
||||
continue;
|
||||
}
|
||||
|
||||
std::vector<uint32_t> ssrcs;
|
||||
ssrcs.reserve(ssrc_group->num_ssrcs);
|
||||
for (int i = 0; i < ssrc_group->num_ssrcs; ++i) {
|
||||
ssrcs.push_back(ssrc_group->ssrcs[i]);
|
||||
}
|
||||
|
||||
ssrcGroups->PushEntry(semantic, ssrcs);
|
||||
}
|
||||
|
||||
if (!ssrcGroups->mSsrcGroups.empty()) {
|
||||
SetAttribute(ssrcGroups.release());
|
||||
}
|
||||
}
|
||||
|
||||
bool SipccSdpAttributeList::LoadImageattr(sdp_t* sdp, uint16_t level,
|
||||
InternalResults& results) {
|
||||
UniquePtr<SdpImageattrAttributeList> imageattrs(
|
||||
|
@ -996,6 +1045,7 @@ bool SipccSdpAttributeList::Load(sdp_t* sdp, uint16_t level,
|
|||
LoadRtcpFb(sdp, level, results);
|
||||
LoadRtcp(sdp, level, results);
|
||||
LoadSsrc(sdp, level);
|
||||
LoadSsrcGroup(sdp, level);
|
||||
if (!LoadImageattr(sdp, level, results)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1289,6 +1339,14 @@ const SdpSsrcAttributeList& SipccSdpAttributeList::GetSsrc() const {
|
|||
return *static_cast<const SdpSsrcAttributeList*>(attr);
|
||||
}
|
||||
|
||||
const SdpSsrcGroupAttributeList& SipccSdpAttributeList::GetSsrcGroup() const {
|
||||
if (!HasAttribute(SdpAttribute::kSsrcGroupAttribute)) {
|
||||
MOZ_CRASH();
|
||||
}
|
||||
const SdpAttribute* attr = GetAttribute(SdpAttribute::kSsrcGroupAttribute);
|
||||
return *static_cast<const SdpSsrcGroupAttributeList*>(attr);
|
||||
}
|
||||
|
||||
void SipccSdpAttributeList::Serialize(std::ostream& os) const {
|
||||
for (size_t i = 0; i < kNumAttributeTypes; ++i) {
|
||||
if (mAttributes[i]) {
|
||||
|
|
|
@ -46,6 +46,7 @@ class SipccSdpAttributeList : public SdpAttributeList {
|
|||
const override;
|
||||
virtual const SdpSetupAttribute& GetSetup() const override;
|
||||
virtual const SdpSsrcAttributeList& GetSsrc() const override;
|
||||
virtual const SdpSsrcGroupAttributeList& GetSsrcGroup() const override;
|
||||
virtual const SdpDtlsMessageAttribute& GetDtlsMessage() const override;
|
||||
|
||||
// These attributes can appear multiple times, so the returned
|
||||
|
@ -106,6 +107,7 @@ class SipccSdpAttributeList : public SdpAttributeList {
|
|||
void LoadCandidate(sdp_t* sdp, uint16_t level);
|
||||
void LoadSetup(sdp_t* sdp, uint16_t level);
|
||||
void LoadSsrc(sdp_t* sdp, uint16_t level);
|
||||
void LoadSsrcGroup(sdp_t* sdp, uint16_t level);
|
||||
bool LoadImageattr(sdp_t* sdp, uint16_t level, InternalResults& results);
|
||||
bool LoadSimulcast(sdp_t* sdp, uint16_t level, InternalResults& results);
|
||||
bool LoadGroups(sdp_t* sdp, uint16_t level, InternalResults& results);
|
||||
|
|
Загрузка…
Ссылка в новой задаче