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

Side by Side Diff: media/audio/win/audio_low_latency_input_win.h

Issue 2914593002: Replace deprecated base::NonThreadSafe in media/audio in favor of SequenceChecker. (Closed)
Patch Set: Created 3 years, 6 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/sounds/sounds_manager.cc ('k') | media/audio/win/audio_low_latency_input_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 // Implementation of AudioInputStream for Windows using Windows Core Audio 5 // Implementation of AudioInputStream for Windows using Windows Core Audio
6 // WASAPI for low latency capturing. 6 // WASAPI for low latency capturing.
7 // 7 //
8 // Overview of operation: 8 // Overview of operation:
9 // 9 //
10 // - An object of WASAPIAudioInputStream is created by the AudioManager 10 // - An object of WASAPIAudioInputStream is created by the AudioManager
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 #include <MMDeviceAPI.h> 60 #include <MMDeviceAPI.h>
61 #include <endpointvolume.h> 61 #include <endpointvolume.h>
62 #include <stddef.h> 62 #include <stddef.h>
63 #include <stdint.h> 63 #include <stdint.h>
64 64
65 #include <memory> 65 #include <memory>
66 #include <string> 66 #include <string>
67 67
68 #include "base/compiler_specific.h" 68 #include "base/compiler_specific.h"
69 #include "base/macros.h" 69 #include "base/macros.h"
70 #include "base/threading/non_thread_safe.h" 70 #include "base/sequence_checker.h"
71 #include "base/threading/platform_thread.h" 71 #include "base/threading/platform_thread.h"
72 #include "base/threading/simple_thread.h" 72 #include "base/threading/simple_thread.h"
73 #include "base/win/scoped_co_mem.h" 73 #include "base/win/scoped_co_mem.h"
74 #include "base/win/scoped_com_initializer.h" 74 #include "base/win/scoped_com_initializer.h"
75 #include "base/win/scoped_comptr.h" 75 #include "base/win/scoped_comptr.h"
76 #include "base/win/scoped_handle.h" 76 #include "base/win/scoped_handle.h"
77 #include "media/audio/agc_audio_stream.h" 77 #include "media/audio/agc_audio_stream.h"
78 #include "media/base/audio_converter.h" 78 #include "media/base/audio_converter.h"
79 #include "media/base/audio_parameters.h" 79 #include "media/base/audio_parameters.h"
80 #include "media/base/media_export.h" 80 #include "media/base/media_export.h"
81 81
82 namespace media { 82 namespace media {
83 83
84 class AudioBlockFifo; 84 class AudioBlockFifo;
85 class AudioBus; 85 class AudioBus;
86 class AudioManagerWin; 86 class AudioManagerWin;
87 87
88 // AudioInputStream implementation using Windows Core Audio APIs. 88 // AudioInputStream implementation using Windows Core Audio APIs.
89 class MEDIA_EXPORT WASAPIAudioInputStream 89 class MEDIA_EXPORT WASAPIAudioInputStream
90 : public AgcAudioStream<AudioInputStream>, 90 : public AgcAudioStream<AudioInputStream>,
91 public base::DelegateSimpleThread::Delegate, 91 public base::DelegateSimpleThread::Delegate,
92 public AudioConverter::InputCallback, 92 public AudioConverter::InputCallback {
93 NON_EXPORTED_BASE(public base::NonThreadSafe) {
94 public: 93 public:
95 // The ctor takes all the usual parameters, plus |manager| which is the 94 // The ctor takes all the usual parameters, plus |manager| which is the
96 // the audio manager who is creating this object. 95 // the audio manager who is creating this object.
97 WASAPIAudioInputStream(AudioManagerWin* manager, 96 WASAPIAudioInputStream(AudioManagerWin* manager,
98 const AudioParameters& params, 97 const AudioParameters& params,
99 const std::string& device_id); 98 const std::string& device_id);
100 99
101 // The dtor is typically called by the AudioManager only and it is usually 100 // The dtor is typically called by the AudioManager only and it is usually
102 // triggered by calling AudioInputStream::Close(). 101 // triggered by calling AudioInputStream::Close().
103 ~WASAPIAudioInputStream() override; 102 ~WASAPIAudioInputStream() override;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 247
249 // Used for the captured audio on the callback thread. 248 // Used for the captured audio on the callback thread.
250 std::unique_ptr<AudioBlockFifo> fifo_; 249 std::unique_ptr<AudioBlockFifo> fifo_;
251 250
252 // If the caller requires resampling (should only be in exceptional cases and 251 // If the caller requires resampling (should only be in exceptional cases and
253 // ideally, never), we support using an AudioConverter. 252 // ideally, never), we support using an AudioConverter.
254 std::unique_ptr<AudioConverter> converter_; 253 std::unique_ptr<AudioConverter> converter_;
255 std::unique_ptr<AudioBus> convert_bus_; 254 std::unique_ptr<AudioBus> convert_bus_;
256 bool imperfect_buffer_size_conversion_ = false; 255 bool imperfect_buffer_size_conversion_ = false;
257 256
257 SEQUENCE_CHECKER(sequence_checker_);
258
258 DISALLOW_COPY_AND_ASSIGN(WASAPIAudioInputStream); 259 DISALLOW_COPY_AND_ASSIGN(WASAPIAudioInputStream);
259 }; 260 };
260 261
261 } // namespace media 262 } // namespace media
262 263
263 #endif // MEDIA_AUDIO_WIN_AUDIO_LOW_LATENCY_INPUT_WIN_H_ 264 #endif // MEDIA_AUDIO_WIN_AUDIO_LOW_LATENCY_INPUT_WIN_H_
OLDNEW
« no previous file with comments | « media/audio/sounds/sounds_manager.cc ('k') | media/audio/win/audio_low_latency_input_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698