| 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 <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 // Custom compare operator for the AudioRendererMixerMap. Allows reuse of | 89 // Custom compare operator for the AudioRendererMixerMap. Allows reuse of |
| 90 // mixers where only irrelevant keys mismatch; e.g., effects, bits per sample. | 90 // mixers where only irrelevant keys mismatch; e.g., effects, bits per sample. |
| 91 struct MixerKeyCompare { | 91 struct MixerKeyCompare { |
| 92 bool operator()(const MixerKey& a, const MixerKey& b) const { | 92 bool operator()(const MixerKey& a, const MixerKey& b) const { |
| 93 if (a.source_render_frame_id != b.source_render_frame_id) | 93 if (a.source_render_frame_id != b.source_render_frame_id) |
| 94 return a.source_render_frame_id < b.source_render_frame_id; | 94 return a.source_render_frame_id < b.source_render_frame_id; |
| 95 if (a.params.channels() != b.params.channels()) | 95 if (a.params.channels() != b.params.channels()) |
| 96 return a.params.channels() < b.params.channels(); | 96 return a.params.channels() < b.params.channels(); |
| 97 if (a.params.effects() != b.params.effects()) |
| 98 return a.params.effects() < b.params.effects(); |
| 97 | 99 |
| 98 // Ignore effects(), bits_per_sample(), format(), and frames_per_buffer(), | 100 // Ignore bits_per_sample(), format(), and frames_per_buffer(), these |
| 99 // these parameters do not affect mixer reuse. All AudioRendererMixer | 101 // parameters do not affect mixer reuse. All AudioRendererMixer units |
| 100 // units disable FIFO, so frames_per_buffer() can be safely ignored. | 102 // disable FIFO, so frames_per_buffer() can be safely ignored. |
| 101 if (a.params.channel_layout() != b.params.channel_layout()) | 103 if (a.params.channel_layout() != b.params.channel_layout()) |
| 102 return a.params.channel_layout() < b.params.channel_layout(); | 104 return a.params.channel_layout() < b.params.channel_layout(); |
| 103 | 105 |
| 104 if (a.device_id != b.device_id) | 106 if (a.device_id != b.device_id) |
| 105 return a.device_id < b.device_id; | 107 return a.device_id < b.device_id; |
| 106 | 108 |
| 107 return a.security_origin < b.security_origin; | 109 return a.security_origin < b.security_origin; |
| 108 } | 110 } |
| 109 }; | 111 }; |
| 110 | 112 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 126 base::Lock mixers_lock_; | 128 base::Lock mixers_lock_; |
| 127 | 129 |
| 128 media::AudioRendererSink* sink_for_testing_; | 130 media::AudioRendererSink* sink_for_testing_; |
| 129 | 131 |
| 130 DISALLOW_COPY_AND_ASSIGN(AudioRendererMixerManager); | 132 DISALLOW_COPY_AND_ASSIGN(AudioRendererMixerManager); |
| 131 }; | 133 }; |
| 132 | 134 |
| 133 } // namespace content | 135 } // namespace content |
| 134 | 136 |
| 135 #endif // CONTENT_RENDERER_MEDIA_AUDIO_RENDERER_MIXER_MANAGER_H_ | 137 #endif // CONTENT_RENDERER_MEDIA_AUDIO_RENDERER_MIXER_MANAGER_H_ |
| OLD | NEW |