Intel® Collaboration Suite for WebRTC  version 4.3.1
Open WebRTC Toolkit (OWT) Client SDK for Windows*
commontypes.h
1 // Copyright (C) <2018> Intel Corporation
2 //
3 // SPDX-License-Identifier: Apache-2.0
4 #ifndef OWT_BASE_COMMONTYPES_H_
5 #define OWT_BASE_COMMONTYPES_H_
6 #include <string>
7 #include <vector>
8 #include <unordered_map>
9 namespace owt {
10 namespace base {
12 enum class AudioCodec : int {
13  kPcmu = 1,
14  kPcma,
15  kOpus,
16  kG722,
17  kIsac,
18  kIlbc,
19  kAac,
20  kAc3,
21  kAsao,
22  kUnknown
23 };
25 enum class VideoCodec : int {
26  kVp8 = 1,
27  kVp9,
28  kH264,
29  kH265,
30  kUnknown
31 };
33 enum class TrackKind : int{
34  kAudio = 1,
35  kVideo,
36  kAudioAndVideo,
37  kUnknown
38 };
40 struct Resolution {
42  explicit Resolution(): width(0), height(0) {}
44  Resolution(unsigned long w, unsigned long h) : width(w), height(h) {}
45  bool operator==(const Resolution& rhs) const {
46  return this->width == rhs.width && this->height == rhs.height;
47  }
48  unsigned long width;
49  unsigned long height;
50 };
55  : name(AudioCodec::kUnknown), channel_count(0), clock_rate(0) {}
57  AudioCodecParameters(const AudioCodec& codec_name,
58  unsigned long channel_count,
59  unsigned long clock_rate)
60  : name(codec_name),
61  channel_count(channel_count),
62  clock_rate(clock_rate) {}
63  AudioCodec name;
64  unsigned long channel_count;
65  unsigned long clock_rate;
66 };
67 
70  // Currently this is implemented for the entire rtp sender by using
71  // the value of the first encoding parameter..
72  int max_bitrate_bps = 0;
73 
74  // Specifies the maximum framerate in fps for video. ignored by audio
75  // Not supported for screencast.
76  int max_framerate = 0;
77 
78  // For video, scale the resolution down by this factor. ignored by audio
79  double scale_resolution_down_by = 1.0;
80 
81  // For an RtpSender, set to true to cause this encoding to be encoded and
82  // sent, and false for it not to be encoded and sent. This allows control
83  // across multiple encodings of a sender for turning simulcast layers on and
84  // off.
85  // TODO(webrtc.bugs.org/8807): Updating this parameter will trigger an encoder
86  // reset, but this isn't necessarily required.
87  bool active = true;
88 
89  // Value to use for RID RTP header extension.
90  // Called "encodingId" in ORTC.
91  std::string rid;
92 };
93 
96  explicit AudioEncodingParameters() : codec(), max_bitrate(0) {}
98  unsigned long bitrate_bps)
99  : codec(codec_param), max_bitrate(bitrate_bps) {}
100  AudioEncodingParameters(const AudioEncodingParameters& aep) = default;
101  AudioEncodingParameters& operator=(const AudioEncodingParameters&) = default;
102  std::vector<RtpEncodingParameters> rtp_encoding_parameters;
103  AudioCodecParameters codec;
104  unsigned long max_bitrate;
105 };
109  explicit VideoCodecParameters() : name(VideoCodec::kUnknown), profile("") {}
111  VideoCodecParameters(const VideoCodec& codec, const std::string& profile)
112  : name(codec), profile(profile) {}
113  VideoCodec name;
114  std::string profile;
115 };
116 
120  explicit VideoEncodingParameters()
121  : codec(), max_bitrate(0), hardware_accelerated(false) {}
124  unsigned long bitrate_bps,
125  bool hw)
126  : codec(codec_param),
127  max_bitrate(bitrate_bps),
128  hardware_accelerated(hw) {}
129  VideoEncodingParameters(const VideoEncodingParameters& aep) = default;
130  VideoEncodingParameters& operator=(const VideoEncodingParameters&) = default;
131  VideoCodecParameters codec;
132  std::vector<RtpEncodingParameters> rtp_encoding_parameters;
133  unsigned long max_bitrate;
134  bool hardware_accelerated;
135 };
139 enum class AudioSourceInfo : int {
140  kMic = 1,
141  kScreenCast,
142  kFile,
143  kMixed,
144  kUnknown
145 };
149 enum class VideoSourceInfo : int {
150  kCamera = 1,
151  kScreenCast,
152  kFile,
153  kMixed,
154  kUnknown
155 };
158  explicit StreamSourceInfo()
159  : audio(AudioSourceInfo::kUnknown),
160  video(VideoSourceInfo::kUnknown) {}
161  StreamSourceInfo(AudioSourceInfo audio_source, VideoSourceInfo video_source)
162  : audio(audio_source),
163  video(video_source) {}
165  AudioSourceInfo audio;
167  VideoSourceInfo video;
168 };
170  template <typename T>
171  std::size_t operator()(T t) const {
172  return static_cast<std::size_t>(t);
173  }
174 };
175 } // namespace base
176 } // namespace owt
177 #endif // OWT_BASE_COMMONTYPES_H_
Audio encoding parameters.
Definition: commontypes.h:95
AudioSourceInfo audio
The audio source info of the stream.
Definition: commontypes.h:165
Definition: commontypes.h:169
RTP endoding settings for a stream.
Definition: commontypes.h:69
VideoCodecParameters()
Construct an instance of VideoCodecParameters with default parameters.
Definition: commontypes.h:109
AudioCodecParameters(const AudioCodec &codec_name, unsigned long channel_count, unsigned long clock_rate)
Construct an instance of AudioCodecParameters with codec name/channel count and clock rate...
Definition: commontypes.h:57
Definition: audioplayerinterface.h:8
AudioCodecParameters()
Construct an instance of AudioCodecParameters with default param.
Definition: commontypes.h:54
VideoSourceInfo video
The video source info of the stream.
Definition: commontypes.h:167
Resolution(unsigned long w, unsigned long h)
Construct an instance with specify width and height.
Definition: commontypes.h:44
Video codec parameters for a video track.
Definition: commontypes.h:107
Definition: commontypes.h:119
Audio codec parameters for an audio track.
Definition: commontypes.h:52
Stream source.
Definition: commontypes.h:157
This class represents a resolution value.
Definition: commontypes.h:40
VideoEncodingParameters(const VideoCodecParameters &codec_param, unsigned long bitrate_bps, bool hw)
Construct an instance of VideoEncodingParameters.
Definition: commontypes.h:123
VideoCodecParameters(const VideoCodec &codec, const std::string &profile)
Construct an instance of VideoCodecParameter with codec name and profile.
Definition: commontypes.h:111
Resolution()
Construct an instance with width and height equal to 0.
Definition: commontypes.h:42