Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(708)

Side by Side Diff: webrtc/media/engine/webrtcvoiceengine.cc

Issue 2695243005: Injectable audio encoders: BuiltinAudioEncoderFactory (Closed)
Patch Set: Moved ANA frame length calculation into its own function. Improved "ptime" parsing in non-opus codeā€¦ Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 static void MaybeFixupG722(webrtc::CodecInst* voe_codec, int new_plfreq) { 495 static void MaybeFixupG722(webrtc::CodecInst* voe_codec, int new_plfreq) {
496 if (IsCodec(*voe_codec, kG722CodecName)) { 496 if (IsCodec(*voe_codec, kG722CodecName)) {
497 // If the DCHECK triggers, the codec definition in WebRTC VoiceEngine 497 // If the DCHECK triggers, the codec definition in WebRTC VoiceEngine
498 // has changed, and this special case is no longer needed. 498 // has changed, and this special case is no longer needed.
499 RTC_DCHECK(voe_codec->plfreq != new_plfreq); 499 RTC_DCHECK(voe_codec->plfreq != new_plfreq);
500 voe_codec->plfreq = new_plfreq; 500 voe_codec->plfreq = new_plfreq;
501 } 501 }
502 } 502 }
503 }; 503 };
504 504
505 const WebRtcVoiceCodecs::CodecPref WebRtcVoiceCodecs::kCodecPrefs[14] = { 505 const WebRtcVoiceCodecs::CodecPref WebRtcVoiceCodecs::kCodecPrefs[14] = {
ossu 2017/03/20 18:18:53 This is the list of information I'm basing ptimes
506 #if WEBRTC_OPUS_SUPPORT_120MS_PTIME 506 #if WEBRTC_OPUS_SUPPORT_120MS_PTIME
507 {kOpusCodecName, 48000, 2, 111, true, {10, 20, 40, 60, 120}, 507 {kOpusCodecName, 48000, 2, 111, true, {10, 20, 40, 60, 120},
508 kOpusMaxBitrateBps}, 508 kOpusMaxBitrateBps},
509 #else 509 #else
510 {kOpusCodecName, 48000, 2, 111, true, {10, 20, 40, 60}, kOpusMaxBitrateBps}, 510 {kOpusCodecName, 48000, 2, 111, true, {10, 20, 40, 60}, kOpusMaxBitrateBps},
511 #endif 511 #endif
512 {kIsacCodecName, 16000, 1, 103, true, {30, 60}, kIsacMaxBitrateBps}, 512 {kIsacCodecName, 16000, 1, 103, true, {30, 60}, kIsacMaxBitrateBps},
513 {kIsacCodecName, 32000, 1, 104, true, {30}, kIsacMaxBitrateBps}, 513 {kIsacCodecName, 32000, 1, 104, true, {30}, kIsacMaxBitrateBps},
514 // G722 should be advertised as 8000 Hz because of the RFC "bug". 514 // G722 should be advertised as 8000 Hz because of the RFC "bug".
515 {kG722CodecName, 8000, 1, 9, false, {10, 20, 30, 40, 50, 60}}, 515 {kG722CodecName, 8000, 1, 9, false, {10, 20, 30, 40, 50, 60}},
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 } 1132 }
1133 1133
1134 return opt_codec; 1134 return opt_codec;
1135 }; 1135 };
1136 1136
1137 for (const auto& spec : specs) { 1137 for (const auto& spec : specs) {
1138 // We need to do some extra stuff before adding the main codecs to out. 1138 // We need to do some extra stuff before adding the main codecs to out.
1139 rtc::Optional<AudioCodec> opt_codec = map_format(spec.format, nullptr); 1139 rtc::Optional<AudioCodec> opt_codec = map_format(spec.format, nullptr);
1140 if (opt_codec) { 1140 if (opt_codec) {
1141 AudioCodec& codec = *opt_codec; 1141 AudioCodec& codec = *opt_codec;
1142 if (spec.supports_network_adaption) { 1142 if (spec.info.supports_network_adaption) {
1143 codec.AddFeedbackParam( 1143 codec.AddFeedbackParam(
1144 FeedbackParam(kRtcpFbParamTransportCc, kParamValueEmpty)); 1144 FeedbackParam(kRtcpFbParamTransportCc, kParamValueEmpty));
1145 } 1145 }
1146 1146
1147 if (spec.allow_comfort_noise) { 1147 if (spec.info.allow_comfort_noise) {
1148 // Generate a CN entry if the decoder allows it and we support the 1148 // Generate a CN entry if the decoder allows it and we support the
1149 // clockrate. 1149 // clockrate.
1150 auto cn = generate_cn.find(spec.format.clockrate_hz); 1150 auto cn = generate_cn.find(spec.format.clockrate_hz);
1151 if (cn != generate_cn.end()) { 1151 if (cn != generate_cn.end()) {
1152 cn->second = true; 1152 cn->second = true;
1153 } 1153 }
1154 } 1154 }
1155 1155
1156 // Generate a telephone-event entry if we support the clockrate. 1156 // Generate a telephone-event entry if we support the clockrate.
1157 auto dtmf = generate_dtmf.find(spec.format.clockrate_hz); 1157 auto dtmf = generate_dtmf.find(spec.format.clockrate_hz);
(...skipping 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after
2693 ssrc); 2693 ssrc);
2694 if (it != unsignaled_recv_ssrcs_.end()) { 2694 if (it != unsignaled_recv_ssrcs_.end()) {
2695 unsignaled_recv_ssrcs_.erase(it); 2695 unsignaled_recv_ssrcs_.erase(it);
2696 return true; 2696 return true;
2697 } 2697 }
2698 return false; 2698 return false;
2699 } 2699 }
2700 } // namespace cricket 2700 } // namespace cricket
2701 2701
2702 #endif // HAVE_WEBRTC_VOICE 2702 #endif // HAVE_WEBRTC_VOICE
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698