| Index: media/audio/audio_parameters.h
|
| diff --git a/media/audio/audio_parameters.h b/media/audio/audio_parameters.h
|
| index c59dd30885e36672cde8eb6e1a2086ac3e94a2ee..f93688104d7a05b848942142f953bd7603b3b1a2 100644
|
| --- a/media/audio/audio_parameters.h
|
| +++ b/media/audio/audio_parameters.h
|
| @@ -19,25 +19,28 @@
|
| namespace media {
|
|
|
| // 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. Use a macro for the
|
| -// alignment value that's the same as AudioBus::kChannelAlignment, since MSVC
|
| -// doesn't accept the latter to be used.
|
| +// size as sizeof(Audio{Input,Output}BufferParameters) + #(bytes in audio
|
| +// buffer) without using packing. Also align Audio{Input,Output}BufferParameters
|
| +// instead of in Audio{Input,Output}Buffer to be able to calculate size like so.
|
| +// Use a macro for the alignment value that's the same as
|
| +// AudioBus::kChannelAlignment, since MSVC doesn't accept the latter to be used.
|
| #if defined(OS_WIN)
|
| #pragma warning(push)
|
| #pragma warning(disable: 4324) // Disable warning for added padding.
|
| #endif
|
| #define PARAMETERS_ALIGNMENT 16
|
| static_assert(AudioBus::kChannelAlignment == PARAMETERS_ALIGNMENT,
|
| - "AudioInputBufferParameters alignment not same as AudioBus");
|
| + "Audio buffer parameters struct alignment not same as AudioBus");
|
| struct MEDIA_EXPORT ALIGNAS(PARAMETERS_ALIGNMENT) AudioInputBufferParameters {
|
| double volume;
|
| - uint32 size;
|
| + uint32_t size;
|
| uint32_t hardware_delay_bytes;
|
| uint32_t id;
|
| bool key_pressed;
|
| };
|
| +struct MEDIA_EXPORT ALIGNAS(PARAMETERS_ALIGNMENT) AudioOutputBufferParameters {
|
| + uint32_t frames_skipped;
|
| +};
|
| #undef PARAMETERS_ALIGNMENT
|
| #if defined(OS_WIN)
|
| #pragma warning(pop)
|
| @@ -47,11 +50,19 @@ static_assert(sizeof(AudioInputBufferParameters) %
|
| AudioBus::kChannelAlignment ==
|
| 0,
|
| "AudioInputBufferParameters not aligned");
|
| +static_assert(sizeof(AudioOutputBufferParameters) %
|
| + AudioBus::kChannelAlignment ==
|
| + 0,
|
| + "AudioOutputBufferParameters not aligned");
|
|
|
| struct MEDIA_EXPORT AudioInputBuffer {
|
| AudioInputBufferParameters params;
|
| int8 audio[1];
|
| };
|
| +struct MEDIA_EXPORT AudioOutputBuffer {
|
| + AudioOutputBufferParameters params;
|
| + int8 audio[1];
|
| +};
|
|
|
| class MEDIA_EXPORT AudioParameters {
|
| public:
|
|
|