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

Side by Side Diff: media/audio/win/audio_manager_win.cc

Issue 3192017: Revert 57254 - Share one thread between all AudioOutputControllers instead of... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/audio/win/audio_manager_win.h ('k') | media/filters/audio_renderer_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/audio/audio_io.h" 5 #include "media/audio/audio_io.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <mmsystem.h> 8 #include <mmsystem.h>
9 9
10 #include "base/at_exit.h"
10 #include "base/basictypes.h" 11 #include "base/basictypes.h"
11 #include "media/audio/fake_audio_input_stream.h" 12 #include "media/audio/fake_audio_input_stream.h"
12 #include "media/audio/fake_audio_output_stream.h" 13 #include "media/audio/fake_audio_output_stream.h"
13 #include "media/audio/win/audio_manager_win.h" 14 #include "media/audio/win/audio_manager_win.h"
14 #include "media/audio/win/wavein_input_win.h" 15 #include "media/audio/win/wavein_input_win.h"
15 #include "media/audio/win/waveout_output_win.h" 16 #include "media/audio/win/waveout_output_win.h"
16 17
17 namespace { 18 namespace {
18 19
19 // The next 3 constants are some sensible limits to prevent integer overflow 20 // The next 3 constants are some sensible limits to prevent integer overflow
(...skipping 14 matching lines...) Expand all
34 35
35 const int kMaxInputChannels = 2; 36 const int kMaxInputChannels = 2;
36 const int kMaxSamplesPerPacket = kMaxSampleRate; 37 const int kMaxSamplesPerPacket = kMaxSampleRate;
37 // We use 3 buffers for recording audio so that if a recording callback takes 38 // We use 3 buffers for recording audio so that if a recording callback takes
38 // some time to return we won't lose audio. More buffers while recording are 39 // some time to return we won't lose audio. More buffers while recording are
39 // ok because they don't introduce any delay in recording, unlike in playback 40 // ok because they don't introduce any delay in recording, unlike in playback
40 // where you first need to fill in that number of buffers before starting to 41 // where you first need to fill in that number of buffers before starting to
41 // play. 42 // play.
42 const int kNumInputBuffers = 3; 43 const int kNumInputBuffers = 3;
43 44
45 AudioManagerWin* g_audio_manager = NULL;
46
44 } // namespace. 47 } // namespace.
45 48
46 bool AudioManagerWin::HasAudioOutputDevices() { 49 bool AudioManagerWin::HasAudioOutputDevices() {
47 return (::waveOutGetNumDevs() != 0); 50 return (::waveOutGetNumDevs() != 0);
48 } 51 }
49 52
50 bool AudioManagerWin::HasAudioInputDevices() { 53 bool AudioManagerWin::HasAudioInputDevices() {
51 return (::waveInGetNumDevs() != 0); 54 return (::waveInGetNumDevs() != 0);
52 } 55 }
53 56
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 118
116 void AudioManagerWin::MuteAll() { 119 void AudioManagerWin::MuteAll() {
117 } 120 }
118 121
119 void AudioManagerWin::UnMuteAll() { 122 void AudioManagerWin::UnMuteAll() {
120 } 123 }
121 124
122 AudioManagerWin::~AudioManagerWin() { 125 AudioManagerWin::~AudioManagerWin() {
123 } 126 }
124 127
125 // static 128 void DestroyAudioManagerWin(void* param) {
126 AudioManager* AudioManager::CreateAudioManager() { 129 delete g_audio_manager;
127 return new AudioManagerWin(); 130 g_audio_manager = NULL;
128 } 131 }
132
133 AudioManager* AudioManager::GetAudioManager() {
134 if (!g_audio_manager) {
135 g_audio_manager = new AudioManagerWin();
136 base::AtExitManager::RegisterCallback(&DestroyAudioManagerWin, NULL);
137 }
138 return g_audio_manager;
139 }
OLDNEW
« no previous file with comments | « media/audio/win/audio_manager_win.h ('k') | media/filters/audio_renderer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698