OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 19 matching lines...) Expand all Loading... |
30 return false; | 30 return false; |
31 const AudioPayload& audio_payload = payload.typeSpecific.Audio; | 31 const AudioPayload& audio_payload = payload.typeSpecific.Audio; |
32 const uint32_t rate = std::max(0, audio_codec.rate); | 32 const uint32_t rate = std::max(0, audio_codec.rate); |
33 return audio_payload.frequency == static_cast<uint32_t>(audio_codec.plfreq) && | 33 return audio_payload.frequency == static_cast<uint32_t>(audio_codec.plfreq) && |
34 audio_payload.channels == audio_codec.channels && | 34 audio_payload.channels == audio_codec.channels && |
35 (audio_payload.rate == rate || audio_payload.rate == 0 || rate == 0); | 35 (audio_payload.rate == rate || audio_payload.rate == 0 || rate == 0); |
36 } | 36 } |
37 | 37 |
38 bool PayloadIsCompatible(const RtpUtility::Payload& payload, | 38 bool PayloadIsCompatible(const RtpUtility::Payload& payload, |
39 const VideoCodec& video_codec) { | 39 const VideoCodec& video_codec) { |
40 return !payload.audio && _stricmp(payload.name, video_codec.plName) == 0; | 40 if (payload.audio || _stricmp(payload.name, video_codec.plName) != 0) |
| 41 return false; |
| 42 // For H264, profiles must match as well. |
| 43 if (video_codec.codecType == kVideoCodecH264) { |
| 44 return video_codec.H264().profile == |
| 45 payload.typeSpecific.Video.h264_profile; |
| 46 } |
| 47 return true; |
41 } | 48 } |
42 | 49 |
43 RtpUtility::Payload CreatePayloadType(const CodecInst& audio_codec) { | 50 RtpUtility::Payload CreatePayloadType(const CodecInst& audio_codec) { |
44 RtpUtility::Payload payload; | 51 RtpUtility::Payload payload; |
45 payload.name[RTP_PAYLOAD_NAME_SIZE - 1] = 0; | 52 payload.name[RTP_PAYLOAD_NAME_SIZE - 1] = 0; |
46 strncpy(payload.name, audio_codec.plname, RTP_PAYLOAD_NAME_SIZE - 1); | 53 strncpy(payload.name, audio_codec.plname, RTP_PAYLOAD_NAME_SIZE - 1); |
47 RTC_DCHECK_GE(audio_codec.plfreq, 1000); | 54 RTC_DCHECK_GE(audio_codec.plfreq, 1000); |
48 payload.typeSpecific.Audio.frequency = audio_codec.plfreq; | 55 payload.typeSpecific.Audio.frequency = audio_codec.plfreq; |
49 payload.typeSpecific.Audio.channels = audio_codec.channels; | 56 payload.typeSpecific.Audio.channels = audio_codec.channels; |
50 payload.typeSpecific.Audio.rate = std::max(0, audio_codec.rate); | 57 payload.typeSpecific.Audio.rate = std::max(0, audio_codec.rate); |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 const char* payload_name) const { | 386 const char* payload_name) const { |
380 rtc::CritScope cs(&crit_sect_); | 387 rtc::CritScope cs(&crit_sect_); |
381 for (const auto& it : payload_type_map_) { | 388 for (const auto& it : payload_type_map_) { |
382 if (_stricmp(it.second.name, payload_name) == 0) | 389 if (_stricmp(it.second.name, payload_name) == 0) |
383 return it.first; | 390 return it.first; |
384 } | 391 } |
385 return -1; | 392 return -1; |
386 } | 393 } |
387 | 394 |
388 } // namespace webrtc | 395 } // namespace webrtc |
OLD | NEW |