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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
198 // address to IP6 ::. | 198 // address to IP6 ::. |
199 // TODO(perkj): FF can not parse IP6 ::. See http://crbug/430333 | 199 // TODO(perkj): FF can not parse IP6 ::. See http://crbug/430333 |
200 // Use IPV4 per default. | 200 // Use IPV4 per default. |
201 static const char kDummyAddress[] = "0.0.0.0"; | 201 static const char kDummyAddress[] = "0.0.0.0"; |
202 static const char kDummyPort[] = "9"; | 202 static const char kDummyPort[] = "9"; |
203 // RFC 3556 | 203 // RFC 3556 |
204 static const char kApplicationSpecificMaximum[] = "AS"; | 204 static const char kApplicationSpecificMaximum[] = "AS"; |
205 | 205 |
206 static const int kDefaultVideoClockrate = 90000; | 206 static const int kDefaultVideoClockrate = 90000; |
207 | 207 |
208 // ISAC special-case. | |
209 static const char kIsacCodecName[] = "ISAC"; // From webrtcvoiceengine.cc | |
210 static const int kIsacWbDefaultRate = 32000; // From acm_common_defs.h | |
211 static const int kIsacSwbDefaultRate = 56000; // From acm_common_defs.h | |
212 | |
213 static const char kDefaultSctpmapProtocol[] = "webrtc-datachannel"; | 208 static const char kDefaultSctpmapProtocol[] = "webrtc-datachannel"; |
214 | 209 |
215 // RTP payload type is in the 0-127 range. Use -1 to indicate "all" payload | 210 // RTP payload type is in the 0-127 range. Use -1 to indicate "all" payload |
216 // types. | 211 // types. |
217 const int kWildcardPayloadType = -1; | 212 const int kWildcardPayloadType = -1; |
218 | 213 |
219 struct SsrcInfo { | 214 struct SsrcInfo { |
220 uint32_t ssrc_id; | 215 uint32_t ssrc_id; |
221 std::string cname; | 216 std::string cname; |
222 std::string stream_id; | 217 std::string stream_id; |
(...skipping 2862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3085 // For audio streams, <encoding parameters> indicates the number | 3080 // For audio streams, <encoding parameters> indicates the number |
3086 // of audio channels. This parameter is OPTIONAL and may be | 3081 // of audio channels. This parameter is OPTIONAL and may be |
3087 // omitted if the number of channels is one, provided that no | 3082 // omitted if the number of channels is one, provided that no |
3088 // additional parameters are needed. | 3083 // additional parameters are needed. |
3089 size_t channels = 1; | 3084 size_t channels = 1; |
3090 if (codec_params.size() == 3) { | 3085 if (codec_params.size() == 3) { |
3091 if (!GetValueFromString(line, codec_params[2], &channels, error)) { | 3086 if (!GetValueFromString(line, codec_params[2], &channels, error)) { |
3092 return false; | 3087 return false; |
3093 } | 3088 } |
3094 } | 3089 } |
3095 int bitrate = 0; | |
3096 // The default behavior for ISAC (bitrate == 0) in webrtcvoiceengine.cc | |
3097 // (specifically FindWebRtcCodec) is bandwidth-adaptive variable bitrate. | |
3098 // The bandwidth adaptation doesn't always work well, so this code | |
3099 // sets a fixed target bitrate instead. | |
3100 if (_stricmp(encoding_name.c_str(), kIsacCodecName) == 0) { | |
3101 if (clock_rate <= 16000) { | |
3102 bitrate = kIsacWbDefaultRate; | |
3103 } else { | |
3104 bitrate = kIsacSwbDefaultRate; | |
3105 } | |
3106 } | |
kwiberg-webrtc
2017/01/23 15:18:11
Hmm. I don't quite see how this piece of code didn
ossu
2017/01/23 15:33:18
It did have an effect. It worked around the block
| |
3107 AudioContentDescription* audio_desc = | 3090 AudioContentDescription* audio_desc = |
3108 static_cast<AudioContentDescription*>(media_desc); | 3091 static_cast<AudioContentDescription*>(media_desc); |
3109 UpdateCodec(payload_type, encoding_name, clock_rate, bitrate, channels, | 3092 UpdateCodec(payload_type, encoding_name, clock_rate, 0, channels, |
3110 audio_desc); | 3093 audio_desc); |
3111 } else if (media_type == cricket::MEDIA_TYPE_DATA) { | 3094 } else if (media_type == cricket::MEDIA_TYPE_DATA) { |
3112 DataContentDescription* data_desc = | 3095 DataContentDescription* data_desc = |
3113 static_cast<DataContentDescription*>(media_desc); | 3096 static_cast<DataContentDescription*>(media_desc); |
3114 data_desc->AddCodec(cricket::DataCodec(payload_type, encoding_name)); | 3097 data_desc->AddCodec(cricket::DataCodec(payload_type, encoding_name)); |
3115 } | 3098 } |
3116 return true; | 3099 return true; |
3117 } | 3100 } |
3118 | 3101 |
3119 bool ParseFmtpParam(const std::string& line, std::string* parameter, | 3102 bool ParseFmtpParam(const std::string& line, std::string* parameter, |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3225 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( | 3208 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( |
3226 media_desc, payload_type, feedback_param); | 3209 media_desc, payload_type, feedback_param); |
3227 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { | 3210 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { |
3228 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( | 3211 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( |
3229 media_desc, payload_type, feedback_param); | 3212 media_desc, payload_type, feedback_param); |
3230 } | 3213 } |
3231 return true; | 3214 return true; |
3232 } | 3215 } |
3233 | 3216 |
3234 } // namespace webrtc | 3217 } // namespace webrtc |
OLD | NEW |