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

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

Issue 1051863003: Turn ThreadPriority enum into an enum class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@setthreadpri
Patch Set: nits Created 5 years, 8 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
« no previous file with comments | « media/audio/win/audio_low_latency_input_win.cc ('k') | no next file » | 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) 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
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
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
OLDNEW
« no previous file with comments | « media/audio/win/audio_low_latency_input_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698