skvlad | dc1c62c | 2016-03-16 19:07:43 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | #ifndef WEBRTC_API_RTPPARAMETERS_H_ |
| 12 | #define WEBRTC_API_RTPPARAMETERS_H_ |
| 13 | |
Taylor Brandstetter | 0cd086b | 2016-04-20 16:23:10 -0700 | [diff] [blame] | 14 | #include <string> |
skvlad | dc1c62c | 2016-03-16 19:07:43 -0700 | [diff] [blame] | 15 | #include <vector> |
| 16 | |
sakal | 1fd9595 | 2016-06-22 00:46:15 -0700 | [diff] [blame^] | 17 | #include "webrtc/base/optional.h" |
| 18 | |
skvlad | dc1c62c | 2016-03-16 19:07:43 -0700 | [diff] [blame] | 19 | namespace webrtc { |
| 20 | |
| 21 | // These structures are defined as part of the RtpSender interface. |
| 22 | // See http://w3c.github.io/webrtc-pc/#rtcrtpsender-interface for details. |
| 23 | struct RtpEncodingParameters { |
sakal | 1fd9595 | 2016-06-22 00:46:15 -0700 | [diff] [blame^] | 24 | rtc::Optional<uint32_t> ssrc; |
deadbeef | dbe2b87 | 2016-03-22 15:42:00 -0700 | [diff] [blame] | 25 | bool active = true; |
skvlad | dc1c62c | 2016-03-16 19:07:43 -0700 | [diff] [blame] | 26 | int max_bitrate_bps = -1; |
Taylor Brandstetter | 0cd086b | 2016-04-20 16:23:10 -0700 | [diff] [blame] | 27 | |
| 28 | bool operator==(const RtpEncodingParameters& o) const { |
sakal | 1fd9595 | 2016-06-22 00:46:15 -0700 | [diff] [blame^] | 29 | return ssrc == o.ssrc && active == o.active && |
| 30 | max_bitrate_bps == o.max_bitrate_bps; |
Taylor Brandstetter | 0cd086b | 2016-04-20 16:23:10 -0700 | [diff] [blame] | 31 | } |
Taylor Brandstetter | db0cd9e | 2016-05-16 11:40:30 -0700 | [diff] [blame] | 32 | bool operator!=(const RtpEncodingParameters& o) const { |
| 33 | return !(*this == o); |
| 34 | } |
Taylor Brandstetter | 0cd086b | 2016-04-20 16:23:10 -0700 | [diff] [blame] | 35 | }; |
| 36 | |
| 37 | struct RtpCodecParameters { |
| 38 | int payload_type; |
| 39 | std::string mime_type; |
| 40 | int clock_rate; |
| 41 | int channels = 1; |
| 42 | // TODO(deadbeef): Add sdpFmtpLine field. |
| 43 | |
| 44 | bool operator==(const RtpCodecParameters& o) const { |
| 45 | return payload_type == o.payload_type && mime_type == o.mime_type && |
| 46 | clock_rate == o.clock_rate && channels == o.channels; |
| 47 | } |
Taylor Brandstetter | db0cd9e | 2016-05-16 11:40:30 -0700 | [diff] [blame] | 48 | bool operator!=(const RtpCodecParameters& o) const { return !(*this == o); } |
skvlad | dc1c62c | 2016-03-16 19:07:43 -0700 | [diff] [blame] | 49 | }; |
| 50 | |
| 51 | struct RtpParameters { |
| 52 | std::vector<RtpEncodingParameters> encodings; |
Taylor Brandstetter | 0cd086b | 2016-04-20 16:23:10 -0700 | [diff] [blame] | 53 | std::vector<RtpCodecParameters> codecs; |
| 54 | |
| 55 | bool operator==(const RtpParameters& o) const { |
| 56 | return encodings == o.encodings && codecs == o.codecs; |
| 57 | } |
Taylor Brandstetter | db0cd9e | 2016-05-16 11:40:30 -0700 | [diff] [blame] | 58 | bool operator!=(const RtpParameters& o) const { return !(*this == o); } |
skvlad | dc1c62c | 2016-03-16 19:07:43 -0700 | [diff] [blame] | 59 | }; |
| 60 | |
| 61 | } // namespace webrtc |
| 62 | |
| 63 | #endif // WEBRTC_API_RTPPARAMETERS_H_ |