audio: Add check for MMap buffer size to the default implementation
Add documentation and check that 'minSizeFrames' parameter is a positive value. Previously a similar check was added to Pixel HAL. Bug: 141989952 Test: atest VtsHalAudioV6_0TargetTest Change-Id: I526431fc214f7f5bc424f0c9e4c890cf918ca2b2
This commit is contained in:
parent
b524bbb922
commit
b2178b9248
3 changed files with 7 additions and 1 deletions
|
@ -274,6 +274,7 @@ interface IStream {
|
|||
*
|
||||
* @param minSizeFrames minimum buffer size requested. The actual buffer
|
||||
* size returned in struct MmapBufferInfo can be larger.
|
||||
* The size must be a positive value.
|
||||
* @return retval OK in case the success.
|
||||
* NOT_SUPPORTED on non mmap mode streams
|
||||
* NOT_INITIALIZED in case of memory allocation error
|
||||
|
|
|
@ -157,6 +157,10 @@ Return<void> StreamMmap<T>::createMmapBuffer(int32_t minSizeFrames, size_t frame
|
|||
native_handle_t* hidlHandle = nullptr;
|
||||
|
||||
if (mStream->create_mmap_buffer != NULL) {
|
||||
if (minSizeFrames <= 0) {
|
||||
retval = Result::INVALID_ARGUMENTS;
|
||||
goto exit;
|
||||
}
|
||||
struct audio_mmap_buffer_info halInfo;
|
||||
retval = Stream::analyzeStatus(
|
||||
"create_mmap_buffer", mStream->create_mmap_buffer(mStream, minSizeFrames, &halInfo));
|
||||
|
@ -184,6 +188,7 @@ Return<void> StreamMmap<T>::createMmapBuffer(int32_t minSizeFrames, size_t frame
|
|||
info.burstSizeFrames = halInfo.burst_size_frames;
|
||||
}
|
||||
}
|
||||
exit:
|
||||
_hidl_cb(retval, info);
|
||||
if (hidlHandle != nullptr) {
|
||||
native_handle_delete(hidlHandle);
|
||||
|
|
|
@ -589,7 +589,7 @@ e966a3437d6a98d9d9e14e9d672088771716031900c0deb55a0946c751a03a44 android.hardwar
|
|||
2736c59abaccacac407ebe80c5e48d446edf015051d05632fb679ba471779e6e android.hardware.audio@6.0::IDevice
|
||||
2402876cbc23c0de3690a665eca84fd3857d1808dba5cad25ce272f81ecef8c9 android.hardware.audio@6.0::IDevicesFactory
|
||||
bca5379d5065e2e08b6ad7308ffc8a71a972fc0698bec678ea32eea786d01cb5 android.hardware.audio@6.0::IPrimaryDevice
|
||||
7318b521ea12fdd4b6e3f381085c71784c810d1ec7a8d701ec2250f3f86712e4 android.hardware.audio@6.0::IStream
|
||||
fd1f1b29f26b42e886220f04a08086c00e5ade9d7b53f095438e578ab9d42a93 android.hardware.audio@6.0::IStream
|
||||
2df5d5866b37776f25079c0e54b54350a2abe4e025a59c9e02a7d3abe8ca00e8 android.hardware.audio@6.0::IStreamIn
|
||||
78e4138cc8307c11fc777c3bd376e581ba4ba48196b05ca1d7cdfa515c87b48a android.hardware.audio@6.0::IStreamOut
|
||||
997fdaad7a9d17ee7e01feb7031a753e2365e72ad30b11d950e9183fabdf3844 android.hardware.audio@6.0::IStreamOutCallback
|
||||
|
|
Loading…
Reference in a new issue