Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(448)

Unified Diff: media/audio/audio_parameters.h

Issue 1302953002: Use macro for AudioInputBufferParameters alignment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@check_sequence_input_process_boundary
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/audio_parameters.h
diff --git a/media/audio/audio_parameters.h b/media/audio/audio_parameters.h
index d6b330679d8d6264ee2ef0ddd9d3044ddd12a37a..a73982e6ba259721770158a9c00bbf707b28f283 100644
--- a/media/audio/audio_parameters.h
+++ b/media/audio/audio_parameters.h
@@ -20,18 +20,24 @@ 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.
+// 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.
#if defined(OS_WIN)
#pragma warning(push)
#pragma warning(disable: 4324) // Disable warning for added padding.
#endif
-struct MEDIA_EXPORT ALIGNAS(16) AudioInputBufferParameters {
+#define PARAMETERS_ALIGNMENT 16
+COMPILE_ASSERT(AudioBus::kChannelAlignment == PARAMETERS_ALIGNMENT,
+ AudioInputBufferParameters_alignment_not_same_as_AudioBus);
+struct MEDIA_EXPORT ALIGNAS(PARAMETERS_ALIGNMENT) AudioInputBufferParameters {
double volume;
uint32 size;
uint32_t hardware_delay_bytes;
uint32_t id;
bool key_pressed;
};
+#undef PARAMETERS_ALIGNMENT
#if defined(OS_WIN)
#pragma warning(pop)
#endif
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698