Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 56 return -1; | 56 return -1; |
| 57 } | 57 } |
| 58 | 58 |
| 59 // Telephone-event cannot be a send codec. | 59 // Telephone-event cannot be a send codec. |
| 60 if (!STR_CASE_CMP(send_codec.plname, "telephone-event")) { | 60 if (!STR_CASE_CMP(send_codec.plname, "telephone-event")) { |
| 61 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, dummy_id, | 61 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, dummy_id, |
| 62 "telephone-event cannot be a send codec"); | 62 "telephone-event cannot be a send codec"); |
| 63 return -1; | 63 return -1; |
| 64 } | 64 } |
| 65 | 65 |
| 66 if (ACMCodecDB::codec_settings_[codec_id].channel_support < | 66 const rtc::Maybe<bool> supported_num_channels = [codec_id, &send_codec] { |
| 67 send_codec.channels) { | 67 auto cid = RentACodec::CodecIdFromIndex(codec_id); |
| 68 return cid ? RentACodec::IsSupportedNumChannels(*cid, send_codec.channels) | |
| 69 : rtc::Maybe<bool>(); | |
| 70 }(); | |
| 71 if (!supported_num_channels) | |
| 72 return -1; | |
| 73 if (!*supported_num_channels) { | |
|
tommi
2015/11/03 14:20:19
Are these 8 lines, basically doing the same as the
kwiberg-webrtc
2015/11/03 15:13:27
Almost. Without the lambda, it looks like this if
tommi
2015/11/03 16:50:01
Somehow I missed that |auto| was rtc::Maybe too.
| |
| 68 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, dummy_id, | 74 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, dummy_id, |
| 69 "%d number of channels not supportedn for %s.", | 75 "%d number of channels not supportedn for %s.", |
| 70 send_codec.channels, send_codec.plname); | 76 send_codec.channels, send_codec.plname); |
| 71 return -1; | 77 return -1; |
| 72 } | 78 } |
| 73 | 79 |
| 74 if (!is_primary_encoder) { | 80 if (!is_primary_encoder) { |
| 75 // If registering the secondary encoder, then RED and CN are not valid | 81 // If registering the secondary encoder, then RED and CN are not valid |
| 76 // choices as encoder. | 82 // choices as encoder. |
| 77 if (IsCodecRED(send_codec)) { | 83 if (IsCodecRED(send_codec)) { |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 456 case 48000: | 462 case 48000: |
| 457 return -1; | 463 return -1; |
| 458 default: | 464 default: |
| 459 FATAL() << sample_rate_hz << " Hz is not supported"; | 465 FATAL() << sample_rate_hz << " Hz is not supported"; |
| 460 return -1; | 466 return -1; |
| 461 } | 467 } |
| 462 } | 468 } |
| 463 | 469 |
| 464 } // namespace acm2 | 470 } // namespace acm2 |
| 465 } // namespace webrtc | 471 } // namespace webrtc |
| OLD | NEW |