Commit 933778cc authored by dalecurtis's avatar dalecurtis Committed by Commit bot

Partial revert of disabling low latency audio for remote desktop.

Crash and playback startup success rates remained the same before
and after this change, so reverting the additional complexity. I've
left the cleanup of internal functions though.

BUG=422522
TEST=things work as before.

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

Cr-Commit-Position: refs/heads/master@{#325577}
parent f5896174
......@@ -135,11 +135,6 @@ bool WASAPIAudioOutputStream::Open() {
DCHECK(!audio_client_.get());
DCHECK(!audio_render_client_.get());
// Don't allow WASAPI streams to be created for remote output devices, this
// frequently leads to hangs of the audio thread. http://crbug.com/422522.
if (CoreAudioUtil::IsRemoteOutputDevice(device_id_))
return false;
// Will be set to true if we ended up opening the default communications
// device.
bool communications_device = false;
......
......@@ -187,24 +187,6 @@ static ScopedComPtr<IMMDeviceEnumerator> CreateDeviceEnumeratorInternal() {
return device_enumerator;
}
static bool IsRemoteSession() {
return !!GetSystemMetrics(SM_REMOTESESSION);
}
static bool IsRemoteDeviceInternal(IMMDevice* device) {
DCHECK(IsRemoteSession());
std::string device_name;
HRESULT hr = GetDeviceFriendlyNameInternal(device, &device_name);
// This method should only be called if IsRemoteSession() is true, so assume
// we have a remote audio device if we can't tell.
if (FAILED(hr))
return true;
return device_name == "Remote Audio";
}
static bool IsSupportedInternal() {
// It is possible to force usage of WaveXxx APIs by using a command line flag.
const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
......@@ -241,26 +223,7 @@ static bool IsSupportedInternal() {
return false;
}
// Don't use CoreAudio when a remote desktop session with remote audio is
// present; several users report only WaveAudio working for them and crash
// reports show hangs when calling into the OS for CoreAudio API calls. See
// http://crbug.com/422522 and http://crbug.com/180591.
//
// Note: There's another check in WASAPIAudioOutputStream::Open() for the case
// where a remote session is created after Chrome has been started. Graceful
// fallback to WaveOut will occur in this case via AudioOutputResampler.
if (!IsRemoteSession())
return true;
ScopedComPtr<IMMDevice> device;
HRESULT hr = device_enumerator->GetDefaultAudioEndpoint(eRender, eConsole,
device.Receive());
// Assume remote audio playback if we can't tell.
if (FAILED(hr))
return false;
return !IsRemoteDeviceInternal(device.get());
return true;
}
bool CoreAudioUtil::IsSupported() {
......@@ -906,15 +869,4 @@ bool CoreAudioUtil::FillRenderEndpointBufferWithSilence(
AUDCLNT_BUFFERFLAGS_SILENT));
}
bool CoreAudioUtil::IsRemoteOutputDevice(const std::string& device_id) {
DCHECK(IsSupported());
if (!IsRemoteSession())
return false;
ScopedComPtr<IMMDevice> device(device_id.empty()
? CreateDefaultDevice(eRender, eConsole)
: CreateDevice(device_id));
// Assume remote audio if we can't tell.
return device ? IsRemoteDeviceInternal(device.get()) : true;
}
} // namespace media
......@@ -229,9 +229,6 @@ class MEDIA_EXPORT CoreAudioUtil {
static bool FillRenderEndpointBufferWithSilence(
IAudioClient* client, IAudioRenderClient* render_client);
// Returns true if the given output device is a remote audio endpoint.
static bool IsRemoteOutputDevice(const std::string& device_id);
private:
CoreAudioUtil() {}
~CoreAudioUtil() {}
......
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