Chromium Code Reviews| 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 MEDIA_AUDIO_AUDIO_PARAMETERS_H_ | 5 #ifndef MEDIA_AUDIO_AUDIO_PARAMETERS_H_ |
| 6 #define MEDIA_AUDIO_AUDIO_PARAMETERS_H_ | 6 #define MEDIA_AUDIO_AUDIO_PARAMETERS_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | |
| 8 #include <string> | 9 #include <string> |
| 9 | 10 |
| 10 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | |
| 11 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "media/base/audio_bus.h" | |
| 12 #include "media/base/channel_layout.h" | 15 #include "media/base/channel_layout.h" |
| 13 #include "media/base/media_export.h" | 16 #include "media/base/media_export.h" |
| 14 | 17 |
| 15 namespace media { | 18 namespace media { |
| 16 | 19 |
| 17 struct MEDIA_EXPORT AudioInputBufferParameters { | 20 struct ALIGNAS(AudioBus::kChannelAlignment) MEDIA_EXPORT |
| 21 AudioInputBufferParameters { | |
| 18 double volume; | 22 double volume; |
| 19 uint32 size; | 23 uint32 size; |
| 24 uint32_t hardware_delay_bytes; | |
| 25 uint32_t id; | |
| 20 bool key_pressed; | 26 bool key_pressed; |
| 21 }; | 27 }; |
| 22 | 28 |
| 29 COMPILE_ASSERT( | |
| 30 sizeof(AudioInputBufferParameters) % AudioBus::kChannelAlignment == 0, | |
| 31 AudioInputBufferParameters_not_aligned); | |
|
tommi (sloooow) - chröme
2015/08/18 12:44:37
I think we should apply the alignas attribute on t
Henrik Grunell
2015/08/19 14:28:38
Did that and hit dcheck in AudioBus::WrapMemory. A
| |
| 32 | |
| 23 // Use a struct-in-struct approach to ensure that we can calculate the required | 33 // Use a struct-in-struct approach to ensure that we can calculate the required |
| 24 // size as sizeof(AudioInputBufferParameters) + #(bytes in audio buffer) without | 34 // size as sizeof(AudioInputBufferParameters) + #(bytes in audio buffer) without |
| 25 // using packing. | 35 // using packing. |
| 26 struct MEDIA_EXPORT AudioInputBuffer { | 36 struct MEDIA_EXPORT AudioInputBuffer { |
| 27 AudioInputBufferParameters params; | 37 AudioInputBufferParameters params; |
| 28 int8 audio[1]; | 38 int8 audio[1]; |
| 29 }; | 39 }; |
| 30 | 40 |
| 31 class MEDIA_EXPORT AudioParameters { | 41 class MEDIA_EXPORT AudioParameters { |
| 32 public: | 42 public: |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 126 if (a.sample_rate() != b.sample_rate()) | 136 if (a.sample_rate() != b.sample_rate()) |
| 127 return a.sample_rate() < b.sample_rate(); | 137 return a.sample_rate() < b.sample_rate(); |
| 128 if (a.bits_per_sample() != b.bits_per_sample()) | 138 if (a.bits_per_sample() != b.bits_per_sample()) |
| 129 return a.bits_per_sample() < b.bits_per_sample(); | 139 return a.bits_per_sample() < b.bits_per_sample(); |
| 130 return a.frames_per_buffer() < b.frames_per_buffer(); | 140 return a.frames_per_buffer() < b.frames_per_buffer(); |
| 131 } | 141 } |
| 132 | 142 |
| 133 } // namespace media | 143 } // namespace media |
| 134 | 144 |
| 135 #endif // MEDIA_AUDIO_AUDIO_PARAMETERS_H_ | 145 #endif // MEDIA_AUDIO_AUDIO_PARAMETERS_H_ |
| OLD | NEW |