зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1628630 - Add Support for RTX in WebRTC SDP CAPI;r=dminor
Differential Revision: https://phabricator.services.mozilla.com/D70330 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
53809171df
Коммит
763dd6c1c0
|
@ -680,6 +680,9 @@ std::tuple<SdpRtpmapAttributeList::CodecType, FmtDefaults> strToCodecType(
|
|||
} else if (!nsCRT::strcasecmp(name.c_str(), "telephone-event")) {
|
||||
codec = SdpRtpmapAttributeList::kTelephoneEvent;
|
||||
defaults = {1};
|
||||
} else if (!nsCRT::strcasecmp(name.c_str(), "rtx")) {
|
||||
codec = SdpRtpmapAttributeList::kRtx;
|
||||
defaults = {0};
|
||||
}
|
||||
return std::make_tuple(codec, defaults);
|
||||
}
|
||||
|
@ -777,11 +780,16 @@ void RsdparsaSdpAttributeList::LoadFmtp(RustAttributeList* attributeList) {
|
|||
|
||||
fmtpParameters.reset(
|
||||
new SdpFmtpAttributeList::RedParameters(std::move(redParameters)));
|
||||
} else if (codecName == "RTX") {
|
||||
MOZ_ASSERT(rustFmtpParameters.rtx);
|
||||
rustFmtpParameters.rtx.apply([&](const auto& aRtx) {
|
||||
fmtpParameters.reset(
|
||||
new SdpFmtpAttributeList::RtxParameters(aRtx.apt, aRtx.rtx_time));
|
||||
});
|
||||
} else {
|
||||
// The parameter set is unknown so skip it
|
||||
continue;
|
||||
}
|
||||
|
||||
fmtpList->PushEntry(std::to_string(payloadType), std::move(fmtpParameters));
|
||||
}
|
||||
SetAttribute(fmtpList.release());
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#define _RUSTSDPINC_H_
|
||||
|
||||
#include "nsError.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "signaling/src/sdp/RsdparsaSdpInc.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
@ -193,6 +195,11 @@ struct RustSdpAttributeImageAttr {
|
|||
RustSdpAttributeImageAttrSetList recv;
|
||||
};
|
||||
|
||||
struct RustRtxFmtpParameters {
|
||||
uint8_t apt;
|
||||
mozilla::Maybe<uint32_t> rtx_time;
|
||||
};
|
||||
|
||||
struct RustSdpAttributeFmtpParameters {
|
||||
// H264
|
||||
uint32_t packetization_mode;
|
||||
|
@ -218,6 +225,9 @@ struct RustSdpAttributeFmtpParameters {
|
|||
// telephone-event
|
||||
StringView dtmf_tones;
|
||||
|
||||
// RTX
|
||||
mozilla::Maybe<RustRtxFmtpParameters> rtx;
|
||||
|
||||
// Red codecs
|
||||
U8Vec* encodings;
|
||||
|
||||
|
|
|
@ -1046,6 +1046,7 @@ static bool ShouldSerializeChannels(SdpRtpmapAttributeList::CodecType type) {
|
|||
case SdpRtpmapAttributeList::kRed:
|
||||
case SdpRtpmapAttributeList::kUlpfec:
|
||||
case SdpRtpmapAttributeList::kTelephoneEvent:
|
||||
case SdpRtpmapAttributeList::kRtx:
|
||||
return false;
|
||||
case SdpRtpmapAttributeList::kOtherCodec:
|
||||
return true;
|
||||
|
|
|
@ -1071,6 +1071,7 @@ class SdpRtpmapAttributeList : public SdpAttribute {
|
|||
kRed,
|
||||
kUlpfec,
|
||||
kTelephoneEvent,
|
||||
kRtx,
|
||||
kOtherCodec
|
||||
};
|
||||
|
||||
|
@ -1153,6 +1154,9 @@ inline std::ostream& operator<<(std::ostream& os,
|
|||
case SdpRtpmapAttributeList::kTelephoneEvent:
|
||||
os << "telephone-event";
|
||||
break;
|
||||
case SdpRtpmapAttributeList::kRtx:
|
||||
os << "rtx";
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT(false);
|
||||
os << "?";
|
||||
|
@ -1208,6 +1212,36 @@ class SdpFmtpAttributeList : public SdpAttribute {
|
|||
std::vector<uint8_t> encodings;
|
||||
};
|
||||
|
||||
class RtxParameters : public Parameters {
|
||||
public:
|
||||
uint8_t apt;
|
||||
Maybe<uint32_t> rtx_time;
|
||||
|
||||
RtxParameters(const uint8_t aApt, const Maybe<uint32_t>& aRtxTime)
|
||||
: Parameters(SdpRtpmapAttributeList::kRtx),
|
||||
apt(aApt),
|
||||
rtx_time(aRtxTime) {}
|
||||
|
||||
virtual ~RtxParameters() {}
|
||||
|
||||
virtual Parameters* Clone() const override {
|
||||
return new RtxParameters(*this);
|
||||
}
|
||||
|
||||
virtual void Serialize(std::ostream& os) const override {
|
||||
os << "apt=" << apt;
|
||||
rtx_time.apply([&](const auto& time) { os << ";rtx-time=" << time; });
|
||||
}
|
||||
|
||||
virtual bool CompareEq(const Parameters& aOther) const override {
|
||||
if (aOther.codec_type != codec_type) {
|
||||
return false;
|
||||
}
|
||||
auto other = static_cast<const RtxParameters&>(aOther);
|
||||
return other.apt = apt && other.rtx_time == rtx_time;
|
||||
}
|
||||
};
|
||||
|
||||
class H264Parameters : public Parameters {
|
||||
public:
|
||||
static const uint32_t kDefaultProfileLevelId = 0x420010;
|
||||
|
|
|
@ -425,6 +425,9 @@ pub struct RustSdpAttributeFmtpParameters {
|
|||
// telephone-event
|
||||
pub dtmf_tones: StringView,
|
||||
|
||||
// RTX
|
||||
pub rtx: Option<RtxFmtpParameters>,
|
||||
|
||||
// Red
|
||||
pub encodings: *const Vec<u8>,
|
||||
|
||||
|
@ -450,6 +453,7 @@ impl<'a> From<&'a SdpAttributeFmtpParameters> for RustSdpAttributeFmtpParameters
|
|||
max_fr: other.max_fr,
|
||||
maxplaybackrate: other.maxplaybackrate,
|
||||
dtmf_tones: StringView::from(other.dtmf_tones.as_str()),
|
||||
rtx: other.rtx,
|
||||
encodings: &other.encodings,
|
||||
unknown_tokens: &other.unknown_tokens,
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче