OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 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 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 return os.str(); | 203 return os.str(); |
204 } | 204 } |
205 | 205 |
206 std::string VideoCodec::ToString() const { | 206 std::string VideoCodec::ToString() const { |
207 std::ostringstream os; | 207 std::ostringstream os; |
208 os << "VideoCodec[" << id << ":" << name << "]"; | 208 os << "VideoCodec[" << id << ":" << name << "]"; |
209 return os.str(); | 209 return os.str(); |
210 } | 210 } |
211 | 211 |
212 VideoCodec::VideoCodec(int id, const std::string& name) | 212 VideoCodec::VideoCodec(int id, const std::string& name) |
213 : Codec(id, name, kVideoCodecClockrate) { | 213 : Codec(id, name, kVideoCodecClockrate) {} |
214 SetDefaultParameters(); | |
215 } | |
216 | 214 |
217 VideoCodec::VideoCodec(const std::string& name) : VideoCodec(0 /* id */, name) { | 215 VideoCodec::VideoCodec(const std::string& name) |
218 SetDefaultParameters(); | 216 : VideoCodec(0 /* id */, name) {} |
219 } | |
220 | 217 |
221 VideoCodec::VideoCodec() : Codec() { | 218 VideoCodec::VideoCodec() : Codec() { |
222 clockrate = kVideoCodecClockrate; | 219 clockrate = kVideoCodecClockrate; |
223 } | 220 } |
224 | 221 |
225 VideoCodec::VideoCodec(const VideoCodec& c) = default; | 222 VideoCodec::VideoCodec(const VideoCodec& c) = default; |
226 VideoCodec::VideoCodec(VideoCodec&& c) = default; | 223 VideoCodec::VideoCodec(VideoCodec&& c) = default; |
227 VideoCodec& VideoCodec::operator=(const VideoCodec& c) = default; | 224 VideoCodec& VideoCodec::operator=(const VideoCodec& c) = default; |
228 VideoCodec& VideoCodec::operator=(VideoCodec&& c) = default; | 225 VideoCodec& VideoCodec::operator=(VideoCodec&& c) = default; |
229 | 226 |
230 void VideoCodec::SetDefaultParameters() { | |
231 if (_stricmp(kH264CodecName, name.c_str()) == 0) { | |
232 // This default is set for all H.264 codecs created because | |
233 // that was the default before packetization mode support was added. | |
234 // TODO(hta): Move this to the places that create VideoCodecs from | |
235 // SDP or from knowledge of implementation capabilities. | |
236 SetParam(kH264FmtpPacketizationMode, "1"); | |
237 } | |
238 } | |
239 | |
240 bool VideoCodec::operator==(const VideoCodec& c) const { | 227 bool VideoCodec::operator==(const VideoCodec& c) const { |
241 return Codec::operator==(c); | 228 return Codec::operator==(c); |
242 } | 229 } |
243 | 230 |
244 bool VideoCodec::Matches(const VideoCodec& other) const { | 231 bool VideoCodec::Matches(const VideoCodec& other) const { |
245 if (!Codec::Matches(other)) | 232 if (!Codec::Matches(other)) |
246 return false; | 233 return false; |
247 if (CodecNamesEq(name.c_str(), kH264CodecName)) | 234 if (CodecNamesEq(name.c_str(), kH264CodecName)) |
248 return IsSameH264Profile(params, other.params); | 235 return IsSameH264Profile(params, other.params); |
249 return true; | 236 return true; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 if (CodecNamesEq(codec.name.c_str(), kH264CodecName) && | 333 if (CodecNamesEq(codec.name.c_str(), kH264CodecName) && |
347 !IsSameH264Profile(codec.params, supported_codec.params)) { | 334 !IsSameH264Profile(codec.params, supported_codec.params)) { |
348 continue; | 335 continue; |
349 } | 336 } |
350 return &supported_codec; | 337 return &supported_codec; |
351 } | 338 } |
352 return nullptr; | 339 return nullptr; |
353 } | 340 } |
354 | 341 |
355 } // namespace cricket | 342 } // namespace cricket |
OLD | NEW |