Chromium Code Reviews| Index: media/audio/audio_parameters.h |
| diff --git a/media/audio/audio_parameters.h b/media/audio/audio_parameters.h |
| index 3820d8cc3c91de2f3f7168d58074d2b25f8a4072..d6b330679d8d6264ee2ef0ddd9d3044ddd12a37a 100644 |
| --- a/media/audio/audio_parameters.h |
| +++ b/media/audio/audio_parameters.h |
| @@ -5,24 +5,41 @@ |
| #ifndef MEDIA_AUDIO_AUDIO_PARAMETERS_H_ |
| #define MEDIA_AUDIO_AUDIO_PARAMETERS_H_ |
| +#include <stdint.h> |
| #include <string> |
| #include "base/basictypes.h" |
| +#include "base/compiler_specific.h" |
| #include "base/time/time.h" |
| +#include "media/base/audio_bus.h" |
| #include "media/base/channel_layout.h" |
| #include "media/base/media_export.h" |
| namespace media { |
| -struct MEDIA_EXPORT AudioInputBufferParameters { |
| +// Use a struct-in-struct approach to ensure that we can calculate the required |
| +// size as sizeof(AudioInputBufferParameters) + #(bytes in audio buffer) without |
| +// using packing. Also align AudioInputBufferParameters instead of in |
| +// AudioInputBuffer to be able to calculate size like so. |
| +#if defined(OS_WIN) |
| +#pragma warning(push) |
| +#pragma warning(disable: 4324) // Disable warning for added padding. |
| +#endif |
| +struct MEDIA_EXPORT ALIGNAS(16) AudioInputBufferParameters { |
|
tommi (sloooow) - chröme
2015/08/20 14:59:58
maybe add a comment here that 16 == kChannelAlignm
Henrik Grunell
2015/08/20 16:59:37
Follow-up: https://codereview.chromium.org/1302953
|
| double volume; |
| uint32 size; |
| + uint32_t hardware_delay_bytes; |
| + uint32_t id; |
| bool key_pressed; |
| }; |
| +#if defined(OS_WIN) |
| +#pragma warning(pop) |
| +#endif |
| + |
| +COMPILE_ASSERT( |
| + sizeof(AudioInputBufferParameters) % AudioBus::kChannelAlignment == 0, |
| + AudioInputBufferParameters_not_aligned); |
| -// Use a struct-in-struct approach to ensure that we can calculate the required |
| -// size as sizeof(AudioInputBufferParameters) + #(bytes in audio buffer) without |
| -// using packing. |
| struct MEDIA_EXPORT AudioInputBuffer { |
| AudioInputBufferParameters params; |
| int8 audio[1]; |