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

Unified Diff: webrtc/api/localaudiosource.cc

Issue 2408143003: Added a level controller initialization value to MediaConstraints. (Closed)
Patch Set: Minor changes in constraints -> options translation & changed logging order. Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/api/mediaconstraintsinterface.h » ('j') | webrtc/api/mediaconstraintsinterface.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/localaudiosource.cc
diff --git a/webrtc/api/localaudiosource.cc b/webrtc/api/localaudiosource.cc
index 53c426e01119900d5eeb5fd4a5524f2f619e954a..7f9667854682c46d8bb8afae983e4f09490ba272 100644
--- a/webrtc/api/localaudiosource.cc
+++ b/webrtc/api/localaudiosource.cc
@@ -26,14 +26,11 @@ namespace {
// invalid.
void FromConstraints(const MediaConstraintsInterface::Constraints& constraints,
cricket::AudioOptions* options) {
- // This design relies on the fact that all the audio constraints are actually
- // "options", i.e. boolean-valued and always satisfiable. If the constraints
- // are extended to include non-boolean values or actual format constraints,
- // a different algorithm will be required.
+ // Set boolean constarints first.
tommi 2016/10/19 11:25:50 Fix typo
aleloi 2016/10/19 13:59:21 Done.
struct {
const char* name;
rtc::Optional<bool>& value;
- } key_to_value[] = {
+ } boolean_constraint_key_to_value[] = {
tommi 2016/10/19 11:25:50 Are these changes relevant to the cl? Maybe it's j
aleloi 2016/10/19 13:59:21 I agree, lets leave it as is.
{MediaConstraintsInterface::kGoogEchoCancellation,
options->echo_cancellation},
{MediaConstraintsInterface::kExtendedFilterEchoCancellation,
@@ -53,19 +50,30 @@ void FromConstraints(const MediaConstraintsInterface::Constraints& constraints,
{MediaConstraintsInterface::kHighpassFilter, options->highpass_filter},
{MediaConstraintsInterface::kTypingNoiseDetection,
options->typing_detection},
- {MediaConstraintsInterface::kAudioMirroring, options->stereo_swapping}
- };
+ {MediaConstraintsInterface::kAudioMirroring, options->stereo_swapping}};
for (const auto& constraint : constraints) {
bool value = false;
if (!rtc::FromString(constraint.value, &value))
continue;
- for (auto& entry : key_to_value) {
+ for (auto& entry : boolean_constraint_key_to_value) {
if (constraint.key.compare(entry.name) == 0)
entry.value = rtc::Optional<bool>(value);
}
}
+
+ // Set non-boolean constraints.
+ std::string value;
+ if (constraints.FindFirst(
+ MediaConstraintsInterface::kLevelControlInitialPeakLevelDBFS,
+ &value)) {
+ float level_control_initial_peak_level_dbfs;
+ if (rtc::FromString(value, &level_control_initial_peak_level_dbfs)) {
+ options->level_control_initial_peak_level_dbfs =
+ rtc::Optional<float>(level_control_initial_peak_level_dbfs);
+ }
+ }
}
} // namespace
« no previous file with comments | « no previous file | webrtc/api/mediaconstraintsinterface.h » ('j') | webrtc/api/mediaconstraintsinterface.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698