| 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_low_latency_output_win.h" | 5 #include "media/audio/win/audio_low_latency_output_win.h" |
| 6 | 6 |
| 7 #include <Functiondiscoverykeys_devpkey.h> | 7 #include <Functiondiscoverykeys_devpkey.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 | 329 |
| 330 void WASAPIAudioOutputStream::GetVolume(double* volume) { | 330 void WASAPIAudioOutputStream::GetVolume(double* volume) { |
| 331 DVLOG(1) << "GetVolume()"; | 331 DVLOG(1) << "GetVolume()"; |
| 332 *volume = static_cast<double>(volume_); | 332 *volume = static_cast<double>(volume_); |
| 333 } | 333 } |
| 334 | 334 |
| 335 void WASAPIAudioOutputStream::Run() { | 335 void WASAPIAudioOutputStream::Run() { |
| 336 ScopedCOMInitializer com_init(ScopedCOMInitializer::kMTA); | 336 ScopedCOMInitializer com_init(ScopedCOMInitializer::kMTA); |
| 337 | 337 |
| 338 // Increase the thread priority. | 338 // Increase the thread priority. |
| 339 render_thread_->SetThreadPriority(base::kThreadPriority_RealtimeAudio); | 339 render_thread_->SetThreadPriority(base::ThreadPriority::REALTIME_AUDIO); |
| 340 | 340 |
| 341 // Enable MMCSS to ensure that this thread receives prioritized access to | 341 // Enable MMCSS to ensure that this thread receives prioritized access to |
| 342 // CPU resources. | 342 // CPU resources. |
| 343 DWORD task_index = 0; | 343 DWORD task_index = 0; |
| 344 HANDLE mm_task = avrt::AvSetMmThreadCharacteristics(L"Pro Audio", | 344 HANDLE mm_task = avrt::AvSetMmThreadCharacteristics(L"Pro Audio", |
| 345 &task_index); | 345 &task_index); |
| 346 bool mmcss_is_ok = | 346 bool mmcss_is_ok = |
| 347 (mm_task && avrt::AvSetMmThreadPriority(mm_task, AVRT_PRIORITY_CRITICAL)); | 347 (mm_task && avrt::AvSetMmThreadPriority(mm_task, AVRT_PRIORITY_CRITICAL)); |
| 348 if (!mmcss_is_ok) { | 348 if (!mmcss_is_ok) { |
| 349 // Failed to enable MMCSS on this thread. It is not fatal but can lead | 349 // Failed to enable MMCSS on this thread. It is not fatal but can lead |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 | 616 |
| 617 // Ensure that we don't quit the main thread loop immediately next | 617 // Ensure that we don't quit the main thread loop immediately next |
| 618 // time Start() is called. | 618 // time Start() is called. |
| 619 ResetEvent(stop_render_event_.Get()); | 619 ResetEvent(stop_render_event_.Get()); |
| 620 } | 620 } |
| 621 | 621 |
| 622 source_ = NULL; | 622 source_ = NULL; |
| 623 } | 623 } |
| 624 | 624 |
| 625 } // namespace media | 625 } // namespace media |
| OLD | NEW |