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

Side by Side Diff: webrtc/modules/audio_coding/main/acm2/codec_manager.cc

Issue 1430043003: Move ACMCodecDB::ValidPayloadType to RentACodec (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 1 month 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) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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 28 matching lines...) Expand all
39 return -1; 39 return -1;
40 } 40 }
41 41
42 int codec_id = ACMCodecDB::CodecNumber(send_codec); 42 int codec_id = ACMCodecDB::CodecNumber(send_codec);
43 if (codec_id < 0) { 43 if (codec_id < 0) {
44 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, dummy_id, 44 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, dummy_id,
45 "Invalid codec setting for the send codec."); 45 "Invalid codec setting for the send codec.");
46 return -1; 46 return -1;
47 } 47 }
48 48
49 // TODO(tlegrand): Remove this check. Already taken care of in
50 // ACMCodecDB::CodecNumber().
51 // Check if the payload-type is valid
52 if (!ACMCodecDB::ValidPayloadType(send_codec.pltype)) {
53 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, dummy_id,
54 "Invalid payload-type %d for %s.", send_codec.pltype,
55 send_codec.plname);
56 return -1;
57 }
58
59 // Telephone-event cannot be a send codec. 49 // Telephone-event cannot be a send codec.
60 if (!STR_CASE_CMP(send_codec.plname, "telephone-event")) { 50 if (!STR_CASE_CMP(send_codec.plname, "telephone-event")) {
61 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, dummy_id, 51 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, dummy_id,
62 "telephone-event cannot be a send codec"); 52 "telephone-event cannot be a send codec");
63 return -1; 53 return -1;
64 } 54 }
65 55
66 const rtc::Maybe<bool> supported_num_channels = [codec_id, &send_codec] { 56 const rtc::Maybe<bool> supported_num_channels = [codec_id, &send_codec] {
67 auto cid = RentACodec::CodecIdFromIndex(codec_id); 57 auto cid = RentACodec::CodecIdFromIndex(codec_id);
68 return cid ? RentACodec::IsSupportedNumChannels(*cid, send_codec.channels) 58 return cid ? RentACodec::IsSupportedNumChannels(*cid, send_codec.channels)
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 return -1; 181 return -1;
192 } 182 }
193 183
194 int dummy_id = 0; 184 int dummy_id = 0;
195 // RED can be registered with other payload type. If not registered a default 185 // RED can be registered with other payload type. If not registered a default
196 // payload type is used. 186 // payload type is used.
197 if (IsCodecRED(send_codec)) { 187 if (IsCodecRED(send_codec)) {
198 // TODO(tlegrand): Remove this check. Already taken care of in 188 // TODO(tlegrand): Remove this check. Already taken care of in
199 // ACMCodecDB::CodecNumber(). 189 // ACMCodecDB::CodecNumber().
200 // Check if the payload-type is valid 190 // Check if the payload-type is valid
201 if (!ACMCodecDB::ValidPayloadType(send_codec.pltype)) { 191 if (!RentACodec::IsPayloadTypeValid(send_codec.pltype)) {
202 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, dummy_id, 192 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, dummy_id,
203 "Invalid payload-type %d for %s.", send_codec.pltype, 193 "Invalid payload-type %d for %s.", send_codec.pltype,
204 send_codec.plname); 194 send_codec.plname);
205 return -1; 195 return -1;
206 } 196 }
207 // Set RED payload type. 197 // Set RED payload type.
208 if (send_codec.plfreq == 8000) { 198 if (send_codec.plfreq == 8000) {
209 red_nb_pltype_ = static_cast<uint8_t>(send_codec.pltype); 199 red_nb_pltype_ = static_cast<uint8_t>(send_codec.pltype);
210 } else { 200 } else {
211 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, dummy_id, 201 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, dummy_id,
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 case 48000: 451 case 48000:
462 return -1; 452 return -1;
463 default: 453 default:
464 FATAL() << sample_rate_hz << " Hz is not supported"; 454 FATAL() << sample_rate_hz << " Hz is not supported";
465 return -1; 455 return -1;
466 } 456 }
467 } 457 }
468 458
469 } // namespace acm2 459 } // namespace acm2
470 } // namespace webrtc 460 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698