Index: content/browser/renderer_host/media/media_stream_manager.cc |
diff --git a/content/browser/renderer_host/media/media_stream_manager.cc b/content/browser/renderer_host/media/media_stream_manager.cc |
index 21d2aa4ce2e1ce7c0da8cbdc3fbe1b9887938152..cdb71b1a6a56aad9cece3a7fd7ed80d97a25672a 100644 |
--- a/content/browser/renderer_host/media/media_stream_manager.cc |
+++ b/content/browser/renderer_host/media/media_stream_manager.cc |
@@ -118,6 +118,18 @@ void ParseStreamType(const StreamOptions& options, |
} |
} |
+// Turns off available audio effects (removes the flag) if the options |
+// explicitly turn them off. |
+void FilterAudioEffects(const StreamOptions& options, int* effects) { |
+ DCHECK(effects); |
+ // TODO(ajm): Should we also handle ECHO_CANCELLER here? |
+ std::string value; |
+ if (options.GetFirstAudioConstraintByName( |
+ kMediaStreamAudioDucking, &value, NULL) && value == "false") { |
+ *effects &= ~media::AudioParameters::DUCKING; |
+ } |
+} |
+ |
// Private helper method for SendMessageToNativeLog() that obtains the global |
// MediaStreamManager instance on the UI thread before sending |message| to the |
// webrtcLoggingPrivate API. |
@@ -1386,8 +1398,12 @@ bool MediaStreamManager::FindExistingRequestedDeviceInfo( |
device_it != request->devices.end(); ++device_it) { |
if (device_it->device.id == source_id && |
device_it->device.type == new_device_info.type) { |
- *existing_device_info = *device_it; |
- *existing_request_state = request->state(device_it->device.type); |
+ *existing_device_info = *device_it; |
+ // Make sure that the audio |effects| reflect what the request |
+ // is set to and not what the capabilities are. |
+ FilterAudioEffects(request->options, |
+ &existing_device_info->device.input.effects); |
+ *existing_request_state = request->state(device_it->device.type); |
return true; |
} |
} |
@@ -1568,6 +1584,14 @@ void MediaStreamManager::Opened(MediaStreamType stream_type, |
audio_input_device_manager_->GetOpenedDeviceInfoById( |
device_it->session_id); |
device_it->device.input = info->device.input; |
+ |
+ // Since the audio input device manager will set the input |
+ // parameters to the default settings (including supported effects), |
+ // we need to adjust those settings here according to what the |
+ // request asks for. |
+ FilterAudioEffects(request->options, |
+ &device_it->device.input.effects); |
+ |
device_it->device.matched_output = info->device.matched_output; |
} |
} |