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

Side by Side Diff: media/base/audio_hardware_config.h

Issue 12387006: Pass more detailed audio hardware configuration information to the renderer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « media/audio/mac/audio_unified_mac.cc ('k') | media/base/audio_hardware_config.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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #ifndef MEDIA_BASE_AUDIO_HARDWARE_CONFIG_H_ 5 #ifndef MEDIA_BASE_AUDIO_HARDWARE_CONFIG_H_
6 #define MEDIA_BASE_AUDIO_HARDWARE_CONFIG_H_ 6 #define MEDIA_BASE_AUDIO_HARDWARE_CONFIG_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/synchronization/lock.h" 9 #include "base/synchronization/lock.h"
10 #include "media/base/channel_layout.h" 10 #include "media/base/channel_layout.h"
11 #include "media/base/media_export.h" 11 #include "media/base/media_export.h"
12 12
13 namespace media { 13 namespace media {
14 14
15 // Provides thread safe access to the audio hardware configuration. 15 // Provides thread safe access to the audio hardware configuration.
16 class MEDIA_EXPORT AudioHardwareConfig { 16 class MEDIA_EXPORT AudioHardwareConfig {
17 public: 17 public:
18 AudioHardwareConfig(int output_buffer_size, int output_sample_rate, 18 AudioHardwareConfig();
DaleCurtis 2013/02/28 02:18:08 Is this necessary?
19
20 AudioHardwareConfig(int buffer_size,
21 int output_sample_rate,
22 int output_channels,
23 ChannelLayout output_channel_layout,
19 int input_sample_rate, 24 int input_sample_rate,
25 int input_channels,
20 ChannelLayout input_channel_layout); 26 ChannelLayout input_channel_layout);
21 virtual ~AudioHardwareConfig(); 27 virtual ~AudioHardwareConfig();
22 28
29 void Reset(int buffer_size,
DaleCurtis 2013/02/28 02:18:08 output_buffer_size here and elsewhere. Why not jus
30 int output_sample_rate,
31 int output_channels,
32 ChannelLayout output_channel_layout,
33 int input_sample_rate,
34 int input_channels,
35 ChannelLayout input_channel_layout);
36
23 // Accessors for the currently cached hardware configuration. Safe to call 37 // Accessors for the currently cached hardware configuration. Safe to call
24 // from any thread. 38 // from any thread.
25 int GetOutputBufferSize(); 39 int GetOutputBufferSize() const;
26 int GetOutputSampleRate(); 40
27 int GetInputSampleRate(); 41 int GetOutputSampleRate() const;
28 ChannelLayout GetInputChannelLayout(); 42 int GetOutputChannels() const;
43 ChannelLayout GetOutputChannelLayout() const;
44
45 int GetInputSampleRate() const;
46 int GetInputChannels() const;
47 ChannelLayout GetInputChannelLayout() const;
29 48
30 // Allows callers to update the cached values for either input or output. The 49 // Allows callers to update the cached values for either input or output. The
31 // values are paired under the assumption that these values will only be set 50 // values are paired under the assumption that these values will only be set
32 // after an input or output device change respectively. Safe to call from 51 // after an input or output device change respectively. Safe to call from
33 // any thread. 52 // any thread.
34 void UpdateInputConfig(int sample_rate, media::ChannelLayout channel_layout); 53 void UpdateInputConfig(int sample_rate, media::ChannelLayout channel_layout);
35 void UpdateOutputConfig(int buffer_size, int sample_rate); 54 void UpdateOutputConfig(int buffer_size, int sample_rate);
36 55
37 private: 56 private:
38 // Cached values; access is protected by |config_lock_|. 57 // Cached values; access is protected by |config_lock_|.
39 base::Lock config_lock_; 58 mutable base::Lock config_lock_;
59
40 int output_buffer_size_; 60 int output_buffer_size_;
41 int output_sample_rate_; 61 int output_sample_rate_;
62 int output_channels_;
63 ChannelLayout output_channel_layout_;
42 int input_sample_rate_; 64 int input_sample_rate_;
65 int input_channels_;
43 ChannelLayout input_channel_layout_; 66 ChannelLayout input_channel_layout_;
44 67
45 DISALLOW_COPY_AND_ASSIGN(AudioHardwareConfig); 68 DISALLOW_COPY_AND_ASSIGN(AudioHardwareConfig);
46 }; 69 };
47 70
48 } // namespace media 71 } // namespace media
49 72
50 #endif // MEDIA_BASE_AUDIO_HARDWARE_CONFIG_H_ 73 #endif // MEDIA_BASE_AUDIO_HARDWARE_CONFIG_H_
OLDNEW
« no previous file with comments | « media/audio/mac/audio_unified_mac.cc ('k') | media/base/audio_hardware_config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698