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

Unified Diff: webrtc/modules/audio_coding/main/acm2/codec_manager.cc

Issue 1419013005: Hide ACMCodecDB::codec_settings_ behind an accessor (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: ICanHasNumChannels? 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_coding/main/acm2/codec_manager.cc
diff --git a/webrtc/modules/audio_coding/main/acm2/codec_manager.cc b/webrtc/modules/audio_coding/main/acm2/codec_manager.cc
index f9b77e898511ff2dd4d682ff085ba30c3d3e9d3b..fce6bd7a086d31d171e5274453e72a899c4cf063 100644
--- a/webrtc/modules/audio_coding/main/acm2/codec_manager.cc
+++ b/webrtc/modules/audio_coding/main/acm2/codec_manager.cc
@@ -63,8 +63,14 @@ int IsValidSendCodec(const CodecInst& send_codec, bool is_primary_encoder) {
return -1;
}
- if (ACMCodecDB::codec_settings_[codec_id].channel_support <
- send_codec.channels) {
+ const rtc::Maybe<bool> supported_num_channels = [codec_id, &send_codec] {
+ auto cid = RentACodec::CodecIdFromIndex(codec_id);
+ return cid ? RentACodec::IsSupportedNumChannels(*cid, send_codec.channels)
+ : rtc::Maybe<bool>();
+ }();
+ if (!supported_num_channels)
+ return -1;
+ 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.
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, dummy_id,
"%d number of channels not supportedn for %s.",
send_codec.channels, send_codec.plname);
« no previous file with comments | « webrtc/modules/audio_coding/main/acm2/acm_codec_database.h ('k') | webrtc/modules/audio_coding/main/acm2/rent_a_codec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698