RtpCapabilities ToRtpCapabilities( const std::vector<Codec>& cricket_codecs, const RtpHeaderExtensions& cricket_extensions) {
RtpCapabilities capabilities; bool have_red = false; bool have_ulpfec = false; bool have_flexfec = false; bool have_rtx = false;
for (const Codec& cricket_codec : cricket_codecs) {
if (cricket_codec.name == kRedCodecName) {
if (have_red) { // There should only be one RED codec entry in caps. continue;
}
have_red = true;
} else if (cricket_codec.name == kUlpfecCodecName) {
have_ulpfec = true;
} else if (cricket_codec.name == kFlexfecCodecName) {
have_flexfec = true;
} else if (cricket_codec.name == kRtxCodecName) {
if (have_rtx) { // There should only be one RTX codec entry in caps. continue;
}
have_rtx = true;
} auto codec_capability = ToRtpCodecCapability(cricket_codec);
if (cricket_codec.name == kRtxCodecName ||
cricket_codec.name == kRedCodecName) { // For RTX this removes the APT which points to a payload type. // For RED this removes the redundancy spec which points to a payload // type.
codec_capability.parameters.clear();
}
capabilities.codecs.push_back(codec_capability);
}
for (const RtpExtension& cricket_extension : cricket_extensions) {
capabilities.header_extensions.emplace_back(cricket_extension.uri,
cricket_extension.id);
}
if (have_red) {
capabilities.fec.push_back(FecMechanism::RED);
}
if (have_red && have_ulpfec) {
capabilities.fec.push_back(FecMechanism::RED_AND_ULPFEC);
}
if (have_flexfec) {
capabilities.fec.push_back(FecMechanism::FLEXFEC);
} return capabilities;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.