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: Jasmine Cha <chajasmine@google.com>
Change-Id: I82ae6d1c62fc12f90f2b18641920e239c3632891
diff --git a/services/oboeservice/AAudioServiceEndpointMMAP.cpp b/services/oboeservice/AAudioServiceEndpointMMAP.cpp
index 117218a..a08098c 100644
--- a/services/oboeservice/AAudioServiceEndpointMMAP.cpp
+++ b/services/oboeservice/AAudioServiceEndpointMMAP.cpp
@@ -237,6 +237,12 @@
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);