OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 struct DataCodec : public Codec { | 202 struct DataCodec : public Codec { |
203 DataCodec(int id, const std::string& name, int preference); | 203 DataCodec(int id, const std::string& name, int preference); |
204 DataCodec(); | 204 DataCodec(); |
205 DataCodec(const DataCodec& c); | 205 DataCodec(const DataCodec& c); |
206 | 206 |
207 DataCodec& operator=(const DataCodec& c); | 207 DataCodec& operator=(const DataCodec& c); |
208 | 208 |
209 std::string ToString() const; | 209 std::string ToString() const; |
210 }; | 210 }; |
211 | 211 |
212 struct VideoEncoderConfig { | |
213 static const int kDefaultMaxThreads = -1; | |
214 static const int kDefaultCpuProfile = -1; | |
215 | |
216 VideoEncoderConfig() | |
217 : max_codec(), | |
218 num_threads(kDefaultMaxThreads), | |
219 cpu_profile(kDefaultCpuProfile) { | |
220 } | |
221 | |
222 VideoEncoderConfig(const VideoCodec& c) | |
223 : max_codec(c), | |
224 num_threads(kDefaultMaxThreads), | |
225 cpu_profile(kDefaultCpuProfile) { | |
226 } | |
227 | |
228 VideoEncoderConfig(const VideoCodec& c, int t, int p) | |
229 : max_codec(c), | |
230 num_threads(t), | |
231 cpu_profile(p) { | |
232 } | |
233 | |
234 VideoEncoderConfig& operator=(const VideoEncoderConfig& config) { | |
235 max_codec = config.max_codec; | |
236 num_threads = config.num_threads; | |
237 cpu_profile = config.cpu_profile; | |
238 return *this; | |
239 } | |
240 | |
241 bool operator==(const VideoEncoderConfig& config) const { | |
242 return max_codec == config.max_codec && | |
243 num_threads == config.num_threads && | |
244 cpu_profile == config.cpu_profile; | |
245 } | |
246 | |
247 bool operator!=(const VideoEncoderConfig& config) const { | |
248 return !(*this == config); | |
249 } | |
250 | |
251 VideoCodec max_codec; | |
252 int num_threads; | |
253 int cpu_profile; | |
254 }; | |
255 | |
256 // Get the codec setting associated with |payload_type|. If there | 212 // Get the codec setting associated with |payload_type|. If there |
257 // is no codec associated with that payload type it returns false. | 213 // is no codec associated with that payload type it returns false. |
258 template <class Codec> | 214 template <class Codec> |
259 bool FindCodecById(const std::vector<Codec>& codecs, | 215 bool FindCodecById(const std::vector<Codec>& codecs, |
260 int payload_type, | 216 int payload_type, |
261 Codec* codec_out) { | 217 Codec* codec_out) { |
262 for (const auto& codec : codecs) { | 218 for (const auto& codec : codecs) { |
263 if (codec.id == payload_type) { | 219 if (codec.id == payload_type) { |
264 *codec_out = codec; | 220 *codec_out = codec; |
265 return true; | 221 return true; |
266 } | 222 } |
267 } | 223 } |
268 return false; | 224 return false; |
269 } | 225 } |
270 | 226 |
271 bool CodecNamesEq(const std::string& name1, const std::string& name2); | 227 bool CodecNamesEq(const std::string& name1, const std::string& name2); |
272 bool HasNack(const VideoCodec& codec); | 228 bool HasNack(const VideoCodec& codec); |
273 bool HasRemb(const VideoCodec& codec); | 229 bool HasRemb(const VideoCodec& codec); |
274 bool HasTransportCc(const VideoCodec& codec); | 230 bool HasTransportCc(const VideoCodec& codec); |
275 | 231 |
276 } // namespace cricket | 232 } // namespace cricket |
277 | 233 |
278 #endif // TALK_MEDIA_BASE_CODEC_H_ | 234 #endif // TALK_MEDIA_BASE_CODEC_H_ |
OLD | NEW |