/* * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree.
*/ #include"api/rtp_parameters.h"
constexpr int RtpExtension::kMinId;
constexpr int RtpExtension::kMaxId;
constexpr int RtpExtension::kMaxValueSize;
constexpr int RtpExtension::kOneByteHeaderExtensionMaxId;
constexpr int RtpExtension::kOneByteHeaderExtensionMaxValueSize;
bool RtpExtension::IsSupportedForAudio(absl::string_view uri) { return uri == webrtc::RtpExtension::kAudioLevelUri ||
uri == webrtc::RtpExtension::kAbsSendTimeUri ||
uri == webrtc::RtpExtension::kAbsoluteCaptureTimeUri ||
uri == webrtc::RtpExtension::kTransportSequenceNumberUri ||
uri == webrtc::RtpExtension::kTransportSequenceNumberV2Uri ||
uri == webrtc::RtpExtension::kMidUri ||
uri == webrtc::RtpExtension::kRidUri ||
uri == webrtc::RtpExtension::kRepairedRidUri ||
uri == webrtc::RtpExtension::kCsrcAudioLevelsUri;
}
bool RtpExtension::IsSupportedForVideo(absl::string_view uri) { return uri == webrtc::RtpExtension::kTimestampOffsetUri ||
uri == webrtc::RtpExtension::kAbsSendTimeUri ||
uri == webrtc::RtpExtension::kAbsoluteCaptureTimeUri ||
uri == webrtc::RtpExtension::kVideoRotationUri ||
uri == webrtc::RtpExtension::kTransportSequenceNumberUri ||
uri == webrtc::RtpExtension::kTransportSequenceNumberV2Uri ||
uri == webrtc::RtpExtension::kPlayoutDelayUri ||
uri == webrtc::RtpExtension::kVideoContentTypeUri ||
uri == webrtc::RtpExtension::kVideoTimingUri ||
uri == webrtc::RtpExtension::kMidUri ||
uri == webrtc::RtpExtension::kGenericFrameDescriptorUri00 ||
uri == webrtc::RtpExtension::kDependencyDescriptorUri ||
uri == webrtc::RtpExtension::kColorSpaceUri ||
uri == webrtc::RtpExtension::kRidUri ||
uri == webrtc::RtpExtension::kRepairedRidUri ||
uri == webrtc::RtpExtension::kVideoLayersAllocationUri ||
uri == webrtc::RtpExtension::kVideoFrameTrackingIdUri ||
uri == webrtc::RtpExtension::kCorruptionDetectionUri;
}
bool RtpExtension::IsEncryptionSupported(absl::string_view uri) { return #ifdefined(ENABLE_EXTERNAL_AUTH) // TODO(jbauch): Figure out a way to always allow "kAbsSendTimeUri" // here and filter out later if external auth is really used in // srtpfilter. External auth is used by Chromium and replaces the // extension header value of "kAbsSendTimeUri", so it must not be // encrypted (which can't be done by Chromium).
uri != webrtc::RtpExtension::kAbsSendTimeUri && #endif
uri != webrtc::RtpExtension::kEncryptHeaderExtensionsUri;
}
// Returns whether a header extension with the given URI exists. // Note: This does not differentiate between encrypted and non-encrypted // extensions, so use with care! staticbool HeaderExtensionWithUriExists( const std::vector<RtpExtension>& extensions,
absl::string_view uri) { for (constauto& extension : extensions) { if (extension.uri == uri) { returntrue;
}
} returnfalse;
}
switch (filter) { case kDiscardEncryptedExtension: // We only accept an unencrypted extension. if (!extension.encrypt) { return &extension;
} break;
case kPreferEncryptedExtension: // We prefer an encrypted extension but we can fall back to an // unencrypted extension. if (extension.encrypt) { return &extension;
} else {
fallback_extension = &extension;
} break;
case kRequireEncryptedExtension: // We only accept an encrypted extension. if (extension.encrypt) { return &extension;
} break;
}
}
// If we do not discard encrypted extensions, add them first if (filter != kDiscardEncryptedExtension) { for (constauto& extension : extensions) { if (!extension.encrypt) { continue;
} if (!HeaderExtensionWithUriExists(filtered, extension.uri)) {
filtered.push_back(extension);
}
}
}
// If we do not require encrypted extensions, add missing, non-encrypted // extensions. if (filter != kRequireEncryptedExtension) { for (constauto& extension : extensions) { if (extension.encrypt) { continue;
} if (!HeaderExtensionWithUriExists(filtered, extension.uri)) {
filtered.push_back(extension);
}
}
}
// Sort the returned vector to make comparisons of header extensions reliable. // In order of priority, we sort by uri first, then encrypt and id last.
std::sort(filtered.begin(), filtered.end(),
[](const RtpExtension& a, const RtpExtension& b) { return std::tie(a.uri, a.encrypt, a.id) <
std::tie(b.uri, b.encrypt, b.id);
});
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.