зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1418804: added support for cbr attribute. r=ng
Depends on D74493 Differential Revision: https://phabricator.services.mozilla.com/D74494
This commit is contained in:
Родитель
b999865cb0
Коммит
3234b32c9c
|
@ -114,7 +114,8 @@ class JsepAudioCodecDescription : public JsepCodecDescription {
|
|||
mDTXEnabled(false),
|
||||
mFrameSizeMs(0),
|
||||
mMinFrameSizeMs(0),
|
||||
mMaxFrameSizeMs(0) {}
|
||||
mMaxFrameSizeMs(0),
|
||||
mCbrEnabled(false) {}
|
||||
|
||||
JSEP_CODEC_CLONE(JsepAudioCodecDescription)
|
||||
|
||||
|
@ -169,6 +170,7 @@ class JsepAudioCodecDescription : public JsepCodecDescription {
|
|||
opusParams.frameSizeMs = mFrameSizeMs;
|
||||
opusParams.minFrameSizeMs = mMinFrameSizeMs;
|
||||
opusParams.maxFrameSizeMs = mMaxFrameSizeMs;
|
||||
opusParams.useCbr = mCbrEnabled;
|
||||
msection.SetFmtp(SdpFmtpAttributeList::Fmtp(mDefaultPt, opusParams));
|
||||
} else if (mName == "telephone-event") {
|
||||
// add the default dtmf tones
|
||||
|
@ -196,9 +198,20 @@ class JsepAudioCodecDescription : public JsepCodecDescription {
|
|||
mMaxAverageBitrate = opusParams.maxAverageBitrate;
|
||||
}
|
||||
mDTXEnabled = opusParams.useDTX;
|
||||
mFrameSizeMs = opusParams.frameSizeMs;
|
||||
if (remoteMsection.GetAttributeList().HasAttribute(
|
||||
SdpAttribute::kPtimeAttribute)) {
|
||||
mFrameSizeMs = remoteMsection.GetAttributeList().GetPtime();
|
||||
} else {
|
||||
mFrameSizeMs = opusParams.frameSizeMs;
|
||||
}
|
||||
mMinFrameSizeMs = opusParams.minFrameSizeMs;
|
||||
mMaxFrameSizeMs = opusParams.maxFrameSizeMs;
|
||||
if (remoteMsection.GetAttributeList().HasAttribute(
|
||||
SdpAttribute::kMaxptimeAttribute)) {
|
||||
mFrameSizeMs = remoteMsection.GetAttributeList().GetMaxptime();
|
||||
} else {
|
||||
mMaxFrameSizeMs = opusParams.maxFrameSizeMs;
|
||||
}
|
||||
mCbrEnabled = opusParams.useCbr;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -213,6 +226,7 @@ class JsepAudioCodecDescription : public JsepCodecDescription {
|
|||
uint32_t mFrameSizeMs;
|
||||
uint32_t mMinFrameSizeMs;
|
||||
uint32_t mMaxFrameSizeMs;
|
||||
bool mCbrEnabled;
|
||||
};
|
||||
|
||||
class JsepVideoCodecDescription : public JsepCodecDescription {
|
||||
|
|
|
@ -472,6 +472,9 @@ MediaConduitErrorCode WebrtcAudioConduit::ConfigureRecvMediaCodecs(
|
|||
if (codec->mMaxFrameSizeMs) {
|
||||
parameters["maxptime"] = std::to_string(codec->mMaxFrameSizeMs);
|
||||
}
|
||||
if (codec->mCbrEnabled) {
|
||||
parameters["cbr"] = "1";
|
||||
}
|
||||
}
|
||||
|
||||
webrtc::SdpAudioFormat format(codec->mName, codec->mFreq, codec->mChannels,
|
||||
|
@ -950,6 +953,9 @@ bool WebrtcAudioConduit::CodecConfigToWebRTCCodec(
|
|||
if (codecInfo->mMaxFrameSizeMs) {
|
||||
parameters["maxptime"] = std::to_string(codecInfo->mMaxFrameSizeMs);
|
||||
}
|
||||
if (codecInfo->mCbrEnabled) {
|
||||
parameters["cbr"] = "1";
|
||||
}
|
||||
}
|
||||
|
||||
webrtc::SdpAudioFormat format(codecInfo->mName, codecInfo->mFreq,
|
||||
|
|
|
@ -36,6 +36,7 @@ struct AudioCodecConfig {
|
|||
bool mDTXEnabled;
|
||||
uint32_t mMaxAverageBitrate;
|
||||
int mMaxPlaybackRate;
|
||||
bool mCbrEnabled;
|
||||
|
||||
AudioCodecConfig(int type, std::string name, int freq, int channels,
|
||||
bool FECEnabled)
|
||||
|
@ -50,7 +51,8 @@ struct AudioCodecConfig {
|
|||
mMinFrameSizeMs(0),
|
||||
mDTXEnabled(false),
|
||||
mMaxAverageBitrate(0),
|
||||
mMaxPlaybackRate(0) {}
|
||||
mMaxPlaybackRate(0),
|
||||
mCbrEnabled(false) {}
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -547,6 +547,7 @@ static nsresult JsepCodecDescToAudioCodecConfig(
|
|||
(*aConfig)->mFrameSizeMs = desc.mFrameSizeMs;
|
||||
(*aConfig)->mMinFrameSizeMs = desc.mMinFrameSizeMs;
|
||||
(*aConfig)->mMaxFrameSizeMs = desc.mMaxFrameSizeMs;
|
||||
(*aConfig)->mCbrEnabled = desc.mCbrEnabled;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -757,6 +757,7 @@ void RsdparsaSdpAttributeList::LoadFmtp(RustAttributeList* attributeList) {
|
|||
opusParameters.frameSizeMs = rustFmtpParameters.ptime;
|
||||
opusParameters.minFrameSizeMs = rustFmtpParameters.minptime;
|
||||
opusParameters.maxFrameSizeMs = rustFmtpParameters.maxptime;
|
||||
opusParameters.useCbr = rustFmtpParameters.cbr;
|
||||
|
||||
fmtpParameters.reset(
|
||||
new SdpFmtpAttributeList::OpusParameters(std::move(opusParameters)));
|
||||
|
|
|
@ -1361,7 +1361,8 @@ class SdpFmtpAttributeList : public SdpAttribute {
|
|||
kDefaultUseDTX = 0,
|
||||
kDefaultFrameSize = 0,
|
||||
kDefaultMinFrameSize = 0,
|
||||
kDefaultMaxFrameSize = 0
|
||||
kDefaultMaxFrameSize = 0,
|
||||
kDefaultUseCbr = 0
|
||||
};
|
||||
OpusParameters()
|
||||
: Parameters(SdpRtpmapAttributeList::kOpus),
|
||||
|
@ -1372,7 +1373,8 @@ class SdpFmtpAttributeList : public SdpAttribute {
|
|||
useDTX(kDefaultUseDTX),
|
||||
frameSizeMs(kDefaultFrameSize),
|
||||
minFrameSizeMs(kDefaultMinFrameSize),
|
||||
maxFrameSizeMs(kDefaultMaxFrameSize) {}
|
||||
maxFrameSizeMs(kDefaultMaxFrameSize),
|
||||
useCbr(kDefaultUseCbr) {}
|
||||
|
||||
Parameters* Clone() const override { return new OpusParameters(*this); }
|
||||
|
||||
|
@ -1395,6 +1397,9 @@ class SdpFmtpAttributeList : public SdpAttribute {
|
|||
if (maxFrameSizeMs) {
|
||||
os << ";maxptime=" << maxFrameSizeMs;
|
||||
}
|
||||
if (useCbr) {
|
||||
os << ";cbr=1";
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool CompareEq(const Parameters& other) const override {
|
||||
|
@ -1415,7 +1420,8 @@ class SdpFmtpAttributeList : public SdpAttribute {
|
|||
useDTX == otherOpus.useDTX &&
|
||||
frameSizeMs == otherOpus.frameSizeMs &&
|
||||
minFrameSizeMs == otherOpus.minFrameSizeMs &&
|
||||
maxFrameSizeMs == otherOpus.maxFrameSizeMs;
|
||||
maxFrameSizeMs == otherOpus.maxFrameSizeMs &&
|
||||
useCbr == otherOpus.useCbr;
|
||||
}
|
||||
|
||||
unsigned int maxplaybackrate;
|
||||
|
@ -1426,6 +1432,7 @@ class SdpFmtpAttributeList : public SdpAttribute {
|
|||
uint32_t frameSizeMs;
|
||||
uint32_t minFrameSizeMs;
|
||||
uint32_t maxFrameSizeMs;
|
||||
bool useCbr;
|
||||
};
|
||||
|
||||
class TelephoneEventParameters : public Parameters {
|
||||
|
|
Загрузка…
Ссылка в новой задаче