components: fix default allocators list
Bug: 152617893
Bug: 152617368
Test: atest CtsMediaTestCases:MediaCodecBlockModelTest
Change-Id: I500889ca922274aca4957ca912cbddffb63cb114
diff --git a/media/codec2/components/base/SimpleC2Interface.cpp b/media/codec2/components/base/SimpleC2Interface.cpp
index c849a4e..5c019f3 100644
--- a/media/codec2/components/base/SimpleC2Interface.cpp
+++ b/media/codec2/components/base/SimpleC2Interface.cpp
@@ -21,6 +21,7 @@
// use MediaDefs here vs. MediaCodecConstants as this is not MediaCodec specific/dependent
#include <media/stagefright/foundation/MediaDefs.h>
+#include <C2PlatformSupport.h>
#include <SimpleC2Interface.h>
namespace android {
@@ -85,22 +86,24 @@
C2Allocator::id_t rawAllocator = C2AllocatorStore::DEFAULT_LINEAR;
C2BlockPool::local_id_t rawPoolId = C2BlockPool::BASIC_LINEAR;
C2BufferData::type_t codedBufferType = C2BufferData::LINEAR;
- C2Allocator::id_t codedAllocator = C2AllocatorStore::DEFAULT_LINEAR;
+ int poolMask = GetCodec2PoolMask();
+ C2Allocator::id_t preferredLinearId = GetPreferredLinearAllocatorId(poolMask);
+ C2Allocator::id_t codedAllocator = preferredLinearId;
C2BlockPool::local_id_t codedPoolId = C2BlockPool::BASIC_LINEAR;
switch (domain) {
- case C2Component::DOMAIN_IMAGE:
+ case C2Component::DOMAIN_IMAGE: [[fallthrough]];
case C2Component::DOMAIN_VIDEO:
// TODO: should we define raw image? The only difference is timestamp handling
rawBufferType = C2BufferData::GRAPHIC;
rawMediaType = MEDIA_MIMETYPE_VIDEO_RAW;
- rawAllocator = C2AllocatorStore::DEFAULT_GRAPHIC;
+ rawAllocator = C2PlatformAllocatorStore::GRALLOC;
rawPoolId = C2BlockPool::BASIC_GRAPHIC;
break;
case C2Component::DOMAIN_AUDIO:
rawBufferType = C2BufferData::LINEAR;
rawMediaType = MEDIA_MIMETYPE_AUDIO_RAW;
- rawAllocator = C2AllocatorStore::DEFAULT_LINEAR;
+ rawAllocator = preferredLinearId;
rawPoolId = C2BlockPool::BASIC_LINEAR;
break;
default: