Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Unified Diff: media/audio/win/wavein_input_win.cc

Issue 7129057: Fix bug when unplugging an audio input device whilst using speech input. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Renaming Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/audio/audio_input_controller_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/win/wavein_input_win.cc
diff --git a/media/audio/win/wavein_input_win.cc b/media/audio/win/wavein_input_win.cc
index fdc08b875d73e219b5fe3f0e189b9fda62d4182e..fcffe7af56f653e9eecfa5655dbd9cfa532e914e 100644
--- a/media/audio/win/wavein_input_win.cc
+++ b/media/audio/win/wavein_input_win.cc
@@ -8,12 +8,15 @@
#include <mmsystem.h>
#pragma comment(lib, "winmm.lib")
-#include "base/basictypes.h"
#include "base/logging.h"
#include "media/audio/audio_io.h"
#include "media/audio/audio_util.h"
#include "media/audio/win/audio_manager_win.h"
+namespace {
+const int kStopInputStreamCallbackTimeout = 3000; // Three seconds.
+}
+
// Our sound buffers are allocated once and kept in a linked list using the
// the WAVEHDR::dwUser variable. The last buffer points to the first buffer.
static WAVEHDR* GetNextBuffer(WAVEHDR* current) {
@@ -130,7 +133,8 @@ void PCMWaveInAudioInputStream::Stop() {
return;
state_ = kStateStopping;
// Wait for the callback to finish, it will signal us when ready to be reset.
- if (WAIT_OBJECT_0 != ::WaitForSingleObject(stopped_event_, INFINITE)) {
+ if (WAIT_OBJECT_0 !=
+ ::WaitForSingleObject(stopped_event_, kStopInputStreamCallbackTimeout)) {
HandleError(::GetLastError());
return;
}
« no previous file with comments | « media/audio/audio_input_controller_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698