diff --git a/media/bufferpool/2.0/Android.bp b/media/bufferpool/2.0/Android.bp index 4ae3b24ac2..97f114a915 100644 --- a/media/bufferpool/2.0/Android.bp +++ b/media/bufferpool/2.0/Android.bp @@ -1,9 +1,5 @@ -cc_library { - name: "libstagefright_bufferpool@2.0", - vendor_available: true, - vndk: { - enabled: true, - }, +cc_defaults { + name: "libstagefright_bufferpool@2.0-default", srcs: [ "Accessor.cpp", "AccessorImpl.cpp", @@ -29,3 +25,23 @@ cc_library { "android.hardware.media.bufferpool@2.0", ], } + +cc_library { + name: "libstagefright_bufferpool@2.0.1", + defaults: ["libstagefright_bufferpool@2.0-default"], + vendor_available: true, + cflags: [ + "-DBUFFERPOOL_CLONE_HANDLES", + ], +} + +// Deprecated. Do not use. Use libstagefright_bufferpool@2.0.1 instead. +cc_library { + name: "libstagefright_bufferpool@2.0", + defaults: ["libstagefright_bufferpool@2.0-default"], + vendor_available: true, + vndk: { + enabled: true, + }, +} + diff --git a/media/bufferpool/2.0/ClientManager.cpp b/media/bufferpool/2.0/ClientManager.cpp index 48c2da4be4..87ee4e848e 100644 --- a/media/bufferpool/2.0/ClientManager.cpp +++ b/media/bufferpool/2.0/ClientManager.cpp @@ -351,6 +351,7 @@ ResultStatus ClientManager::Impl::allocate( } client = it->second; } +#ifdef BUFFERPOOL_CLONE_HANDLES native_handle_t *origHandle; ResultStatus res = client->allocate(params, &origHandle, buffer); if (res != ResultStatus::OK) { @@ -362,6 +363,9 @@ ResultStatus ClientManager::Impl::allocate( return ResultStatus::NO_MEMORY; } return ResultStatus::OK; +#else + return client->allocate(params, handle, buffer); +#endif } ResultStatus ClientManager::Impl::receive( @@ -377,6 +381,7 @@ ResultStatus ClientManager::Impl::receive( } client = it->second; } +#ifdef BUFFERPOOL_CLONE_HANDLES native_handle_t *origHandle; ResultStatus res = client->receive( transactionId, bufferId, timestampUs, &origHandle, buffer); @@ -389,6 +394,9 @@ ResultStatus ClientManager::Impl::receive( return ResultStatus::NO_MEMORY; } return ResultStatus::OK; +#else + return client->receive(transactionId, bufferId, timestampUs, handle, buffer); +#endif } ResultStatus ClientManager::Impl::postSend( diff --git a/media/codec2/hidl/1.0/utils/Android.bp b/media/codec2/hidl/1.0/utils/Android.bp index 9db85d5ed1..bdff29a524 100644 --- a/media/codec2/hidl/1.0/utils/Android.bp +++ b/media/codec2/hidl/1.0/utils/Android.bp @@ -24,7 +24,7 @@ cc_library { "libgui", "libhidlbase", "liblog", - "libstagefright_bufferpool@2.0", + "libstagefright_bufferpool@2.0.1", "libui", "libutils", ], @@ -37,7 +37,7 @@ cc_library { "android.hardware.media.c2@1.0", "libcodec2", "libgui", - "libstagefright_bufferpool@2.0", + "libstagefright_bufferpool@2.0.1", "libui", ], } @@ -81,7 +81,7 @@ cc_library { "libcutils", "libhidlbase", "liblog", - "libstagefright_bufferpool@2.0", + "libstagefright_bufferpool@2.0.1", "libstagefright_bufferqueue_helper", "libui", "libutils", @@ -96,7 +96,7 @@ cc_library { "libcodec2", "libcodec2_vndk", "libhidlbase", - "libstagefright_bufferpool@2.0", + "libstagefright_bufferpool@2.0.1", "libui", ], } diff --git a/media/codec2/hidl/client/Android.bp b/media/codec2/hidl/client/Android.bp index 672369c01e..89c1c4a10a 100644 --- a/media/codec2/hidl/client/Android.bp +++ b/media/codec2/hidl/client/Android.bp @@ -18,7 +18,7 @@ cc_library { "libgui", "libhidlbase", "liblog", - "libstagefright_bufferpool@2.0", + "libstagefright_bufferpool@2.0.1", "libui", "libutils", ], diff --git a/media/codec2/vndk/Android.bp b/media/codec2/vndk/Android.bp index b6ddfabf2d..52cc7adf23 100644 --- a/media/codec2/vndk/Android.bp +++ b/media/codec2/vndk/Android.bp @@ -66,7 +66,7 @@ cc_library_shared { "liblog", "libnativewindow", "libstagefright_foundation", - "libstagefright_bufferpool@2.0", + "libstagefright_bufferpool@2.0.1", "libui", "libutils", ],