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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 << bitrate; | 248 << bitrate; |
249 } | 249 } |
250 return bitrate; | 250 return bitrate; |
251 } | 251 } |
252 | 252 |
253 void GetOpusConfig(const AudioCodec& codec, | 253 void GetOpusConfig(const AudioCodec& codec, |
254 webrtc::CodecInst* voe_codec, | 254 webrtc::CodecInst* voe_codec, |
255 bool* enable_codec_fec, | 255 bool* enable_codec_fec, |
256 int* max_playback_rate, | 256 int* max_playback_rate, |
257 bool* enable_codec_dtx, | 257 bool* enable_codec_dtx, |
| 258 bool* enable_codec_cbr, |
258 int* min_ptime_ms, | 259 int* min_ptime_ms, |
259 int* max_ptime_ms) { | 260 int* max_ptime_ms) { |
260 *enable_codec_fec = IsCodecFeatureEnabled(codec, kCodecParamUseInbandFec); | 261 *enable_codec_fec = IsCodecFeatureEnabled(codec, kCodecParamUseInbandFec); |
261 *enable_codec_dtx = IsCodecFeatureEnabled(codec, kCodecParamUseDtx); | 262 *enable_codec_dtx = IsCodecFeatureEnabled(codec, kCodecParamUseDtx); |
| 263 *enable_codec_cbr = IsCodecFeatureEnabled(codec, kCodecParamUseCbr); |
262 *max_playback_rate = GetCodecFeatureInt(codec, kCodecParamMaxPlaybackRate, | 264 *max_playback_rate = GetCodecFeatureInt(codec, kCodecParamMaxPlaybackRate, |
263 kOpusDefaultMaxPlaybackRate); | 265 kOpusDefaultMaxPlaybackRate); |
264 *max_ptime_ms = | 266 *max_ptime_ms = |
265 GetCodecFeatureInt(codec, kCodecParamMaxPTime, kOpusDefaultMaxPTime); | 267 GetCodecFeatureInt(codec, kCodecParamMaxPTime, kOpusDefaultMaxPTime); |
266 *min_ptime_ms = | 268 *min_ptime_ms = |
267 GetCodecFeatureInt(codec, kCodecParamMinPTime, kOpusDefaultMinPTime); | 269 GetCodecFeatureInt(codec, kCodecParamMinPTime, kOpusDefaultMinPTime); |
268 if (*max_ptime_ms < *min_ptime_ms) { | 270 if (*max_ptime_ms < *min_ptime_ms) { |
269 // If min ptime or max ptime defined by codec parameter is wrong, we use | 271 // If min ptime or max ptime defined by codec parameter is wrong, we use |
270 // the default values. | 272 // the default values. |
271 *max_ptime_ms = kOpusDefaultMaxPTime; | 273 *max_ptime_ms = kOpusDefaultMaxPTime; |
(...skipping 1695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1967 return false; | 1969 return false; |
1968 } | 1970 } |
1969 | 1971 |
1970 send_codec_spec.transport_cc_enabled = HasTransportCc(*codec); | 1972 send_codec_spec.transport_cc_enabled = HasTransportCc(*codec); |
1971 send_codec_spec.nack_enabled = HasNack(*codec); | 1973 send_codec_spec.nack_enabled = HasNack(*codec); |
1972 bitrate_config_ = GetBitrateConfigForCodec(*codec); | 1974 bitrate_config_ = GetBitrateConfigForCodec(*codec); |
1973 | 1975 |
1974 // For Opus as the send codec, we are to determine inband FEC, maximum | 1976 // For Opus as the send codec, we are to determine inband FEC, maximum |
1975 // playback rate, and opus internal dtx. | 1977 // playback rate, and opus internal dtx. |
1976 if (IsCodec(*codec, kOpusCodecName)) { | 1978 if (IsCodec(*codec, kOpusCodecName)) { |
1977 GetOpusConfig(*codec, &send_codec_spec.codec_inst, | 1979 GetOpusConfig( |
1978 &send_codec_spec.enable_codec_fec, | 1980 *codec, &send_codec_spec.codec_inst, |
1979 &send_codec_spec.opus_max_playback_rate, | 1981 &send_codec_spec.enable_codec_fec, |
1980 &send_codec_spec.enable_opus_dtx, | 1982 &send_codec_spec.opus_max_playback_rate, |
1981 &send_codec_spec.min_ptime_ms, | 1983 &send_codec_spec.enable_opus_dtx, &send_codec_spec.enable_opus_cbr, |
1982 &send_codec_spec.max_ptime_ms); | 1984 &send_codec_spec.min_ptime_ms, &send_codec_spec.max_ptime_ms); |
1983 } | 1985 } |
1984 | 1986 |
1985 // Set packet size if the AudioCodec param kCodecParamPTime is set. | 1987 // Set packet size if the AudioCodec param kCodecParamPTime is set. |
1986 int ptime_ms = 0; | 1988 int ptime_ms = 0; |
1987 if (codec->GetParam(kCodecParamPTime, &ptime_ms)) { | 1989 if (codec->GetParam(kCodecParamPTime, &ptime_ms)) { |
1988 if (!WebRtcVoiceCodecs::SetPTimeAsPacketSize( | 1990 if (!WebRtcVoiceCodecs::SetPTimeAsPacketSize( |
1989 &send_codec_spec.codec_inst, ptime_ms)) { | 1991 &send_codec_spec.codec_inst, ptime_ms)) { |
1990 LOG(LS_WARNING) << "Failed to set packet size for codec " | 1992 LOG(LS_WARNING) << "Failed to set packet size for codec " |
1991 << send_codec_spec.codec_inst.plname; | 1993 << send_codec_spec.codec_inst.plname; |
1992 return false; | 1994 return false; |
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2693 ssrc); | 2695 ssrc); |
2694 if (it != unsignaled_recv_ssrcs_.end()) { | 2696 if (it != unsignaled_recv_ssrcs_.end()) { |
2695 unsignaled_recv_ssrcs_.erase(it); | 2697 unsignaled_recv_ssrcs_.erase(it); |
2696 return true; | 2698 return true; |
2697 } | 2699 } |
2698 return false; | 2700 return false; |
2699 } | 2701 } |
2700 } // namespace cricket | 2702 } // namespace cricket |
2701 | 2703 |
2702 #endif // HAVE_WEBRTC_VOICE | 2704 #endif // HAVE_WEBRTC_VOICE |
OLD | NEW |