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

Unified Diff: webrtc/api/localaudiosource.cc

Issue 2437803004: Adding googAudioNetworkAdaptorConfig to MediaConstraintsInterface. (Closed)
Patch Set: renaming Created 4 years 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') | no next file with comments »
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 d91394eebcfca022e1e4b1270dc15985de4ab065..70035fececf80bf97647a4292754e79fbc0050f1 100644
--- a/webrtc/api/localaudiosource.cc
+++ b/webrtc/api/localaudiosource.cc
@@ -57,6 +57,28 @@ void FromConstraints(const MediaConstraintsInterface::Constraints& constraints,
};
for (const auto& constraint : constraints) {
+ // Set non-boolean constraints.
+ if (0 == constraint.key.compare(
+ MediaConstraintsInterface::kLevelControlInitialPeakLevelDBFS)) {
+ float level_control_initial_peak_level_dbfs = 0.0f;
+ if (rtc::FromString(constraint.value,
+ &level_control_initial_peak_level_dbfs)) {
+ options->level_control_initial_peak_level_dbfs =
+ rtc::Optional<float>(level_control_initial_peak_level_dbfs);
+ }
+ continue;
+ }
+ if (constraint.key.compare(
+ MediaConstraintsInterface::kAudioNetworkAdaptorConfig) == 0) {
+ // When |kAudioNetworkAdaptorConfig| is defined, it both means that audio
+ // network adaptor is desired, and provides the config string.
+ options->audio_network_adaptor = rtc::Optional<bool>(true);
+ options->audio_network_adaptor_config =
+ rtc::Optional<std::string>(constraint.value);
+ continue;
+ }
+
+ // Parse boolean value.
bool value = false;
if (!rtc::FromString(constraint.value, &value))
continue;
@@ -66,18 +88,6 @@ void FromConstraints(const MediaConstraintsInterface::Constraints& constraints,
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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698