| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2011 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 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1253 } | 1253 } |
| 1254 } else if (media_type == cricket::MEDIA_TYPE_DATA) { | 1254 } else if (media_type == cricket::MEDIA_TYPE_DATA) { |
| 1255 const DataContentDescription* data_desc = | 1255 const DataContentDescription* data_desc = |
| 1256 static_cast<const DataContentDescription*>(media_desc); | 1256 static_cast<const DataContentDescription*>(media_desc); |
| 1257 if (IsDtlsSctp(media_desc->protocol())) { | 1257 if (IsDtlsSctp(media_desc->protocol())) { |
| 1258 fmt.append(" "); | 1258 fmt.append(" "); |
| 1259 | 1259 |
| 1260 for (std::vector<cricket::DataCodec>::const_iterator it = | 1260 for (std::vector<cricket::DataCodec>::const_iterator it = |
| 1261 data_desc->codecs().begin(); | 1261 data_desc->codecs().begin(); |
| 1262 it != data_desc->codecs().end(); ++it) { | 1262 it != data_desc->codecs().end(); ++it) { |
| 1263 if (it->id == cricket::kGoogleSctpDataCodecId && | 1263 if (cricket::CodecNamesEq(it->name, cricket::kGoogleSctpDataCodecName) |
| 1264 it->GetParam(cricket::kCodecParamPort, &sctp_port)) { | 1264 && it->GetParam(cricket::kCodecParamPort, &sctp_port)) { |
| 1265 break; | 1265 break; |
| 1266 } | 1266 } |
| 1267 } | 1267 } |
| 1268 | 1268 |
| 1269 fmt.append(rtc::ToString<int>(sctp_port)); | 1269 fmt.append(rtc::ToString<int>(sctp_port)); |
| 1270 } else { | 1270 } else { |
| 1271 for (std::vector<cricket::DataCodec>::const_iterator it = | 1271 for (std::vector<cricket::DataCodec>::const_iterator it = |
| 1272 data_desc->codecs().begin(); | 1272 data_desc->codecs().begin(); |
| 1273 it != data_desc->codecs().end(); ++it) { | 1273 it != data_desc->codecs().end(); ++it) { |
| 1274 fmt.append(" "); | 1274 fmt.append(" "); |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1644 os << " " << iter->id(); | 1644 os << " " << iter->id(); |
| 1645 if (!iter->param().empty()) { | 1645 if (!iter->param().empty()) { |
| 1646 os << " " << iter->param(); | 1646 os << " " << iter->param(); |
| 1647 } | 1647 } |
| 1648 AddLine(os.str(), message); | 1648 AddLine(os.str(), message); |
| 1649 } | 1649 } |
| 1650 } | 1650 } |
| 1651 | 1651 |
| 1652 bool AddSctpDataCodec(DataContentDescription* media_desc, | 1652 bool AddSctpDataCodec(DataContentDescription* media_desc, |
| 1653 int sctp_port) { | 1653 int sctp_port) { |
| 1654 if (media_desc->HasCodec(cricket::kGoogleSctpDataCodecId)) { | 1654 for (const auto& codec : media_desc->codecs()) { |
| 1655 return ParseFailed("", | 1655 if (cricket::CodecNamesEq(codec.name, cricket::kGoogleSctpDataCodecName)) { |
| 1656 "Can't have multiple sctp port attributes.", | 1656 return ParseFailed("", |
| 1657 NULL); | 1657 "Can't have multiple sctp port attributes.", |
| 1658 NULL); |
| 1659 } |
| 1658 } | 1660 } |
| 1659 // Add the SCTP Port number as a pseudo-codec "port" parameter | 1661 // Add the SCTP Port number as a pseudo-codec "port" parameter |
| 1660 cricket::DataCodec codec_port(cricket::kGoogleSctpDataCodecId, | 1662 cricket::DataCodec codec_port(cricket::kGoogleSctpDataCodecPlType, |
| 1661 cricket::kGoogleSctpDataCodecName); | 1663 cricket::kGoogleSctpDataCodecName); |
| 1662 codec_port.SetParam(cricket::kCodecParamPort, sctp_port); | 1664 codec_port.SetParam(cricket::kCodecParamPort, sctp_port); |
| 1663 LOG(INFO) << "AddSctpDataCodec: Got SCTP Port Number " | 1665 LOG(INFO) << "AddSctpDataCodec: Got SCTP Port Number " |
| 1664 << sctp_port; | 1666 << sctp_port; |
| 1665 media_desc->AddCodec(codec_port); | 1667 media_desc->AddCodec(codec_port); |
| 1666 return true; | 1668 return true; |
| 1667 } | 1669 } |
| 1668 | 1670 |
| 1669 bool GetMinValue(const std::vector<int>& values, int* value) { | 1671 bool GetMinValue(const std::vector<int>& values, int* value) { |
| 1670 if (values.empty()) { | 1672 if (values.empty()) { |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2178 { "DVI4", 22050, 1 }, | 2180 { "DVI4", 22050, 1 }, |
| 2179 { "G729", 8000, 1 }, | 2181 { "G729", 8000, 1 }, |
| 2180 }; | 2182 }; |
| 2181 | 2183 |
| 2182 void MaybeCreateStaticPayloadAudioCodecs( | 2184 void MaybeCreateStaticPayloadAudioCodecs( |
| 2183 const std::vector<int>& fmts, AudioContentDescription* media_desc) { | 2185 const std::vector<int>& fmts, AudioContentDescription* media_desc) { |
| 2184 if (!media_desc) { | 2186 if (!media_desc) { |
| 2185 return; | 2187 return; |
| 2186 } | 2188 } |
| 2187 RTC_DCHECK(media_desc->codecs().empty()); | 2189 RTC_DCHECK(media_desc->codecs().empty()); |
| 2188 std::vector<int>::const_iterator it = fmts.begin(); | 2190 for (int payload_type : fmts) { |
| 2189 for (; it != fmts.end(); ++it) { | |
| 2190 int payload_type = *it; | |
| 2191 if (!media_desc->HasCodec(payload_type) && | 2191 if (!media_desc->HasCodec(payload_type) && |
| 2192 payload_type >= 0 && | 2192 payload_type >= 0 && |
| 2193 static_cast<uint32_t>(payload_type) < | 2193 static_cast<uint32_t>(payload_type) < |
| 2194 arraysize(kStaticPayloadAudioCodecs)) { | 2194 arraysize(kStaticPayloadAudioCodecs)) { |
| 2195 std::string encoding_name = kStaticPayloadAudioCodecs[payload_type].name; | 2195 std::string encoding_name = kStaticPayloadAudioCodecs[payload_type].name; |
| 2196 int clock_rate = kStaticPayloadAudioCodecs[payload_type].clockrate; | 2196 int clock_rate = kStaticPayloadAudioCodecs[payload_type].clockrate; |
| 2197 size_t channels = kStaticPayloadAudioCodecs[payload_type].channels; | 2197 size_t channels = kStaticPayloadAudioCodecs[payload_type].channels; |
| 2198 media_desc->AddCodec(cricket::AudioCodec(payload_type, encoding_name, | 2198 media_desc->AddCodec(cricket::AudioCodec(payload_type, encoding_name, |
| 2199 clock_rate, 0, channels)); | 2199 clock_rate, 0, channels)); |
| 2200 } | 2200 } |
| (...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3182 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( | 3182 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( |
| 3183 media_desc, payload_type, feedback_param); | 3183 media_desc, payload_type, feedback_param); |
| 3184 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { | 3184 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { |
| 3185 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( | 3185 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( |
| 3186 media_desc, payload_type, feedback_param); | 3186 media_desc, payload_type, feedback_param); |
| 3187 } | 3187 } |
| 3188 return true; | 3188 return true; |
| 3189 } | 3189 } |
| 3190 | 3190 |
| 3191 } // namespace webrtc | 3191 } // namespace webrtc |
| OLD | NEW |