summaryrefslogtreecommitdiffstats
path: root/media/audio/win
Commit message (Collapse)AuthorAgeFilesLines
* Merge 120767 - Ensures that low-latency audio unit tests passes on Win 7 ↵tommi@chromium.org2012-02-072-2/+8
| | | | | | | | | | | | | | build bots which does not support mono rendering. BUG=112986 TEST=media_unittests Review URL: https://chromiumcodereview.appspot.com/9350014 TBR=henrika@chromium.org Review URL: https://chromiumcodereview.appspot.com/9349013 git-svn-id: svn://svn.chromium.org/chrome/branches/1025/src@120769 0039d316-1c4b-4281-b951-d872f2087c98
* Implement support for a cancelable SyncSocket.tommi@chromium.org2012-01-251-6/+4
| | | | | | | | | | | | Currently, blocking SyncSocket operations can not be unblocked from other threads, but this is now supported by using the CancelableSyncSocket class. The implementation on Mac and Linux is very simple and basically consists of adding a call to shutdown(). On Windows however things are a tiny bit more complex since we use named pipes with synchronous IO and canceling synchronous IO is simply not possible on XP and arguably tricky on Vista+. So, what we do instead is to use asynchronous IO in a synchronous fashion to support the SyncSocket semantics and as well as allowing the connection to be correctly shut down from another thread. Review URL: https://chromiumcodereview.appspot.com/8965053 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119051 0039d316-1c4b-4281-b951-d872f2087c98
* Improves file-handling in WASAPIAudioInputStreamRecordToFile unit test.henrika@chromium.org2012-01-241-11/+21
| | | | | | | | | BUG=none TEST=none Review URL: https://chromiumcodereview.appspot.com/9282001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118812 0039d316-1c4b-4281-b951-d872f2087c98
* Move the NOTREACHED/DCHECK check into GetMixFormat and remove it from ↵tommi@chromium.org2012-01-231-8/+7
| | | | | | | | | | | | | HardwareSampleRate and HardwareChannelCount. The reason is that we could hit the NOTREACHED in unit tests when an end point device was missing and we would unnecessarily DCHECK instead of just log a warning. TEST=run content_unittests with no mic. Review URL: http://codereview.chromium.org/9279005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118689 0039d316-1c4b-4281-b951-d872f2087c98
* Adds support for 16kHz input sample rate and mono channel config. in WebRTC.henrika@chromium.org2012-01-192-18/+40
| | | | | | | | | BUG=WebRTC demo doesn't work with Logitech 9000 as microphone TEST=content_unittest --gtest_filter=WebRTCAudioDeviceTest* Review URL: https://chromiumcodereview.appspot.com/9221010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118291 0039d316-1c4b-4281-b951-d872f2087c98
* Convert use of int ms to TimeDelta in files owned by vrk.tedvessenes@gmail.com2012-01-142-7/+7
| | | | | | | | | | | R=vrk@chromium.org BUG=108171 TEST= Review URL: http://codereview.chromium.org/9190026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117809 0039d316-1c4b-4281-b951-d872f2087c98
* Fix race condition when stopping audio stream on Windows.enal@chromium.org2012-01-141-20/+34
| | | | | | | | | | | | | | | | | | | 1. We were stopping wave out playback first (waveOutReset()) and only then stopped callbacks, so callback could buffer more data after playback stopped, causing waveOutClose() to fail because not all buffers were freed. Fix is to stop callbacks before stopping playback. 2. We also have to manually reset buffer event before starting playback, because it can be left in the signalled state when we previously were stopping the stream. 3. Do not delete the stream if stop/close failed, because we can still have active callbacks that would access freed object. Better to leak the memory. BUG=109757,108685 TEST=Crashes in PCMWaveOutAudioOutputStream::Close() should go away. Review URL: http://codereview.chromium.org/9148077 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117735 0039d316-1c4b-4281-b951-d872f2087c98
* Remove the headless check for the audio output unittests.tommi@chromium.org2012-01-131-54/+58
| | | | | | | | | | Presence of hardware should still be correctly detected and the tests should not fail on machines without the required hardware. This is in anticipation of getting our audio equipped build bots and to enable the tests on the already capable mac bots. TEST=run media_unittests on the build bots. Review URL: http://codereview.chromium.org/9005008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117639 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 117268 - Add CHECKs to find root cause of Windows-only crash.enal@chromium.org2012-01-122-30/+8
| | | | | | | | | | | | | | Checks are temporary and would be in canary only. For gory details please see original bug 108685. BUG=109757 Review URL: http://codereview.chromium.org/9147039 TBR=enal@chromium.org Review URL: http://codereview.chromium.org/9139072 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117497 0039d316-1c4b-4281-b951-d872f2087c98
* Add CHECKs to find root cause of Windows-only crash.enal@chromium.org2012-01-112-8/+30
| | | | | | | | | | | Checks are temporary and would be in canary only. For gory details please see original bug 108685. BUG=109757 Review URL: http://codereview.chromium.org/9147039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117268 0039d316-1c4b-4281-b951-d872f2087c98
* Fix "waveOutClose failure causes PCMWaveOutAudioOutputStream to never get ↵tommi@chromium.org2012-01-111-4/+6
| | | | | | | | | | | | | | | | | | deleted" Always transfer to the 'closed' state and call ReleaseOutputStream when Close() is called. * If waveOutClose failed, then the PCMWaveOutAudioOutputStream object will go into a bad state and never get deleted. * I'm removing the call to HandleError() since callback_ will always be NULL. This is possibly related to bug 108685. TEST=Fixes possible starvation of output streams and object leaks (see above). BUG=109837 Review URL: http://codereview.chromium.org/9158018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117203 0039d316-1c4b-4281-b951-d872f2087c98
* Adds device notification to WASAPI rendering client.henrika@chromium.org2012-01-112-16/+334
| | | | | | | | | | | | | Also adds support for stream switching where audio rendering will automatically switch from one default device to a new default device when the first on is disabled or removed. See the header-file comments for more details comments. BUG=none TEST=media_unittests Review URL: http://codereview.chromium.org/9008041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117195 0039d316-1c4b-4281-b951-d872f2087c98
* Delete the AudioOutputStream correctly (by using Close and not delete).tommi@chromium.org2012-01-101-2/+2
| | | | | | | | TEST=Fixes a crash in the WASAPIAudioOutputStreamTestMono test when mono isn't supported. Review URL: http://codereview.chromium.org/9169011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117075 0039d316-1c4b-4281-b951-d872f2087c98
* Better error handling in audio wave out.enal@chromium.org2012-01-101-13/+20
| | | | | | | | | | | Fix calling NULL callback, slightly reorder the code to avoid potential problems. BUG=108685 Review URL: http://codereview.chromium.org/9124024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116976 0039d316-1c4b-4281-b951-d872f2087c98
* Allow the AudioLowLatencyInputOutput, WinAudioOutputTest and ↵tommi@chromium.org2011-12-152-12/+6
| | | | | | | | | | | WinAudioInputTest tests to run on bots where audio hardware is available. The tests will succeed (to avoid breaking the tree) with a warning printed out on bots that don't have the necessary hardware. TEST=Run media_unittests on the build bots. Review URL: http://codereview.chromium.org/8949015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114638 0039d316-1c4b-4281-b951-d872f2087c98
* Adds new full-duplex test which measures and logs the reported audio delays.henrika@chromium.org2011-12-142-2/+5
| | | | | | | | BUG=none TEST=media_unittests --gtest_filter=AudioLowLatencyInputOutputTest* Review URL: http://codereview.chromium.org/8840004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114423 0039d316-1c4b-4281-b951-d872f2087c98
* Remove the AudioManager singleton.tommi@chromium.org2011-12-124-88/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unit tests now instantiate their own AudioManager and can choose to use the default one or provide their own mock implementation without having to worry about conflicting with the singleton. The teardown sequence of the AudioManager and its thread has been cleaned up significantly and I don't think it has been completely tested before as the audio thread was terminated before all objects that belonged to the thread had a chance to do cleanup. The AudioManager unit tests do not use the actual audio thread, so this part seems to have been left out. In Chrome, the AudioManager instance is now owned by BrowserProcessImpl and always constructed on the UI thread. This instance is then shared in the same way that several other 'manager' type objects are shared to 'content' code, via content::ResourceContext. Audio specific classes do though receive a direct pointer to the AudioManager and are required to do proper reference counting if they need to hold onto the instance. I chose to use the ResourceContext rather than direct use of g_browser_process to avoid requiring another singleton when writing relatively simple tests that touch the AudioManager. I added a couple of safeguards to guard against future regressions: - Not more than one instance of the AudioManager should be created. - The AudioManager should not be addrefed by its own thread. This can basically become a circular reference and prevent deterministic shutdown. Reviewers: Of course you're free to review everything, but here's the breakdown in terms of the bare minimum from the standpoint of "Owners approval". I'm asking Henrik to be the main reviewer of the entire patch (sorry!). Henrik: Everything minus the below, but it would be great if you could take a look at the whole thing, specifically media/audio. Pawel: I'd like you to take a generic look at this approach. The key areas as far as the singleton itself goes are in media/audio/audio_manager[_base].* and chrome/browser/browser_process*.* Satish: content/browser/speech/* media/audio/audio_manager_base.* (new reference counting code) Andrew: content/browser/renderer_host/media/* content/renderer/media/webrtc_audio_device_unittest.cc (Owner) Avi: content/browser/renderer_host/render_process_host_impl.cc content/browser/resource_context.* William: chrome/browser/profiles/profile_io_data.cc chrome/browser/browser_process*.* Robert: This is basically a heads up. I hope that I didn't break the OpenBSD implementation, but unfortunately I have no way of knowing for sure. Shijing: Please take a look at AudioManagerLinux. I replaced the set of active streams with a simple counter. BUG=105249 TEST=content_unittests, media_unittests, browser_tests. Review URL: http://codereview.chromium.org/8818012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114084 0039d316-1c4b-4281-b951-d872f2087c98
* Removing MessageLoop::QuitTask() from media/dcheng@chromium.org2011-12-091-4/+4
| | | | | | | | | | | | | base/task.h is going away and being replaced by base/bind.h and base/callback.h. This CL was automatically generated by sed. BUG=none TEST=none Review URL: http://codereview.chromium.org/8879032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113740 0039d316-1c4b-4281-b951-d872f2087c98
* Make check for 'opened' consistent across all audio stream implementations ↵tommi@chromium.org2011-12-082-4/+2
| | | | | | | | | | | | | of Start() and log an error if open hasn't been called successfully. This fixes BUG=106712 TEST=Run media_unittests. Review URL: http://codereview.chromium.org/8872028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113679 0039d316-1c4b-4281-b951-d872f2087c98
* Replace media::Limits struct with media::limits namespace and update ↵scherkus@chromium.org2011-12-071-1/+1
| | | | | | | | documentation. Review URL: http://codereview.chromium.org/8786013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113425 0039d316-1c4b-4281-b951-d872f2087c98
* Adds input device selection on Windows.henrika@chromium.org2011-12-065-37/+101
| | | | | | | | | | | | This CL does not change anything for any other audio client but the WebRTC clients. All other clients can ignore this new functionality and will still use the default input device as before. BUG=none TEST=special version of content_unittests --gtest_filter=WebRTCAudioDeviceTest* Review URL: http://codereview.chromium.org/8770005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113173 0039d316-1c4b-4281-b951-d872f2087c98
* Move decision if we need to use WASAPI or wave out into separate function.enal@chromium.org2011-12-031-5/+5
| | | | | | | | | | Minor Windows-only code cleanup. That also fixes broken sound on Windows Server 2003. BUG=none Review URL: http://codereview.chromium.org/8777003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112860 0039d316-1c4b-4281-b951-d872f2087c98
* Change the way we are sending audio data to driver when using WaveOut API.enal@chromium.org2011-12-013-117/+164
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before, we were "feeding" the driver in the callback when OS returned audio buffer to us. MSDN disallows that, but We were avoiding deadlock when stopping the stream by using some clever tricks. Unfortunately, exactly the same deadlock happens when Windows were draining audio stream when switching the device, and our tricks did not help, as we were not controlling exact timing. Fix is to separate receiving freed buffer and "feeding" audio driver. Now we are using CALLBACK_EVENT wave out mode in which Windows signal event when buffer runs out of data, and using RegisterWaitForSingleObject() so our callback is called by one of thread pool threads. Stopping of playback became slower because now it is synchronous. If that ever become a problem we can use singleton that keeps track of the playing audio streams, than stopping can become instaneous, at a cost of more complex checks in the callback. Unfortunately, no automatic test, as there is no documented way to programmatically switch default audio device on Windows. People were able to figure it out (see http://www.daveamenta.com/2011-05/programmatically-or-command-line-change-the-default-sound-playback-device-in-windows-7/), but there is no guarantee it will continue to work in Win8, or even in next Service Pack for Win7. BUG=41036 TEST=Play any HTML5 audio/video on Windows and change default audio device TEST=using "Control Panel | Sound". There should be no hang, you should hear TEST=audio from the newly chosen device. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=112147 Review URL: http://codereview.chromium.org/8591028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112484 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 112147 - Did not get LGTM from all reviewers.enal@chromium.org2011-11-302-158/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change the way we are sending audio data to driver when using WaveOut API. Before, we were "feeding" the driver in the callback when OS returned audio buffer to us. MSDN disallows that, but We were avoiding deadlock when stopping the stream by using some clever tricks. Unfortunately, exactly the same deadlock happens when Windows were draining audio stream when switching the device, and our tricks did not help, as we were not controlling exact timing. Fix is to separate receiving freed buffer and "feeding" audio driver. Now we are using CALLBACK_EVENT wave out mode in which Windows signal event when buffer runs out of data, and using RegisterWaitForSingleObject() so our callback is called by one of thread pool threads. Stopping of playback became slower because now it is synchronous. If that ever become a problem we can use singleton that keeps track of the playing audio streams, than stopping can become instaneous, at a cost of more complex checks in the callback. Unfortunately, no automatic test, as there is no documented way to programmatically switch default audio device on Windows. People were able to figure it out (see http://www.daveamenta.com/2011-05/programmatically-or-command-line-change-the-default-sound-playback-device-in-windows-7/), but there is no guarantee it will continue to work in Win8, or even in next Service Pack for Win7. BUG=41036 TEST=Play any HTML5 audio/video on Windows and change default audio device TEST=using "Control Panel | Sound". There should be no hang, you should hear TEST=audio from the newly chosen device. Review URL: http://codereview.chromium.org/8591028 TBR=enal@chromium.org Review URL: http://codereview.chromium.org/8753001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112233 0039d316-1c4b-4281-b951-d872f2087c98
* Change the way we are sending audio data to driver when using WaveOut API.enal@chromium.org2011-11-302-113/+158
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before, we were "feeding" the driver in the callback when OS returned audio buffer to us. MSDN disallows that, but We were avoiding deadlock when stopping the stream by using some clever tricks. Unfortunately, exactly the same deadlock happens when Windows were draining audio stream when switching the device, and our tricks did not help, as we were not controlling exact timing. Fix is to separate receiving freed buffer and "feeding" audio driver. Now we are using CALLBACK_EVENT wave out mode in which Windows signal event when buffer runs out of data, and using RegisterWaitForSingleObject() so our callback is called by one of thread pool threads. Stopping of playback became slower because now it is synchronous. If that ever become a problem we can use singleton that keeps track of the playing audio streams, than stopping can become instaneous, at a cost of more complex checks in the callback. Unfortunately, no automatic test, as there is no documented way to programmatically switch default audio device on Windows. People were able to figure it out (see http://www.daveamenta.com/2011-05/programmatically-or-command-line-change-the-default-sound-playback-device-in-windows-7/), but there is no guarantee it will continue to work in Win8, or even in next Service Pack for Win7. BUG=41036 TEST=Play any HTML5 audio/video on Windows and change default audio device TEST=using "Control Panel | Sound". There should be no hang, you should hear TEST=audio from the newly chosen device. Review URL: http://codereview.chromium.org/8591028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112147 0039d316-1c4b-4281-b951-d872f2087c98
* ake string_util::WriteInto() DCHECK() that the supplied |length_with_null| > ↵pkasting@chromium.org2011-11-291-3/+5
| | | | | | | | | | | | 1, meaning that the without-'\0' string is non-empty. This replaces the conditional code added recently that makes this case return NULL. It's easier to understand if it's simply an error to call WriteInto() in this case at all. Add DCHECK()s or conditionals as appropriate to callers in order to ensure this assertion holds. BUG=none TEST=none Review URL: http://codereview.chromium.org/8418034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112005 0039d316-1c4b-4281-b951-d872f2087c98
* Fixes rounding issue in simple sources.henrika@chromium.org2011-11-291-22/+37
| | | | | | | | | | | The SimpleSources unit test failed after this CL (http://codereview.chromium.org/8678012). This CL contains a fix. BUG=none TEST=media_unittests --gtest_filter=SimpleSources* Review URL: http://codereview.chromium.org/8687024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111913 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 111890 - This patch ensures that the audio_output_win_unittest works ↵henrika@chromium.org2011-11-291-37/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | for AUDIO_PCM_LOW_LATENCY. It seems like only test which utilized AUDIO_PCM_LOW_LATENCY has been broken for a while. It was most likely I who broke it when I added support for WASAPI output. Anyhow, in this patch, I ensure that we can still test using the low-larency flag. A buffer size of 10ms is used on Vista and higher (<=> WASAPI) and 50ms is used (as before) in XP. I have also modified the sinus source since it contained two issues actually. 1) It did not store a valid state between each frame (=> distorsion at end-points). 2) The volume 2^15 was too high and could lead to odd effects for negative numbers. Both these things are fixed in this CL and all tones now sounds better. The old tones were all distorted. BUG=none TEST=audio_output_win_unittest Review URL: http://codereview.chromium.org/8678012 TBR=henrika@chromium.org Review URL: http://codereview.chromium.org/8725027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111892 0039d316-1c4b-4281-b951-d872f2087c98
* This patch ensures that the audio_output_win_unittest works for ↵henrika@chromium.org2011-11-291-22/+37
| | | | | | | | | | | | | | | | | | | | | | | AUDIO_PCM_LOW_LATENCY. It seems like only test which utilized AUDIO_PCM_LOW_LATENCY has been broken for a while. It was most likely I who broke it when I added support for WASAPI output. Anyhow, in this patch, I ensure that we can still test using the low-larency flag. A buffer size of 10ms is used on Vista and higher (<=> WASAPI) and 50ms is used (as before) in XP. I have also modified the sinus source since it contained two issues actually. 1) It did not store a valid state between each frame (=> distorsion at end-points). 2) The volume 2^15 was too high and could lead to odd effects for negative numbers. Both these things are fixed in this CL and all tones now sounds better. The old tones were all distorted. BUG=none TEST=audio_output_win_unittest Review URL: http://codereview.chromium.org/8678012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111890 0039d316-1c4b-4281-b951-d872f2087c98
* Removes call to invalid error handler during audio initialization for ↵henrika@chromium.org2011-11-282-12/+0
| | | | | | | | | | Windows WASAPI. BUG=none TEST=content_unittests --gtest_filter=WebRTCAudioDeviceTest* Review URL: http://codereview.chromium.org/8684002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111692 0039d316-1c4b-4281-b951-d872f2087c98
* Adds support for capture device enumeration on Windows.henrika@chromium.org2011-11-244-8/+191
| | | | | | | | | | | | | | | | Example output (two devices found on Windows 7 machine): device_name: Microphone (6- SB Arena Headset) unique_id: {0.0.1.00000000}.{24515814-26fd-4382-b4bc-0a8d847ed853} device_name: Microphone (Realtek High Definition Audio) unique_id: {0.0.1.00000000}.{8db6020f-18e3-4f25-b6f5-7726c9122574} BUG=None TEST=audio_input_device_unittest.cc Review URL: http://codereview.chromium.org/8606006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111500 0039d316-1c4b-4281-b951-d872f2087c98
* Fixes minor issue in unit test where I had used DISABLE_ instead of DISABLED_.scherkus@chromium.org2011-11-231-1/+1
| | | | | | | Patch by henrika@chromium.org: http://codereview.chromium.org/8678007/ git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111397 0039d316-1c4b-4281-b951-d872f2087c98
* Enable the device selection for linux and mac by passing a device unique id ↵xians@chromium.org2011-11-223-9/+15
| | | | | | | | | | | | | | | from renderer down to the browser. With this patch, users should be able to create a audio stream with a non-default device, and feature is only available for low-latency audio. TEST=media_unittests, webrtc test app BUG=None Review URL: http://codereview.chromium.org/8491044 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111153 0039d316-1c4b-4281-b951-d872f2087c98
* Low-latency AudioOutputStream implementation based on WASAPI for Windows.henrika@chromium.org2011-11-165-6/+1349
| | | | | | | | BUG=none TEST=audio_low_latency_output_win_unittest.cc Review URL: http://codereview.chromium.org/8440002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110282 0039d316-1c4b-4281-b951-d872f2087c98
* Cleanup: Remove unneeded forward declarations in base, dbug, gpu, ipc, ↵thestig@chromium.org2011-11-151-1/+0
| | | | | | | | | | jingle, and media. BUG=none TEST=none Review URL: http://codereview.chromium.org/8511045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109998 0039d316-1c4b-4281-b951-d872f2087c98
* Implement polling for data becoming ready when starting audio stream.enal@chromium.org2011-11-091-0/+4
| | | | | | | | | | | | | | | Before the change we had polling for 1st buffer but not for subsequent ones. Do it in simplest possible way -- poll and sleep in the loop. It is probably not the best approach, but simplest and most reliable. We had lot of problems adding polling for 1st buffer in the existing message loop, do not want to introduce new message loop where we had not such loop before. In any case loop usually is not executed, otherwise we would have more audible glitches when starting the stream. Windows and Mac only change, we have only single buffer on Linux. TEST=Start playing HTML5 audio on extremely busy Win/MAC TEST=system with single core. Before the change you will TEST=almost always here the glitch in the beginning. TEST=That should become much more rare now. Review URL: http://codereview.chromium.org/8496022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109162 0039d316-1c4b-4281-b951-d872f2087c98
* Problem happens because we cannot stop physical stream in arbitrary moment, ↵enal@chromium.org2011-11-022-39/+45
| | | | | | | | | | | | | | | | callback thread may either ask for more data or feeding new data to audio driver. So we were setting flag and waiting for callback thread to signal that it saw the flag, stopped its activity and now it is safe to stop. Changed the code to use critical section instead. Callback thread tries to enter critical section before doing work. If it cannot it assumes that main thread issued stop and waits for all buffers to be returned and callback thread to be terminated. By using TryEnterCriticalSection() instead of EnterCriticalSection() we are avoiding deadlock (there are internal Windows locks being involved, so EnterCriticalSection() in the callback will deadlock). So we would stop immediately if callback is not active, compared for waiting for callback to be called before the change, at a cost of extra enter/leave critical section per callback. Tested on Win7 and XP. (That is result of my Windows-specific audio crash investigation -- I was wrong why it happened, but while investigation I had that speedup...) Review URL: http://codereview.chromium.org/8353017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108320 0039d316-1c4b-4281-b951-d872f2087c98
* Changing a NOTREACHED to a LOG(WARNING) for cases when a mic isn't connected.tommi@chromium.org2011-10-311-1/+4
| | | | | | | | TEST=Removes a DCHECK that we would hit on machines without a mic. BUG=none Review URL: http://codereview.chromium.org/8335005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107936 0039d316-1c4b-4281-b951-d872f2087c98
* Removes an invalid hard-coded sample rate in the low-latencyhenrika@chromium.org2011-10-261-1/+0
| | | | | | | | | | | | unit test for Windows based on WAsAPI. This is a trivial patch. BUG=none TEST=none Review URL: http://codereview.chromium.org/8387026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107306 0039d316-1c4b-4281-b951-d872f2087c98
* Fixes yet another build error on Windows shared bot.henrika@chromium.org2011-10-241-1/+1
| | | | | | TBR=tommi git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106901 0039d316-1c4b-4281-b951-d872f2087c98
* Fixes build error on Windows shared bot.henrika@chromium.org2011-10-241-1/+2
| | | | | | | TBR=tommi Review URL: http://codereview.chromium.org/8373031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106900 0039d316-1c4b-4281-b951-d872f2087c98
* Low-latency AudioInputStream implementation based on WASAPI for Windows.henrika@chromium.org2011-10-247-5/+1181
| | | | | | | | | Requires Windows Vista or higher. BUG=none TEST=Attached unit test (requires undefined CHROME_HEADLESS) Review URL: http://codereview.chromium.org/8283032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106899 0039d316-1c4b-4281-b951-d872f2087c98
* Add a method to the audio manager to find out if recording is currently ↵leandrogracia@chromium.org2011-10-133-15/+24
| | | | | | | | | | | | | | | active in Chrome. Adding also missing OVERRIDEs in the affected files. BUG=97388 TEST=none Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=105333 Review URL: http://codereview.chromium.org/8208013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105337 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 105333: OVERRIDE failures on asan - Add a method to the audio manager ↵erg@google.com2011-10-133-24/+15
| | | | | | | | | | | | | | | | to find out if recording is currently active in Chrome. Adding also missing OVERRIDEs in the affected files. BUG=97388 TEST=none Review URL: http://codereview.chromium.org/8208013 TBR=leandrogracia@chromium.org Review URL: http://codereview.chromium.org/8276008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105335 0039d316-1c4b-4281-b951-d872f2087c98
* Add a method to the audio manager to find out if recording is currently ↵leandrogracia@chromium.org2011-10-133-15/+24
| | | | | | | | | | | | | active in Chrome. Adding also missing OVERRIDEs in the affected files. BUG=97388 TEST=none Review URL: http://codereview.chromium.org/8208013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105333 0039d316-1c4b-4281-b951-d872f2087c98
* Adding delay estimation to input audio.xians@chromium.org2011-10-041-0/+3
| | | | | | | | | | | | | | On linux, snd_pcm_delay API will be used to get the delay value from ALSA; On mac, the AudioQueue implementation will just use the buffer size as delay value since we may not use this impl for recording; the low-latency AudioUnits implementation will use some AudioUnitGetProperty() API to get the accurate delay value from the driver; On windows, for the Wave implementation, based on the tests we do, it should be OK to use the buffer size as the delay value; for the to-be-implemented core audio implementation, we will see what is the appropriate way to get the delay there. Review URL: http://codereview.chromium.org/8068005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104002 0039d316-1c4b-4281-b951-d872f2087c98
* Add tracing for select WebAudio functionscrogers@google.com2011-08-181-0/+3
| | | | | | | | | BUG=none TEST=none R=scherkus (original code review http://codereview.chromium.org/7646026/) git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97338 0039d316-1c4b-4281-b951-d872f2087c98
* Change base::LaunchProcess API slightlyevan@chromium.org2011-07-151-2/+1
| | | | | | | | | | | Rather than passing the out param process handle via the options, take it as a function argument. This simplifies many callers. BUG=88990 Review URL: http://codereview.chromium.org/7377012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92701 0039d316-1c4b-4281-b951-d872f2087c98
* Clean up users of a deprecated base::LaunchApp API.evan@chromium.org2011-07-141-1/+2
| | | | | | | | BUG=88990 Review URL: http://codereview.chromium.org/7351003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92598 0039d316-1c4b-4281-b951-d872f2087c98
* Coverity: Pass parameters by reference.jhawkins@chromium.org2011-06-226-10/+16
| | | | | | | | | | | | | CID=13686,13687,13688,13709,13710,13711,13712,13713,13714,13718,13715,13716, 13717,13796,13797,13798,13811,13812,13813,14708,16329 BUG=none TEST=none R=vandebo@chromium.org Review URL: http://codereview.chromium.org/7218031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90112 0039d316-1c4b-4281-b951-d872f2087c98