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

Commit c47a784d authored by Jasmine Cha's avatar Jasmine Cha
Browse files

oboeservice: call to hal again to close transport FD by binder



- base on hardware binder design, the transport data from binder will be
closed on the next transact(...).
- Here AAudio call to Audio HAL again to trigger BC_FREE_BUFFER to
release previous data (the shared FD from Audio HAL by createMmapBuffer)
in binder driver.

Bug: 187502463

Test: open/close mmap several times.

Signed-off-by: default avatarJasmine Cha <chajasmine@google.com>
Change-Id: I82ae6d1c62fc12f90f2b18641920e239c3632891
parent b228994b
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -237,6 +237,12 @@ aaudio_result_t AAudioServiceEndpointMMAP::openWithFormat(audio_format_t audioFo
        result = AAUDIO_ERROR_INTERNAL;
        goto error;
    }
    // Call to HAL to make sure the transport FD was able to be closed by binder.
    // This is a tricky workaround for a problem in Binder.
    // TODO:[b/192048842] When that problem is fixed we may be able to remove or change this code.
    struct audio_mmap_position position;
    mMmapStream->getMmapPosition(&position);

    mFramesPerBurst = mMmapBufferinfo.burst_size_frames;
    setFormat(config.format);
    setSampleRate(config.sample_rate);