diff options
author | Steve Anton <steveanton@webrtc.org> | 2019-01-11 09:05:09 -0800 |
---|---|---|
committer | Steve Anton <steveanton@webrtc.org> | 2019-01-11 17:05:20 +0000 |
commit | 1c05765831f2993672b058c29df4879b921adc8e (patch) | |
tree | 615a757e05dc89f5c3f8e765f84f719a0d0d284e /pc/rtp_parameters_conversion.h | |
parent | 1bab19655176059539a1b5a55c462f4e576b700d (diff) | |
download | webrtc-1c05765831f2993672b058c29df4879b921adc8e.tar.gz |
(3) Rename files to snake_case: move the files
Mechanically generated with this command:
tools_webrtc/do-rename.sh move all-renames.txt
Bug: webrtc:10159
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I8b05b6eab9b9d18b29c2199bbea239e9add1e690
Reviewed-on: https://webrtc-review.googlesource.com/c/115481
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26225}
Diffstat (limited to 'pc/rtp_parameters_conversion.h')
-rw-r--r-- | pc/rtp_parameters_conversion.h | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/pc/rtp_parameters_conversion.h b/pc/rtp_parameters_conversion.h new file mode 100644 index 0000000000..b77d3b7899 --- /dev/null +++ b/pc/rtp_parameters_conversion.h @@ -0,0 +1,109 @@ +/* + * Copyright 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. + */ + +#ifndef PC_RTPPARAMETERSCONVERSION_H_ +#define PC_RTPPARAMETERSCONVERSION_H_ + +#include <iosfwd> +#include <vector> + +#include "absl/types/optional.h" +#include "api/rtcerror.h" +#include "api/rtpparameters.h" +#include "media/base/codec.h" +#include "media/base/streamparams.h" +#include "pc/sessiondescription.h" + +namespace webrtc { + +// NOTE: Some functions are templated for convenience, such that template-based +// code dealing with AudioContentDescription and VideoContentDescription can +// use this easily. Such methods are usable with cricket::AudioCodec and +// cricket::VideoCodec. + +//*************************************************************************** +// Functions for converting from new webrtc:: structures to old cricket:: +// structures. +// +// As the return values imply, all of these functions do validation of the +// parameters and return an error if they're invalid. It's expected that any +// default values (such as video clock rate of 90000) have been filled by the +// time the webrtc:: structure is being converted to the cricket:: one. +// +// These are expected to be used when parameters are passed into an RtpSender +// or RtpReceiver, and need to be validated and converted so they can be +// applied to the media engine level. +//*************************************************************************** + +// Returns error on invalid input. Certain message types are only valid for +// certain feedback types. +RTCErrorOr<cricket::FeedbackParam> ToCricketFeedbackParam( + const RtcpFeedback& feedback); + +// Verifies that the codec kind is correct, and it has mandatory parameters +// filled, with values in valid ranges. +template <typename C> +RTCErrorOr<C> ToCricketCodec(const RtpCodecParameters& codec); + +// Verifies that payload types aren't duplicated, in addition to normal +// validation. +template <typename C> +RTCErrorOr<std::vector<C>> ToCricketCodecs( + const std::vector<RtpCodecParameters>& codecs); + +// Validates that header extension IDs aren't duplicated. +RTCErrorOr<cricket::RtpHeaderExtensions> ToCricketRtpHeaderExtensions( + const std::vector<RtpHeaderExtensionParameters>& extensions); + +// SSRCs are allowed to be ommitted. This may be used for receive parameters +// where SSRCs are unsignaled. +RTCErrorOr<cricket::StreamParamsVec> ToCricketStreamParamsVec( + const std::vector<RtpEncodingParameters>& encodings); + +//***************************************************************************** +// Functions for converting from old cricket:: structures to new webrtc:: +// structures. Unlike the above functions, these are permissive with regards to +// input validation; it's assumed that any necessary validation already +// occurred. +// +// These are expected to be used either to convert from audio/video engine +// capabilities to RtpCapabilities, or to convert from already-parsed SDP +// (in the form of cricket:: structures) to webrtc:: structures. The latter +// functionality is not yet implemented. +//***************************************************************************** + +// Returns empty value if |cricket_feedback| is a feedback type not +// supported/recognized. +absl::optional<RtcpFeedback> ToRtcpFeedback( + const cricket::FeedbackParam& cricket_feedback); + +std::vector<RtpEncodingParameters> ToRtpEncodings( + const cricket::StreamParamsVec& stream_params); + +template <typename C> +RtpCodecParameters ToRtpCodecParameters(const C& cricket_codec); + +template <typename C> +RtpCodecCapability ToRtpCodecCapability(const C& cricket_codec); + +template <class C> +RtpCapabilities ToRtpCapabilities( + const std::vector<C>& cricket_codecs, + const cricket::RtpHeaderExtensions& cricket_extensions); + +template <class C> +RtpParameters ToRtpParameters( + const std::vector<C>& cricket_codecs, + const cricket::RtpHeaderExtensions& cricket_extensions, + const cricket::StreamParamsVec& stream_params); + +} // namespace webrtc + +#endif // PC_RTPPARAMETERSCONVERSION_H_ |