diff options
author | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-11 21:03:05 +0000 |
---|---|---|
committer | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-11 21:03:05 +0000 |
commit | d13783eae9c8a7670c7c3c97c322e7e5a045cf11 (patch) | |
tree | 626ae5cb74126fb3f35bd342aa92e254b6156d2f /media/audio | |
parent | 7d4368c56830969fc50d6d9a8eca90fd85974107 (diff) | |
download | chromium_src-d13783eae9c8a7670c7c3c97c322e7e5a045cf11.zip chromium_src-d13783eae9c8a7670c7c3c97c322e7e5a045cf11.tar.gz chromium_src-d13783eae9c8a7670c7c3c97c322e7e5a045cf11.tar.bz2 |
Fix Linux ALSA error message about failing to query delay.
Don't ask for delay if the pcm state is also SND_PCM_STATE_PREPARED. This causes an I/O error when querying for the delay, which gets logged to the console.
Patch by rtoy@chromium.org:
https://chromiumcodereview.appspot.com/7621077/
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131834 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio')
-rw-r--r-- | media/audio/linux/alsa_output.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/media/audio/linux/alsa_output.cc b/media/audio/linux/alsa_output.cc index 33c1f37..9ed2df0 100644 --- a/media/audio/linux/alsa_output.cc +++ b/media/audio/linux/alsa_output.cc @@ -617,10 +617,14 @@ std::string AlsaPcmOutputStream::FindDeviceForChannels(uint32 channels) { snd_pcm_sframes_t AlsaPcmOutputStream::GetCurrentDelay() { snd_pcm_sframes_t delay = -1; - - // Don't query ALSA's delay if we have underrun since it'll be jammed at - // some non-zero value and potentially even negative! - if (wrapper_->PcmState(playback_handle_) != SND_PCM_STATE_XRUN) { + // Don't query ALSA's delay if we have underrun since it'll be jammed at some + // non-zero value and potentially even negative! + // + // Also, if we're in the prepared state, don't query because that seems to + // cause an I/O error when we do query the delay. + snd_pcm_state_t pcm_state = wrapper_->PcmState(playback_handle_); + if (pcm_state != SND_PCM_STATE_XRUN && + pcm_state != SND_PCM_STATE_PREPARED) { int error = wrapper_->PcmDelay(playback_handle_, &delay); if (error < 0) { // Assume a delay of zero and attempt to recover the device. |