media.c2 aidl: Handle Gralloc buffer conversion from C2HandleAhwb
Currently only C2HandleGralloc can be converted to Gralloc buffer.
Handle conversion from C2HandleAhwb to Gralloc buffer.
Bug: 317372247
Test: atest android.media.codec.cts.DecodeEditEncodeTest
Change-Id: I187faf80e94298db09bb2fbe36f86bf8d8ae5fca
diff --git a/media/codec2/sfplugin/Codec2Buffer.cpp b/media/codec2/sfplugin/Codec2Buffer.cpp
index 3bb6593..5c1755e 100644
--- a/media/codec2/sfplugin/Codec2Buffer.cpp
+++ b/media/codec2/sfplugin/Codec2Buffer.cpp
@@ -1049,7 +1049,11 @@
// Unwrap raw buffer handle from the C2Handle
native_handle_t *nh = UnwrapNativeCodec2GrallocHandle(handle);
if (!nh) {
- return;
+ nh = UnwrapNativeCodec2AhwbHandle(handle);
+ if (!nh) {
+ ALOGE("handle is not compatible to neither C2HandleGralloc nor C2HandleAhwb");
+ return;
+ }
}
// Import the raw handle so IMapper can use the buffer. The imported
// handle must be freed when the client is done with the buffer.