Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3ee519e1 authored by Phil Burk's avatar Phil Burk
Browse files

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
parent 686dac0c
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -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;
    };
@@ -59,6 +61,8 @@ typedef struct AAudioServiceMessage_s {

    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
    };