aaudio: align AAudioServiceMessage for 32/64 bits

Chromebook sometimes runs 32 and 64-bit code together.
That caused messages between the code to be rejected because the
struct sizes did not match.
So we used alignas(8) to force members to 8 byte boundaries.

Bug: 155901581
Test: Launch OboeTester
Test: Tap TEST OUTPUT
Test: Tap OPEN and START
Test: You should get "MMAP YES" if MMAP is supported by the device.
Change-Id: I0cd6a59a974888ef17b06b38fa78f032d602cd57
gugelfrei
Phil Burk 4 years ago
parent 686dac0cdb
commit 3ee519e182

@ -44,6 +44,8 @@ typedef enum aaudio_service_event_e : uint32_t {
struct AAudioMessageEvent {
aaudio_service_event_t event;
union {
// Align so that 32 and 64-bit code can exchange messages through shared memory.
alignas(8)
double dataDouble;
int64_t dataLong;
};
@ -57,8 +59,10 @@ typedef struct AAudioServiceMessage_s {
EVENT,
};
code what;
code what;
union {
// Align so that 32 and 64-bit code can exchange messages through shared memory.
alignas(8)
AAudioMessageTimestamp timestamp; // what == TIMESTAMP
AAudioMessageEvent event; // what == EVENT
};

Loading…
Cancel
Save