OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/win/audio_manager_win.h" | 5 #include "media/audio/win/audio_manager_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <objbase.h> // This has to be before initguid.h | 8 #include <objbase.h> // This has to be before initguid.h |
9 #include <initguid.h> | 9 #include <initguid.h> |
10 #include <mmsystem.h> | 10 #include <mmsystem.h> |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 // out performance was degraded compared to XP. | 124 // out performance was degraded compared to XP. |
125 // - The regression was fixed in Windows 7 and most configurations will work | 125 // - The regression was fixed in Windows 7 and most configurations will work |
126 // with 2, but some (e.g., some Sound Blasters) still need 3. | 126 // with 2, but some (e.g., some Sound Blasters) still need 3. |
127 // - Some XP configurations (even multi-processor ones) also need 3. | 127 // - Some XP configurations (even multi-processor ones) also need 3. |
128 return (base::win::GetVersion() == base::win::VERSION_VISTA) ? 4 : 3; | 128 return (base::win::GetVersion() == base::win::VERSION_VISTA) ? 4 : 3; |
129 } | 129 } |
130 | 130 |
131 AudioManagerWin::AudioManagerWin( | 131 AudioManagerWin::AudioManagerWin( |
132 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 132 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
133 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, | 133 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, |
134 AudioLogFactory* audio_log_factory) | 134 AudioLogFactory* audio_log_factory, |
| 135 CreateAudioFileWriterCallback create_audio_file_writer_callback) |
135 : AudioManagerBase(std::move(task_runner), | 136 : AudioManagerBase(std::move(task_runner), |
136 std::move(worker_task_runner), | 137 std::move(worker_task_runner), |
137 audio_log_factory), | 138 audio_log_factory, |
| 139 std::move(create_audio_file_writer_callback)), |
138 // |CoreAudioUtil::IsSupported()| uses static variables to avoid doing | 140 // |CoreAudioUtil::IsSupported()| uses static variables to avoid doing |
139 // multiple initializations. This is however not thread safe. | 141 // multiple initializations. This is however not thread safe. |
140 // So, here we call it explicitly before we kick off the audio thread | 142 // So, here we call it explicitly before we kick off the audio thread |
141 // or do any other work. | 143 // or do any other work. |
142 enumeration_type_(CoreAudioUtil::IsSupported() ? kMMDeviceEnumeration | 144 enumeration_type_(CoreAudioUtil::IsSupported() ? kMMDeviceEnumeration |
143 : kWaveEnumeration) { | 145 : kWaveEnumeration) { |
144 SetMaxOutputStreamsAllowed(kMaxOutputStreams); | 146 SetMaxOutputStreamsAllowed(kMaxOutputStreams); |
145 | 147 |
146 // WARNING: This is executed on the UI loop, do not add any code here which | 148 // WARNING: This is executed on the UI loop, do not add any code here which |
147 // loads libraries or attempts to call out into the OS. Instead add such code | 149 // loads libraries or attempts to call out into the OS. Instead add such code |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 } | 541 } |
540 | 542 |
541 return new PCMWaveInAudioInputStream(this, params, kNumInputBuffers, | 543 return new PCMWaveInAudioInputStream(this, params, kNumInputBuffers, |
542 xp_device_id); | 544 xp_device_id); |
543 } | 545 } |
544 | 546 |
545 /// static | 547 /// static |
546 ScopedAudioManagerPtr CreateAudioManager( | 548 ScopedAudioManagerPtr CreateAudioManager( |
547 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 549 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
548 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, | 550 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, |
549 AudioLogFactory* audio_log_factory) { | 551 AudioLogFactory* audio_log_factory, |
| 552 CreateAudioFileWriterCallback create_audio_file_writer_callback) { |
550 return ScopedAudioManagerPtr( | 553 return ScopedAudioManagerPtr( |
551 new AudioManagerWin(std::move(task_runner), std::move(worker_task_runner), | 554 new AudioManagerWin(std::move(task_runner), std::move(worker_task_runner), |
552 audio_log_factory)); | 555 audio_log_factory, std |
| 556 : move(create_audio_file_writer_callback))); |
553 } | 557 } |
554 | 558 |
555 } // namespace media | 559 } // namespace media |
OLD | NEW |