media.c2 aidl: Unwrap AHardwareBuffer based handle from existing APIs
Support AHardwareBuffer based handle from existing APIs.
android::UnwrapNativeCodec2GrallocHandle()
android::ExtractFormatFromCodec2GrallocHandle()
android::_UnwrapNativeCodec2GrallocMetadata()
Bug: 321808716
Bug: 321674574
Test: atest android.media.decoder.cts.AdaptivePlaybackTest
Change-Id: I9760e9ca4c0d0178aa8db9542a03c8d6f972a2c0
diff --git a/media/codec2/sfplugin/Codec2Buffer.cpp b/media/codec2/sfplugin/Codec2Buffer.cpp
index 5c1755e..4f466c5 100644
--- a/media/codec2/sfplugin/Codec2Buffer.cpp
+++ b/media/codec2/sfplugin/Codec2Buffer.cpp
@@ -1049,11 +1049,8 @@
// Unwrap raw buffer handle from the C2Handle
native_handle_t *nh = UnwrapNativeCodec2GrallocHandle(handle);
if (!nh) {
- nh = UnwrapNativeCodec2AhwbHandle(handle);
- if (!nh) {
- ALOGE("handle is not compatible to neither C2HandleGralloc nor C2HandleAhwb");
- return;
- }
+ ALOGE("handle is not compatible to any gralloc C2Handle types");
+ 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.