| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #ifndef WEBRTC_API_RTPPARAMETERS_H_ | 11 #ifndef WEBRTC_API_RTPPARAMETERS_H_ |
| 12 #define WEBRTC_API_RTPPARAMETERS_H_ | 12 #define WEBRTC_API_RTPPARAMETERS_H_ |
| 13 | 13 |
| 14 #include <string> | 14 #include <string> |
| 15 #include <unordered_map> | 15 #include <unordered_map> |
| 16 #include <vector> | 16 #include <vector> |
| 17 | 17 |
| 18 #include "webrtc/api/mediatypes.h" | 18 #include "webrtc/api/mediatypes.h" |
| 19 #include "webrtc/config.h" |
| 19 #include "webrtc/base/optional.h" | 20 #include "webrtc/base/optional.h" |
| 20 | 21 |
| 21 namespace webrtc { | 22 namespace webrtc { |
| 22 | 23 |
| 23 // These structures are intended to mirror those defined by: | 24 // These structures are intended to mirror those defined by: |
| 24 // http://draft.ortc.org/#rtcrtpdictionaries* | 25 // http://draft.ortc.org/#rtcrtpdictionaries* |
| 25 // Contains everything specified as of 2017 Jan 24. | 26 // Contains everything specified as of 2017 Jan 24. |
| 26 // | 27 // |
| 27 // They are used when retrieving or modifying the parameters of an | 28 // They are used when retrieving or modifying the parameters of an |
| 28 // RtpSender/RtpReceiver, or retrieving capabilities. | 29 // RtpSender/RtpReceiver, or retrieving capabilities. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 40 // identifier is used. | 41 // identifier is used. |
| 41 | 42 |
| 42 enum class FecMechanism { | 43 enum class FecMechanism { |
| 43 RED, | 44 RED, |
| 44 RED_AND_ULPFEC, | 45 RED_AND_ULPFEC, |
| 45 FLEXFEC, | 46 FLEXFEC, |
| 46 }; | 47 }; |
| 47 | 48 |
| 48 // Used in RtcpFeedback struct. | 49 // Used in RtcpFeedback struct. |
| 49 enum class RtcpFeedbackType { | 50 enum class RtcpFeedbackType { |
| 50 ACK, | |
| 51 CCM, | 51 CCM, |
| 52 NACK, | 52 NACK, |
| 53 REMB, // "goog-remb" | 53 REMB, // "goog-remb" |
| 54 TRANSPORT_CC, | 54 TRANSPORT_CC, |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 // Used in RtcpFeedback struct when type is ACK, NACK or CCM. | 57 // Used in RtcpFeedback struct when type is NACK or CCM. |
| 58 enum class RtcpFeedbackMessageType { | 58 enum class RtcpFeedbackMessageType { |
| 59 // Equivalent to {type: "nack", parameter: undefined} in ORTC. | 59 // Equivalent to {type: "nack", parameter: undefined} in ORTC. |
| 60 GENERIC_NACK, | 60 GENERIC_NACK, |
| 61 PLI, // Usable with NACK. | 61 PLI, // Usable with NACK. |
| 62 FIR, // Usable with CCM. | 62 FIR, // Usable with CCM. |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 enum class DtxStatus { | 65 enum class DtxStatus { |
| 66 DISABLED, | 66 DISABLED, |
| 67 ENABLED, | 67 ENABLED, |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 enum class DegradationPreference { | 70 enum class DegradationPreference { |
| 71 MAINTAIN_FRAMERATE, | 71 MAINTAIN_FRAMERATE, |
| 72 MAINTAIN_RESOLUTION, | 72 MAINTAIN_RESOLUTION, |
| 73 BALANCED, | 73 BALANCED, |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 enum class PriorityType { VERY_LOW, LOW, MEDIUM, HIGH }; | 76 enum class PriorityType { VERY_LOW, LOW, MEDIUM, HIGH }; |
| 77 | 77 |
| 78 struct RtcpFeedback { | 78 struct RtcpFeedback { |
| 79 RtcpFeedbackType type = RtcpFeedbackType::ACK; | 79 RtcpFeedbackType type = RtcpFeedbackType::CCM; |
| 80 | 80 |
| 81 // Equivalent to ORTC "parameter" field with slight differences: | 81 // Equivalent to ORTC "parameter" field with slight differences: |
| 82 // 1. It's an enum instead of a string. | 82 // 1. It's an enum instead of a string. |
| 83 // 2. Generic NACK feedback is represented by a GENERIC_NACK message type, | 83 // 2. Generic NACK feedback is represented by a GENERIC_NACK message type, |
| 84 // rather than an unset "parameter" value. | 84 // rather than an unset "parameter" value. |
| 85 rtc::Optional<RtcpFeedbackMessageType> message_type; | 85 rtc::Optional<RtcpFeedbackMessageType> message_type; |
| 86 | 86 |
| 87 // Constructors for convenience. |
| 88 RtcpFeedback() {} |
| 89 explicit RtcpFeedback(RtcpFeedbackType type) : type(type) {} |
| 90 RtcpFeedback(RtcpFeedbackType type, RtcpFeedbackMessageType message_type) |
| 91 : type(type), message_type(message_type) {} |
| 92 |
| 87 bool operator==(const RtcpFeedback& o) const { | 93 bool operator==(const RtcpFeedback& o) const { |
| 88 return type == o.type && message_type == o.message_type; | 94 return type == o.type && message_type == o.message_type; |
| 89 } | 95 } |
| 90 bool operator!=(const RtcpFeedback& o) const { return !(*this == o); } | 96 bool operator!=(const RtcpFeedback& o) const { return !(*this == o); } |
| 91 }; | 97 }; |
| 92 | 98 |
| 93 // RtpCodecCapability is to RtpCodecParameters as RtpCapabilities is to | 99 // RtpCodecCapability is to RtpCodecParameters as RtpCapabilities is to |
| 94 // RtpParameters. This represents the static capabilities of an endpoint's | 100 // RtpParameters. This represents the static capabilities of an endpoint's |
| 95 // implementation of a codec. | 101 // implementation of a codec. |
| 96 struct RtpCodecCapability { | 102 struct RtpCodecCapability { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 119 // TODO(deadbeef): Not implemented. | 125 // TODO(deadbeef): Not implemented. |
| 120 rtc::Optional<int> ptime; | 126 rtc::Optional<int> ptime; |
| 121 | 127 |
| 122 // The number of audio channels supported. Unused for video codecs. | 128 // The number of audio channels supported. Unused for video codecs. |
| 123 rtc::Optional<int> num_channels; | 129 rtc::Optional<int> num_channels; |
| 124 | 130 |
| 125 // Feedback mechanisms supported for this codec. | 131 // Feedback mechanisms supported for this codec. |
| 126 std::vector<RtcpFeedback> rtcp_feedback; | 132 std::vector<RtcpFeedback> rtcp_feedback; |
| 127 | 133 |
| 128 // Codec-specific parameters that must be signaled to the remote party. | 134 // Codec-specific parameters that must be signaled to the remote party. |
| 135 // |
| 129 // Corresponds to "a=fmtp" parameters in SDP. | 136 // Corresponds to "a=fmtp" parameters in SDP. |
| 137 // |
| 138 // Contrary to ORTC, these parameters are named using all lowercase strings. |
| 139 // This helps make the mapping to SDP simpler, if an application is using |
| 140 // SDP. Boolean values are represented by the string "1". |
| 130 std::unordered_map<std::string, std::string> parameters; | 141 std::unordered_map<std::string, std::string> parameters; |
| 131 | 142 |
| 132 // Codec-specific parameters that may optionally be signaled to the remote | 143 // Codec-specific parameters that may optionally be signaled to the remote |
| 133 // party. | 144 // party. |
| 134 // TODO(deadbeef): Not implemented. | 145 // TODO(deadbeef): Not implemented. |
| 135 std::unordered_map<std::string, std::string> options; | 146 std::unordered_map<std::string, std::string> options; |
| 136 | 147 |
| 137 // Maximum number of temporal layer extensions supported by this codec. | 148 // Maximum number of temporal layer extensions supported by this codec. |
| 138 // For example, a value of 1 indicates that 2 total layers are supported. | 149 // For example, a value of 1 indicates that 2 total layers are supported. |
| 139 // TODO(deadbeef): Not implemented. | 150 // TODO(deadbeef): Not implemented. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 // URI of this extension, as defined in RFC5285. | 188 // URI of this extension, as defined in RFC5285. |
| 178 std::string uri; | 189 std::string uri; |
| 179 | 190 |
| 180 // Preferred value of ID that goes in the packet. | 191 // Preferred value of ID that goes in the packet. |
| 181 rtc::Optional<int> preferred_id; | 192 rtc::Optional<int> preferred_id; |
| 182 | 193 |
| 183 // If true, it's preferred that the value in the header is encrypted. | 194 // If true, it's preferred that the value in the header is encrypted. |
| 184 // TODO(deadbeef): Not implemented. | 195 // TODO(deadbeef): Not implemented. |
| 185 bool preferred_encrypt = false; | 196 bool preferred_encrypt = false; |
| 186 | 197 |
| 198 // Constructors for convenience. |
| 199 RtpHeaderExtensionCapability() = default; |
| 200 explicit RtpHeaderExtensionCapability(const std::string& uri) : uri(uri) {} |
| 201 RtpHeaderExtensionCapability(const std::string& uri, int preferred_id) |
| 202 : uri(uri), preferred_id(preferred_id) {} |
| 203 |
| 187 bool operator==(const RtpHeaderExtensionCapability& o) const { | 204 bool operator==(const RtpHeaderExtensionCapability& o) const { |
| 188 return uri == o.uri && preferred_id == o.preferred_id && | 205 return uri == o.uri && preferred_id == o.preferred_id && |
| 189 preferred_encrypt == o.preferred_encrypt; | 206 preferred_encrypt == o.preferred_encrypt; |
| 190 } | 207 } |
| 191 bool operator!=(const RtpHeaderExtensionCapability& o) const { | 208 bool operator!=(const RtpHeaderExtensionCapability& o) const { |
| 192 return !(*this == o); | 209 return !(*this == o); |
| 193 } | 210 } |
| 194 }; | 211 }; |
| 195 | 212 |
| 196 // Used in RtpParameters; represents a specific configuration of a header | 213 // See webrtc/config.h. Has "uri" and "id" fields. |
| 197 // extension. | 214 // TODO(deadbeef): This is missing the "encrypt" flag, which is unimplemented. |
| 198 struct RtpHeaderExtensionParameters { | 215 typedef RtpExtension RtpHeaderExtensionParameters; |
| 199 // URI of this extension, as defined in RFC5285. | |
| 200 std::string uri; | |
| 201 | |
| 202 // ID value that goes in the packet. | |
| 203 int id = 0; | |
| 204 | |
| 205 // If true, the value in the header is encrypted. | |
| 206 // TODO(deadbeef): Not implemented. | |
| 207 bool encrypt = false; | |
| 208 | |
| 209 bool operator==(const RtpHeaderExtensionParameters& o) const { | |
| 210 return uri == o.uri && id == o.id && encrypt == o.encrypt; | |
| 211 } | |
| 212 bool operator!=(const RtpHeaderExtensionParameters& o) const { | |
| 213 return !(*this == o); | |
| 214 } | |
| 215 }; | |
| 216 | 216 |
| 217 struct RtpFecParameters { | 217 struct RtpFecParameters { |
| 218 // If unset, a value is chosen by the implementation. | 218 // If unset, a value is chosen by the implementation. |
| 219 // Works just like RtpEncodingParameters::ssrc. |
| 219 rtc::Optional<uint32_t> ssrc; | 220 rtc::Optional<uint32_t> ssrc; |
| 220 | 221 |
| 221 FecMechanism mechanism = FecMechanism::RED; | 222 FecMechanism mechanism = FecMechanism::RED; |
| 222 | 223 |
| 224 // Constructors for convenience. |
| 225 RtpFecParameters() = default; |
| 226 explicit RtpFecParameters(FecMechanism mechanism) : mechanism(mechanism) {} |
| 227 RtpFecParameters(FecMechanism mechanism, uint32_t ssrc) |
| 228 : ssrc(ssrc), mechanism(mechanism) {} |
| 229 |
| 223 bool operator==(const RtpFecParameters& o) const { | 230 bool operator==(const RtpFecParameters& o) const { |
| 224 return ssrc == o.ssrc && mechanism == o.mechanism; | 231 return ssrc == o.ssrc && mechanism == o.mechanism; |
| 225 } | 232 } |
| 226 bool operator!=(const RtpFecParameters& o) const { return !(*this == o); } | 233 bool operator!=(const RtpFecParameters& o) const { return !(*this == o); } |
| 227 }; | 234 }; |
| 228 | 235 |
| 229 struct RtpRtxParameters { | 236 struct RtpRtxParameters { |
| 230 // If unset, a value is chosen by the implementation. | 237 // If unset, a value is chosen by the implementation. |
| 238 // Works just like RtpEncodingParameters::ssrc. |
| 231 rtc::Optional<uint32_t> ssrc; | 239 rtc::Optional<uint32_t> ssrc; |
| 232 | 240 |
| 241 // Constructors for convenience. |
| 242 RtpRtxParameters() = default; |
| 243 explicit RtpRtxParameters(uint32_t ssrc) : ssrc(ssrc) {} |
| 244 |
| 233 bool operator==(const RtpRtxParameters& o) const { return ssrc == o.ssrc; } | 245 bool operator==(const RtpRtxParameters& o) const { return ssrc == o.ssrc; } |
| 234 bool operator!=(const RtpRtxParameters& o) const { return !(*this == o); } | 246 bool operator!=(const RtpRtxParameters& o) const { return !(*this == o); } |
| 235 }; | 247 }; |
| 236 | 248 |
| 237 struct RtpEncodingParameters { | 249 struct RtpEncodingParameters { |
| 238 // If unset, a value is chosen by the implementation. | 250 // If unset, a value is chosen by the implementation. |
| 251 // |
| 252 // Note that the chosen value is NOT returned by GetParameters, because it |
| 253 // may change due to an SSRC conflict, in which case the conflict is handled |
| 254 // internally without any event. Another way of looking at this is that an |
| 255 // unset SSRC acts as a "wildcard" SSRC. |
| 239 rtc::Optional<uint32_t> ssrc; | 256 rtc::Optional<uint32_t> ssrc; |
| 240 | 257 |
| 241 // Can be used to reference a codec in the |codecs| member of the | 258 // Can be used to reference a codec in the |codecs| member of the |
| 242 // RtpParameters that contains this RtpEncodingParameters. If unset, the | 259 // RtpParameters that contains this RtpEncodingParameters. If unset, the |
| 243 // implementation will choose the first possible codec. | 260 // implementation will choose the first possible codec (if a sender), or |
| 244 // TODO(deadbeef): Not implemented. | 261 // prepare to receive any codec (for a receiver). |
| 262 // TODO(deadbeef): Not implemented. Implementation of RtpSender will always |
| 263 // choose the first codec from the list. |
| 245 rtc::Optional<int> codec_payload_type; | 264 rtc::Optional<int> codec_payload_type; |
| 246 | 265 |
| 247 // Specifies the FEC mechanism, if set. | 266 // Specifies the FEC mechanism, if set. |
| 248 // TODO(deadbeef): Not implemented. | 267 // TODO(deadbeef): Not implemented. Current implementation will use whatever |
| 268 // FEC codecs are available, including red+ulpfec. |
| 249 rtc::Optional<RtpFecParameters> fec; | 269 rtc::Optional<RtpFecParameters> fec; |
| 250 | 270 |
| 251 // Specifies the RTX parameters, if set. | 271 // Specifies the RTX parameters, if set. |
| 252 // TODO(deadbeef): Not implemented. | 272 // TODO(deadbeef): Not implemented with PeerConnection senders/receivers. |
| 253 rtc::Optional<RtpRtxParameters> rtx; | 273 rtc::Optional<RtpRtxParameters> rtx; |
| 254 | 274 |
| 255 // Only used for audio. If set, determines whether or not discontinuous | 275 // Only used for audio. If set, determines whether or not discontinuous |
| 256 // transmission will be used, if an available codec supports it. If not | 276 // transmission will be used, if an available codec supports it. If not |
| 257 // set, the implementation default setting will be used. | 277 // set, the implementation default setting will be used. |
| 278 // TODO(deadbeef): Not implemented. Current implementation will use a CN |
| 279 // codec as long as it's present. |
| 258 rtc::Optional<DtxStatus> dtx; | 280 rtc::Optional<DtxStatus> dtx; |
| 259 | 281 |
| 260 // The relative priority of this encoding. | 282 // The relative priority of this encoding. |
| 261 // TODO(deadbeef): Not implemented. | 283 // TODO(deadbeef): Not implemented. |
| 262 rtc::Optional<PriorityType> priority; | 284 rtc::Optional<PriorityType> priority; |
| 263 | 285 |
| 264 // If set, this represents the Transport Independent Application Specific | 286 // If set, this represents the Transport Independent Application Specific |
| 265 // maximum bandwidth defined in RFC3890. If unset, there is no maximum | 287 // maximum bandwidth defined in RFC3890. If unset, there is no maximum |
| 266 // bitrate. | 288 // bitrate. |
| 289 // |
| 267 // Just called "maxBitrate" in ORTC spec. | 290 // Just called "maxBitrate" in ORTC spec. |
| 291 // |
| 292 // TODO(deadbeef): With ORTC RtpSenders, this currently sets the total |
| 293 // bandwidth for the entire bandwidth estimator (audio and video). This is |
| 294 // just always how "b=AS" was handled, but it's not correct and should be |
| 295 // fixed. |
| 268 rtc::Optional<int> max_bitrate_bps; | 296 rtc::Optional<int> max_bitrate_bps; |
| 269 | 297 |
| 270 // TODO(deadbeef): Not implemented. | 298 // TODO(deadbeef): Not implemented. |
| 271 rtc::Optional<int> max_framerate; | 299 rtc::Optional<int> max_framerate; |
| 272 | 300 |
| 273 // For video, scale the resolution down by this factor. | 301 // For video, scale the resolution down by this factor. |
| 274 // TODO(deadbeef): Not implemented. | 302 // TODO(deadbeef): Not implemented. |
| 275 double scale_resolution_down_by = 1.0; | 303 double scale_resolution_down_by = 1.0; |
| 276 | 304 |
| 277 // Scale the framerate down by this factor. | 305 // Scale the framerate down by this factor. |
| 278 // TODO(deadbeef): Not implemented. | 306 // TODO(deadbeef): Not implemented. |
| 279 double scale_framerate_down_by = 1.0; | 307 double scale_framerate_down_by = 1.0; |
| 280 | 308 |
| 281 // For an RtpSender, set to true to cause this encoding to be sent, and false | 309 // For an RtpSender, set to true to cause this encoding to be sent, and false |
| 282 // for it not to be sent. For an RtpReceiver, set to true to cause the | 310 // for it not to be sent. For an RtpReceiver, set to true to cause the |
| 283 // encoding to be decoded, and false for it to be ignored. | 311 // encoding to be decoded, and false for it to be ignored. |
| 284 // TODO(deadbeef): RtpReceiver part is not implemented. | 312 // TODO(deadbeef): Not implemented for PeerConnection RtpReceivers. |
| 285 bool active = true; | 313 bool active = true; |
| 286 | 314 |
| 287 // Value to use for RID RTP header extension. | 315 // Value to use for RID RTP header extension. |
| 288 // Called "encodingId" in ORTC. | 316 // Called "encodingId" in ORTC. |
| 289 // TODO(deadbeef): Not implemented. | 317 // TODO(deadbeef): Not implemented. |
| 290 std::string rid; | 318 std::string rid; |
| 291 | 319 |
| 292 // RIDs of encodings on which this layer depends. | 320 // RIDs of encodings on which this layer depends. |
| 293 // Called "dependencyEncodingIds" in ORTC spec. | 321 // Called "dependencyEncodingIds" in ORTC spec. |
| 294 // TODO(deadbeef): Not implemented. | 322 // TODO(deadbeef): Not implemented. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 313 // Build MIME "type/subtype" string from |name| and |kind|. | 341 // Build MIME "type/subtype" string from |name| and |kind|. |
| 314 std::string mime_type() const { return MediaTypeToString(kind) + "/" + name; } | 342 std::string mime_type() const { return MediaTypeToString(kind) + "/" + name; } |
| 315 | 343 |
| 316 // Used to identify the codec. Equivalent to MIME subtype. | 344 // Used to identify the codec. Equivalent to MIME subtype. |
| 317 std::string name; | 345 std::string name; |
| 318 | 346 |
| 319 // The media type of this codec. Equivalent to MIME top-level type. | 347 // The media type of this codec. Equivalent to MIME top-level type. |
| 320 cricket::MediaType kind = cricket::MEDIA_TYPE_AUDIO; | 348 cricket::MediaType kind = cricket::MEDIA_TYPE_AUDIO; |
| 321 | 349 |
| 322 // Payload type used to identify this codec in RTP packets. | 350 // Payload type used to identify this codec in RTP packets. |
| 323 // This MUST always be present, and must be unique across all codecs using | 351 // This must always be present, and must be unique across all codecs using |
| 324 // the same transport. | 352 // the same transport. |
| 325 int payload_type = 0; | 353 int payload_type = 0; |
| 326 | 354 |
| 327 // If unset, the implementation default is used. | 355 // If unset, the implementation default is used. |
| 328 rtc::Optional<int> clock_rate; | 356 rtc::Optional<int> clock_rate; |
| 329 | 357 |
| 330 // The number of audio channels used. Unset for video codecs. If unset for | 358 // The number of audio channels used. Unset for video codecs. If unset for |
| 331 // audio, the implementation default is used. | 359 // audio, the implementation default is used. |
| 332 // TODO(deadbeef): The "implementation default" part is unimplemented. | 360 // TODO(deadbeef): The "implementation default" part isn't fully implemented. |
| 361 // Only defaults to 1, even though some codecs (such as opus) should really |
| 362 // default to 2. |
| 333 rtc::Optional<int> num_channels; | 363 rtc::Optional<int> num_channels; |
| 334 | 364 |
| 335 // The maximum packetization time to be used by an RtpSender. | 365 // The maximum packetization time to be used by an RtpSender. |
| 336 // If |ptime| is also set, this will be ignored. | 366 // If |ptime| is also set, this will be ignored. |
| 337 // TODO(deadbeef): Not implemented. | 367 // TODO(deadbeef): Not implemented. |
| 338 rtc::Optional<int> max_ptime; | 368 rtc::Optional<int> max_ptime; |
| 339 | 369 |
| 340 // The packetization time to be used by an RtpSender. | 370 // The packetization time to be used by an RtpSender. |
| 341 // If unset, will use any time up to max_ptime. | 371 // If unset, will use any time up to max_ptime. |
| 342 // TODO(deadbeef): Not implemented. | 372 // TODO(deadbeef): Not implemented. |
| 343 rtc::Optional<int> ptime; | 373 rtc::Optional<int> ptime; |
| 344 | 374 |
| 345 // Feedback mechanisms to be used for this codec. | 375 // Feedback mechanisms to be used for this codec. |
| 346 // TODO(deadbeef): Not implemented. | 376 // TODO(deadbeef): Not implemented with PeerConnection senders/receivers. |
| 347 std::vector<RtcpFeedback> rtcp_feedback; | 377 std::vector<RtcpFeedback> rtcp_feedback; |
| 348 | 378 |
| 349 // Codec-specific parameters that must be signaled to the remote party. | 379 // Codec-specific parameters that must be signaled to the remote party. |
| 380 // |
| 350 // Corresponds to "a=fmtp" parameters in SDP. | 381 // Corresponds to "a=fmtp" parameters in SDP. |
| 351 // TODO(deadbeef): Not implemented. | 382 // |
| 383 // Contrary to ORTC, these parameters are named using all lowercase strings. |
| 384 // This helps make the mapping to SDP simpler, if an application is using |
| 385 // SDP. Boolean values are represented by the string "1". |
| 386 // |
| 387 // TODO(deadbeef): Not implemented with PeerConnection senders/receivers. |
| 352 std::unordered_map<std::string, std::string> parameters; | 388 std::unordered_map<std::string, std::string> parameters; |
| 353 | 389 |
| 354 bool operator==(const RtpCodecParameters& o) const { | 390 bool operator==(const RtpCodecParameters& o) const { |
| 355 return name == o.name && kind == o.kind && payload_type == o.payload_type && | 391 return name == o.name && kind == o.kind && payload_type == o.payload_type && |
| 356 clock_rate == o.clock_rate && num_channels == o.num_channels && | 392 clock_rate == o.clock_rate && num_channels == o.num_channels && |
| 357 max_ptime == o.max_ptime && ptime == o.ptime && | 393 max_ptime == o.max_ptime && ptime == o.ptime && |
| 358 rtcp_feedback == o.rtcp_feedback && parameters == o.parameters; | 394 rtcp_feedback == o.rtcp_feedback && parameters == o.parameters; |
| 359 } | 395 } |
| 360 bool operator!=(const RtpCodecParameters& o) const { return !(*this == o); } | 396 bool operator!=(const RtpCodecParameters& o) const { return !(*this == o); } |
| 361 }; | 397 }; |
| 362 | 398 |
| 363 // RtpCapabilities is used to represent the static capabilities of an | 399 // RtpCapabilities is used to represent the static capabilities of an |
| 364 // endpoint. An application can use these capabilities to construct an | 400 // endpoint. An application can use these capabilities to construct an |
| 365 // RtpParameters. | 401 // RtpParameters. |
| 366 struct RtpCapabilities { | 402 struct RtpCapabilities { |
| 367 // Supported codecs. | 403 // Supported codecs. |
| 368 std::vector<RtpCodecCapability> codecs; | 404 std::vector<RtpCodecCapability> codecs; |
| 369 | 405 |
| 370 // Supported RTP header extensions. | 406 // Supported RTP header extensions. |
| 371 std::vector<RtpHeaderExtensionCapability> header_extensions; | 407 std::vector<RtpHeaderExtensionCapability> header_extensions; |
| 372 | 408 |
| 373 // Supported Forward Error Correction (FEC) mechanisms. | 409 // Supported Forward Error Correction (FEC) mechanisms. Note that the RED, |
| 410 // ulpfec and flexfec codecs used by these mechanisms will still appear in |
| 411 // |codecs|. |
| 374 std::vector<FecMechanism> fec; | 412 std::vector<FecMechanism> fec; |
| 375 | 413 |
| 376 bool operator==(const RtpCapabilities& o) const { | 414 bool operator==(const RtpCapabilities& o) const { |
| 377 return codecs == o.codecs && header_extensions == o.header_extensions && | 415 return codecs == o.codecs && header_extensions == o.header_extensions && |
| 378 fec == o.fec; | 416 fec == o.fec; |
| 379 } | 417 } |
| 380 bool operator!=(const RtpCapabilities& o) const { return !(*this == o); } | 418 bool operator!=(const RtpCapabilities& o) const { return !(*this == o); } |
| 381 }; | 419 }; |
| 382 | 420 |
| 383 // Note that unlike in ORTC, an RtcpParameters is not included in | 421 // Note that unlike in ORTC, an RtcpParameters structure is not included in |
| 384 // RtpParameters, because our API will include an additional "RtpTransport" | 422 // RtpParameters, because our API includes an additional "RtpTransport" |
| 385 // abstraction on which RTCP parameters are set. | 423 // abstraction on which RTCP parameters are set. |
| 386 struct RtpParameters { | 424 struct RtpParameters { |
| 387 // Used when calling getParameters/setParameters with a PeerConnection | 425 // Used when calling getParameters/setParameters with a PeerConnection |
| 388 // RtpSender, to ensure that outdated parameters are not unintentionally | 426 // RtpSender, to ensure that outdated parameters are not unintentionally |
| 389 // applied successfully. | 427 // applied successfully. |
| 390 // TODO(deadbeef): Not implemented. | 428 // TODO(deadbeef): Not implemented. |
| 391 std::string transaction_id; | 429 std::string transaction_id; |
| 392 | 430 |
| 393 // Value to use for MID RTP header extension. | 431 // Value to use for MID RTP header extension. |
| 394 // Called "muxId" in ORTC. | 432 // Called "muxId" in ORTC. |
| 395 // TODO(deadbeef): Not implemented. | 433 // TODO(deadbeef): Not implemented. |
| 396 std::string mid; | 434 std::string mid; |
| 397 | 435 |
| 398 std::vector<RtpCodecParameters> codecs; | 436 std::vector<RtpCodecParameters> codecs; |
| 399 | 437 |
| 400 // TODO(deadbeef): Not implemented. | 438 // TODO(deadbeef): Not implemented with PeerConnection senders/receivers. |
| 401 std::vector<RtpHeaderExtensionParameters> header_extensions; | 439 std::vector<RtpHeaderExtensionParameters> header_extensions; |
| 402 | 440 |
| 403 std::vector<RtpEncodingParameters> encodings; | 441 std::vector<RtpEncodingParameters> encodings; |
| 404 | 442 |
| 405 // TODO(deadbeef): Not implemented. | 443 // TODO(deadbeef): Not implemented. |
| 406 DegradationPreference degradation_preference = | 444 DegradationPreference degradation_preference = |
| 407 DegradationPreference::BALANCED; | 445 DegradationPreference::BALANCED; |
| 408 | 446 |
| 409 bool operator==(const RtpParameters& o) const { | 447 bool operator==(const RtpParameters& o) const { |
| 410 return mid == o.mid && codecs == o.codecs && | 448 return mid == o.mid && codecs == o.codecs && |
| 411 header_extensions == o.header_extensions && | 449 header_extensions == o.header_extensions && |
| 412 encodings == o.encodings && | 450 encodings == o.encodings && |
| 413 degradation_preference == o.degradation_preference; | 451 degradation_preference == o.degradation_preference; |
| 414 } | 452 } |
| 415 bool operator!=(const RtpParameters& o) const { return !(*this == o); } | 453 bool operator!=(const RtpParameters& o) const { return !(*this == o); } |
| 416 }; | 454 }; |
| 417 | 455 |
| 418 } // namespace webrtc | 456 } // namespace webrtc |
| 419 | 457 |
| 420 #endif // WEBRTC_API_RTPPARAMETERS_H_ | 458 #endif // WEBRTC_API_RTPPARAMETERS_H_ |
| OLD | NEW |