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 } |
214 | 216 |
215 VideoCodec::VideoCodec(const std::string& name) | 217 VideoCodec::VideoCodec(const std::string& name) : VideoCodec(0 /* id */, name) { |
216 : VideoCodec(0 /* id */, name) {} | 218 SetDefaultParameters(); |
| 219 } |
217 | 220 |
218 VideoCodec::VideoCodec() : Codec() { | 221 VideoCodec::VideoCodec() : Codec() { |
219 clockrate = kVideoCodecClockrate; | 222 clockrate = kVideoCodecClockrate; |
220 } | 223 } |
221 | 224 |
222 VideoCodec::VideoCodec(const VideoCodec& c) = default; | 225 VideoCodec::VideoCodec(const VideoCodec& c) = default; |
223 VideoCodec::VideoCodec(VideoCodec&& c) = default; | 226 VideoCodec::VideoCodec(VideoCodec&& c) = default; |
224 VideoCodec& VideoCodec::operator=(const VideoCodec& c) = default; | 227 VideoCodec& VideoCodec::operator=(const VideoCodec& c) = default; |
225 VideoCodec& VideoCodec::operator=(VideoCodec&& c) = default; | 228 VideoCodec& VideoCodec::operator=(VideoCodec&& c) = default; |
226 | 229 |
| 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 |
227 bool VideoCodec::operator==(const VideoCodec& c) const { | 240 bool VideoCodec::operator==(const VideoCodec& c) const { |
228 return Codec::operator==(c); | 241 return Codec::operator==(c); |
229 } | 242 } |
230 | 243 |
231 bool VideoCodec::Matches(const VideoCodec& other) const { | 244 bool VideoCodec::Matches(const VideoCodec& other) const { |
232 if (!Codec::Matches(other)) | 245 if (!Codec::Matches(other)) |
233 return false; | 246 return false; |
234 if (CodecNamesEq(name.c_str(), kH264CodecName)) | 247 if (CodecNamesEq(name.c_str(), kH264CodecName)) |
235 return IsSameH264Profile(params, other.params); | 248 return IsSameH264Profile(params, other.params); |
236 return true; | 249 return true; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 if (CodecNamesEq(codec.name.c_str(), kH264CodecName) && | 346 if (CodecNamesEq(codec.name.c_str(), kH264CodecName) && |
334 !IsSameH264Profile(codec.params, supported_codec.params)) { | 347 !IsSameH264Profile(codec.params, supported_codec.params)) { |
335 continue; | 348 continue; |
336 } | 349 } |
337 return &supported_codec; | 350 return &supported_codec; |
338 } | 351 } |
339 return nullptr; | 352 return nullptr; |
340 } | 353 } |
341 | 354 |
342 } // namespace cricket | 355 } // namespace cricket |
OLD | NEW |