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

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

Issue 2669583002: Added a flag to AudioCodecSpec to indicate adaptive bitrate support. (Closed)
Patch Set: Created 3 years, 10 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 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 // Only generate telephone-event payload types for these clockrates: 1152 // Only generate telephone-event payload types for these clockrates:
1153 std::map<int, bool, std::greater<int>> generate_dtmf = {{ 8000, false }, 1153 std::map<int, bool, std::greater<int>> generate_dtmf = {{ 8000, false },
1154 { 16000, false }, 1154 { 16000, false },
1155 { 32000, false }, 1155 { 32000, false },
1156 { 48000, false }}; 1156 { 48000, false }};
1157 1157
1158 auto map_format = [&mapper, &out] (const webrtc::SdpAudioFormat& format) { 1158 auto map_format = [&mapper, &out] (const webrtc::SdpAudioFormat& format) {
1159 rtc::Optional<AudioCodec> opt_codec = mapper.ToAudioCodec(format); 1159 rtc::Optional<AudioCodec> opt_codec = mapper.ToAudioCodec(format);
1160 if (!opt_codec) { 1160 if (!opt_codec) {
1161 LOG(LS_ERROR) << "Unable to assign payload type to format: " << format; 1161 LOG(LS_ERROR) << "Unable to assign payload type to format: " << format;
1162 return false;
1163 } 1162 }
1164 1163 return opt_codec;
1165 auto& codec = *opt_codec;
1166 if (IsCodec(codec, kOpusCodecName)) {
1167 // TODO(ossu): Set this specifically for Opus for now, until we have a
1168 // better way of dealing with rtcp-fb parameters.
1169 codec.AddFeedbackParam(
1170 FeedbackParam(kRtcpFbParamTransportCc, kParamValueEmpty));
1171 }
1172 out.push_back(codec);
1173 return true;
1174 }; 1164 };
1175 1165
1176 for (const auto& spec : specs) { 1166 for (const auto& spec : specs) {
1177 if (map_format(spec.format)) { 1167 rtc::Optional<AudioCodec> opt_codec = map_format(spec.format);
1168 if (opt_codec) {
1169 AudioCodec& codec = *opt_codec;
1170 if (spec.supports_network_adaption) {
1171 codec.AddFeedbackParam(
1172 FeedbackParam(kRtcpFbParamTransportCc, kParamValueEmpty));
1173 }
1174
1178 if (spec.allow_comfort_noise) { 1175 if (spec.allow_comfort_noise) {
1179 // Generate a CN entry if the decoder allows it and we support the 1176 // Generate a CN entry if the decoder allows it and we support the
1180 // clockrate. 1177 // clockrate.
1181 auto cn = generate_cn.find(spec.format.clockrate_hz); 1178 auto cn = generate_cn.find(spec.format.clockrate_hz);
1182 if (cn != generate_cn.end()) { 1179 if (cn != generate_cn.end()) {
1183 cn->second = true; 1180 cn->second = true;
1184 } 1181 }
1185 } 1182 }
1186 1183
1187 // Generate a telephone-event entry if we support the clockrate. 1184 // Generate a telephone-event entry if we support the clockrate.
1188 auto dtmf = generate_dtmf.find(spec.format.clockrate_hz); 1185 auto dtmf = generate_dtmf.find(spec.format.clockrate_hz);
1189 if (dtmf != generate_dtmf.end()) { 1186 if (dtmf != generate_dtmf.end()) {
1190 dtmf->second = true; 1187 dtmf->second = true;
1191 } 1188 }
1189
1190 out.push_back(codec);
1192 } 1191 }
1193 } 1192 }
1194 1193
1195 // Add CN codecs after "proper" audio codecs. 1194 // Add CN codecs after "proper" audio codecs.
1196 for (const auto& cn : generate_cn) { 1195 for (const auto& cn : generate_cn) {
1197 if (cn.second) { 1196 if (cn.second) {
1198 map_format({kCnCodecName, cn.first, 1}); 1197 map_format({kCnCodecName, cn.first, 1});
1199 } 1198 }
1200 } 1199 }
1201 1200
(...skipping 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after
2703 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 2702 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
2704 const auto it = send_streams_.find(ssrc); 2703 const auto it = send_streams_.find(ssrc);
2705 if (it != send_streams_.end()) { 2704 if (it != send_streams_.end()) {
2706 return it->second->channel(); 2705 return it->second->channel();
2707 } 2706 }
2708 return -1; 2707 return -1;
2709 } 2708 }
2710 } // namespace cricket 2709 } // namespace cricket
2711 2710
2712 #endif // HAVE_WEBRTC_VOICE 2711 #endif // HAVE_WEBRTC_VOICE
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698