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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/win/audio_manager_win.cc
===================================================================
--- media/audio/win/audio_manager_win.cc (revision 57255)
+++ media/audio/win/audio_manager_win.cc (working copy)
@@ -7,6 +7,7 @@
#include <windows.h>
#include <mmsystem.h>
+#include "base/at_exit.h"
#include "base/basictypes.h"
#include "media/audio/fake_audio_input_stream.h"
#include "media/audio/fake_audio_output_stream.h"
@@ -41,6 +42,8 @@
// play.
const int kNumInputBuffers = 3;
+AudioManagerWin* g_audio_manager = NULL;
+
} // namespace.
bool AudioManagerWin::HasAudioOutputDevices() {
@@ -122,7 +125,15 @@
AudioManagerWin::~AudioManagerWin() {
}
-// static
-AudioManager* AudioManager::CreateAudioManager() {
- return new AudioManagerWin();
+void DestroyAudioManagerWin(void* param) {
+ delete g_audio_manager;
+ g_audio_manager = NULL;
}
+
+AudioManager* AudioManager::GetAudioManager() {
+ if (!g_audio_manager) {
+ g_audio_manager = new AudioManagerWin();
+ base::AtExitManager::RegisterCallback(&DestroyAudioManagerWin, NULL);
+ }
+ return g_audio_manager;
+}
« 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