Commit ff50ca21 authored by tommi@chromium.org's avatar tommi@chromium.org

Correct browser side audio effect state for mediastream requests.

The problem was that MediaStreamDispatcher::IsAudioDuckingActive could
return true incorrectly (i.e. when an input device was open but it was
not actually opened with ducking enabled - as specified by the application).

The reason for this is that the audio effect state as known by
MediaStreamDispatcher reflects what the browser side delivers when an
audio track has been opened but the browser side had not taken into
account the stream options of the request.

BUG=391414

Review URL: https://codereview.chromium.org/464923002

Cr-Commit-Position: refs/heads/master@{#289286}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289286 0039d316-1c4b-4281-b951-d872f2087c98
parent 5b358f39
......@@ -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;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment