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

Unified Diff: talk/media/webrtc/webrtcvoiceengine.cc

Issue 1364753002: Simplify handling of options in WebRtcVoiceMediaEngine. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 3 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 | « talk/media/webrtc/webrtcvoiceengine.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/media/webrtc/webrtcvoiceengine.cc
diff --git a/talk/media/webrtc/webrtcvoiceengine.cc b/talk/media/webrtc/webrtcvoiceengine.cc
index 69050c398b84ba2e0c891b6e6ede94d47618a21b..061f1e9aef684e0f2f353683ec28d9926d598af6 100644
--- a/talk/media/webrtc/webrtcvoiceengine.cc
+++ b/talk/media/webrtc/webrtcvoiceengine.cc
@@ -586,32 +586,6 @@ bool WebRtcVoiceEngine::SetOptions(const AudioOptions& options) {
return true;
}
-bool WebRtcVoiceEngine::SetOptionOverrides(const AudioOptions& overrides) {
- LOG(LS_INFO) << "Setting option overrides: " << overrides.ToString();
- if (!ApplyOptions(overrides)) {
- return false;
- }
- option_overrides_ = overrides;
- return true;
-}
-
-bool WebRtcVoiceEngine::ClearOptionOverrides() {
- LOG(LS_INFO) << "Clearing option overrides.";
- AudioOptions options = options_;
- // Only call ApplyOptions if |options_overrides_| contains overrided options.
- // ApplyOptions affects NS, AGC other options that is shared between
- // all WebRtcVoiceEngineChannels.
- if (option_overrides_ == AudioOptions()) {
- return true;
- }
-
- if (!ApplyOptions(options)) {
- return false;
- }
- option_overrides_ = AudioOptions();
- return true;
-}
-
// AudioOptions defaults are set in InitInternal (for options with corresponding
// MediaEngineInterface flags) and in SetOptions(int) for flagless options.
bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) {
@@ -1245,9 +1219,7 @@ void WebRtcVoiceEngine::RegisterChannel(WebRtcVoiceMediaChannel *channel) {
void WebRtcVoiceEngine::UnregisterChannel(WebRtcVoiceMediaChannel *channel) {
rtc::CritScope lock(&channels_cs_);
- ChannelList::iterator i = std::find(channels_.begin(),
- channels_.end(),
- channel);
+ auto i = std::find(channels_.begin(), channels_.end(), channel);
pbos-webrtc 2015/09/23 13:41:34 s/i/it/
the sun 2015/09/23 15:11:28 Done.
if (i != channels_.end()) {
channels_.erase(i);
}
@@ -1500,13 +1472,9 @@ bool WebRtcVoiceMediaChannel::SetOptions(const AudioOptions& options) {
options_.SetAll(options);
if (send_ != SEND_NOTHING) {
- if (!engine()->SetOptionOverrides(options_)) {
- LOG(LS_WARNING) <<
- "Failed to engine SetOptionOverrides during channel SetOptions.";
+ if (!engine()->ApplyOptions(options_)) {
return false;
}
- } else {
- // Will be interpreted when appropriate.
}
// Receiver-side auto gain control happens per channel, so set it here from
@@ -2069,18 +2037,21 @@ bool WebRtcVoiceMediaChannel::ChangeSend(SendFlags send) {
}
// Change the settings on each send channel.
- if (send == SEND_MICROPHONE)
- engine()->SetOptionOverrides(options_);
+ if (send == SEND_MICROPHONE) {
+ engine()->ApplyOptions(options_);
+ }
// Change the settings on each send channel.
for (const auto& ch : send_channels_) {
- if (!ChangeSend(ch.second->channel(), send))
+ if (!ChangeSend(ch.second->channel(), send)) {
return false;
+ }
}
// Clear up the options after stopping sending.
- if (send == SEND_NOTHING)
- engine()->ClearOptionOverrides();
+ if (send == SEND_NOTHING) {
+ engine()->ApplyOptions(engine()->GetOptions());
pbos-webrtc 2015/09/23 13:41:34 Why is this not a no-op?
the sun 2015/09/23 15:11:28 Because the engine options_ can be different from
pbos-webrtc 2015/09/23 15:13:14 But you're applying engine's GetOptions to engine?
+ }
send_ = send;
return true;
« no previous file with comments | « talk/media/webrtc/webrtcvoiceengine.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698