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

Side by Side Diff: media/audio/win/audio_low_latency_input_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/audio_device_thread.cc ('k') | media/audio/win/audio_low_latency_output_win.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) 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_input_win.h" 5 #include "media/audio/win/audio_low_latency_input_win.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "media/audio/win/audio_manager_win.h" 10 #include "media/audio/win/audio_manager_win.h"
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 CLSCTX_INPROC_SERVER, 346 CLSCTX_INPROC_SERVER,
347 NULL, 347 NULL,
348 audio_client.ReceiveVoid()); 348 audio_client.ReceiveVoid());
349 return SUCCEEDED(hr) ? audio_client->GetMixFormat(device_format) : hr; 349 return SUCCEEDED(hr) ? audio_client->GetMixFormat(device_format) : hr;
350 } 350 }
351 351
352 void WASAPIAudioInputStream::Run() { 352 void WASAPIAudioInputStream::Run() {
353 ScopedCOMInitializer com_init(ScopedCOMInitializer::kMTA); 353 ScopedCOMInitializer com_init(ScopedCOMInitializer::kMTA);
354 354
355 // Increase the thread priority. 355 // Increase the thread priority.
356 capture_thread_->SetThreadPriority(base::kThreadPriority_RealtimeAudio); 356 capture_thread_->SetThreadPriority(base::ThreadPriority::REALTIME_AUDIO);
357 357
358 // Enable MMCSS to ensure that this thread receives prioritized access to 358 // Enable MMCSS to ensure that this thread receives prioritized access to
359 // CPU resources. 359 // CPU resources.
360 DWORD task_index = 0; 360 DWORD task_index = 0;
361 HANDLE mm_task = avrt::AvSetMmThreadCharacteristics(L"Pro Audio", 361 HANDLE mm_task = avrt::AvSetMmThreadCharacteristics(L"Pro Audio",
362 &task_index); 362 &task_index);
363 bool mmcss_is_ok = 363 bool mmcss_is_ok =
364 (mm_task && avrt::AvSetMmThreadPriority(mm_task, AVRT_PRIORITY_CRITICAL)); 364 (mm_task && avrt::AvSetMmThreadPriority(mm_task, AVRT_PRIORITY_CRITICAL));
365 if (!mmcss_is_ok) { 365 if (!mmcss_is_ok) {
366 // Failed to enable MMCSS on this thread. It is not fatal but can lead 366 // Failed to enable MMCSS on this thread. It is not fatal but can lead
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 return hr; 762 return hr;
763 763
764 // Obtain a reference to the ISimpleAudioVolume interface which enables 764 // Obtain a reference to the ISimpleAudioVolume interface which enables
765 // us to control the master volume level of an audio session. 765 // us to control the master volume level of an audio session.
766 hr = audio_client_->GetService(__uuidof(ISimpleAudioVolume), 766 hr = audio_client_->GetService(__uuidof(ISimpleAudioVolume),
767 simple_audio_volume_.ReceiveVoid()); 767 simple_audio_volume_.ReceiveVoid());
768 return hr; 768 return hr;
769 } 769 }
770 770
771 } // namespace media 771 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/audio_device_thread.cc ('k') | media/audio/win/audio_low_latency_output_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698