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

Unified Diff: media/audio/audio_parameters.h

Issue 1293503002: Check buffer index in shared memory for input audio. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Now the Win compile error should really be fixed. 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 | « media/audio/audio_input_device.cc ('k') | 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 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];
« no previous file with comments | « media/audio/audio_input_device.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698