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 #ifndef CONTENT_RENDERER_MEDIA_AUDIO_RENDERER_MIXER_MANAGER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_AUDIO_RENDERER_MIXER_MANAGER_H_ |
6 #define CONTENT_RENDERER_MEDIA_AUDIO_RENDERER_MIXER_MANAGER_H_ | 6 #define CONTENT_RENDERER_MEDIA_AUDIO_RENDERER_MIXER_MANAGER_H_ |
7 | 7 |
8 #include <bitset> | 8 #include <bitset> |
9 #include <map> | 9 #include <map> |
10 #include <memory> | 10 #include <memory> |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
109 | 109 |
110 // Custom compare operator for the AudioRendererMixerMap. Allows reuse of | 110 // Custom compare operator for the AudioRendererMixerMap. Allows reuse of |
111 // mixers where only irrelevant keys mismatch; e.g., effects, bits per sample. | 111 // mixers where only irrelevant keys mismatch; e.g., effects, bits per sample. |
112 struct MixerKeyCompare { | 112 struct MixerKeyCompare { |
113 bool operator()(const MixerKey& a, const MixerKey& b) const { | 113 bool operator()(const MixerKey& a, const MixerKey& b) const { |
114 if (a.source_render_frame_id != b.source_render_frame_id) | 114 if (a.source_render_frame_id != b.source_render_frame_id) |
115 return a.source_render_frame_id < b.source_render_frame_id; | 115 return a.source_render_frame_id < b.source_render_frame_id; |
116 if (a.params.channels() != b.params.channels()) | 116 if (a.params.channels() != b.params.channels()) |
117 return a.params.channels() < b.params.channels(); | 117 return a.params.channels() < b.params.channels(); |
118 | 118 |
119 if (a.latency != b.latency) | 119 if ((a.latency == media::AudioLatency::LATENCY_EXACT_MS || |
120 b.latency == media::AudioLatency::LATENCY_EXACT_MS) && | |
121 a.params.GetBufferDuration() != b.params.GetBufferDuration()) { | |
122 return a.params.GetBufferDuration() < b.params.GetBufferDuration(); | |
123 } else if (a.latency != b.latency) | |
Andrew MacPherson
2017/03/14 12:03:03
In audio_renderer_mixer_manager_unittest.cc it's e
o1ka
2017/03/14 15:55:43
Let's not touch mixers at all. WebAudio is not sup
Andrew MacPherson
2017/03/15 15:08:17
Ok great, I've reverted this now.
| |
120 return a.latency < b.latency; | 124 return a.latency < b.latency; |
121 | 125 |
122 // TODO(olka) add buffer duration comparison for LATENCY_EXACT_MS when | |
123 // adding support for it. | |
124 DCHECK_NE(media::AudioLatency::LATENCY_EXACT_MS, a.latency); | |
125 | |
126 // Ignore effects(), bits_per_sample(), format(), and frames_per_buffer(), | 126 // Ignore effects(), bits_per_sample(), format(), and frames_per_buffer(), |
127 // these parameters do not affect mixer reuse. All AudioRendererMixer | 127 // these parameters do not affect mixer reuse. All AudioRendererMixer |
128 // units disable FIFO, so frames_per_buffer() can be safely ignored. | 128 // units disable FIFO, so frames_per_buffer() can be safely ignored. |
129 if (a.params.channel_layout() != b.params.channel_layout()) | 129 if (a.params.channel_layout() != b.params.channel_layout()) |
130 return a.params.channel_layout() < b.params.channel_layout(); | 130 return a.params.channel_layout() < b.params.channel_layout(); |
131 | 131 |
132 if (media::AudioDeviceDescription::IsDefaultDevice(a.device_id) && | 132 if (media::AudioDeviceDescription::IsDefaultDevice(a.device_id) && |
133 media::AudioDeviceDescription::IsDefaultDevice(b.device_id)) { | 133 media::AudioDeviceDescription::IsDefaultDevice(b.device_id)) { |
134 // Both device IDs represent the same default device => do not compare | 134 // Both device IDs represent the same default device => do not compare |
135 // them; the default device is always authorized => ignoring security | 135 // them; the default device is always authorized => ignoring security |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
167 // Map of the output latencies encountered throughout mixer manager lifetime. | 167 // Map of the output latencies encountered throughout mixer manager lifetime. |
168 // Used for UMA histogram logging. | 168 // Used for UMA histogram logging. |
169 std::bitset<media::AudioLatency::LATENCY_COUNT> latency_map_; | 169 std::bitset<media::AudioLatency::LATENCY_COUNT> latency_map_; |
170 | 170 |
171 DISALLOW_COPY_AND_ASSIGN(AudioRendererMixerManager); | 171 DISALLOW_COPY_AND_ASSIGN(AudioRendererMixerManager); |
172 }; | 172 }; |
173 | 173 |
174 } // namespace content | 174 } // namespace content |
175 | 175 |
176 #endif // CONTENT_RENDERER_MEDIA_AUDIO_RENDERER_MIXER_MANAGER_H_ | 176 #endif // CONTENT_RENDERER_MEDIA_AUDIO_RENDERER_MIXER_MANAGER_H_ |
OLD | NEW |