summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2025-02-24 02:45:01 -0800
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2025-02-24 02:45:01 -0800
commite7400713aece81522a25dcff6ff04986685ca725 (patch)
tree796313bb29079e8154570befaffb28616def095a
parent332641fc24cb79a58e658a25d5963f3059d66837 (diff)
parentcfe728f0b9a15b2c2da274d68af8724eef64bd08 (diff)
Merge "Remove false warning message while extracting memory" into main
-rw-r--r--media/jni/android_media_MediaCodec.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/media/jni/android_media_MediaCodec.cpp b/media/jni/android_media_MediaCodec.cpp
index 61c287b9633c..ae54c18eb135 100644
--- a/media/jni/android_media_MediaCodec.cpp
+++ b/media/jni/android_media_MediaCodec.cpp
@@ -2990,11 +2990,16 @@ static void extractMemoryFromContext(
}
*memory = context->toHidlMemory();
}
- if (context->mBlock == nullptr || context->mReadWriteMapping == nullptr) {
- ALOGW("extractMemoryFromContext: Cannot extract memory as C2Block is not created/mapped");
+ if (context->mBlock == nullptr) {
+ // this should be ok as we may only have IMemory/hidlMemory
+ // e.g. video codecs may only have IMemory and no mBlock
return;
}
- if (context->mReadWriteMapping->error() != C2_OK) {
+
+ // if we have mBlock and memory, then we will copy data from mBlock to hidlMemory
+ // e.g. audio codecs may only have mBlock and wanted to decrypt using hidlMemory
+ // and also wanted to re-use mBlock
+ if (context->mReadWriteMapping == nullptr || context->mReadWriteMapping->error() != C2_OK) {
ALOGW("extractMemoryFromContext: failed to map C2Block (%d)",
context->mReadWriteMapping->error());
return;