blob: 13704dc15b0e6d41d5b532d7dcc80bae3cc2c996 [file] [log] [blame]
skvladdc1c62c2016-03-16 19:07:43 -07001/*
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 Brandstetter0cd086b2016-04-20 16:23:10 -070014#include <string>
skvladdc1c62c2016-03-16 19:07:43 -070015#include <vector>
16
sakal1fd95952016-06-22 00:46:15 -070017#include "webrtc/base/optional.h"
18
skvladdc1c62c2016-03-16 19:07:43 -070019namespace 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.
23struct RtpEncodingParameters {
sakal1fd95952016-06-22 00:46:15 -070024 rtc::Optional<uint32_t> ssrc;
deadbeefdbe2b872016-03-22 15:42:00 -070025 bool active = true;
skvladdc1c62c2016-03-16 19:07:43 -070026 int max_bitrate_bps = -1;
Taylor Brandstetter0cd086b2016-04-20 16:23:10 -070027
28 bool operator==(const RtpEncodingParameters& o) const {
sakal1fd95952016-06-22 00:46:15 -070029 return ssrc == o.ssrc && active == o.active &&
30 max_bitrate_bps == o.max_bitrate_bps;
Taylor Brandstetter0cd086b2016-04-20 16:23:10 -070031 }
Taylor Brandstetterdb0cd9e2016-05-16 11:40:30 -070032 bool operator!=(const RtpEncodingParameters& o) const {
33 return !(*this == o);
34 }
Taylor Brandstetter0cd086b2016-04-20 16:23:10 -070035};
36
37struct 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 Brandstetterdb0cd9e2016-05-16 11:40:30 -070048 bool operator!=(const RtpCodecParameters& o) const { return !(*this == o); }
skvladdc1c62c2016-03-16 19:07:43 -070049};
50
51struct RtpParameters {
52 std::vector<RtpEncodingParameters> encodings;
Taylor Brandstetter0cd086b2016-04-20 16:23:10 -070053 std::vector<RtpCodecParameters> codecs;
54
55 bool operator==(const RtpParameters& o) const {
56 return encodings == o.encodings && codecs == o.codecs;
57 }
Taylor Brandstetterdb0cd9e2016-05-16 11:40:30 -070058 bool operator!=(const RtpParameters& o) const { return !(*this == o); }
skvladdc1c62c2016-03-16 19:07:43 -070059};
60
61} // namespace webrtc
62
63#endif // WEBRTC_API_RTPPARAMETERS_H_