summaryrefslogtreecommitdiffstats
path: root/media/jni
diff options
context:
space:
mode:
authorEino-Ville Talvala <etalvala@google.com>2015-06-09 14:15:15 -0700
committerEino-Ville Talvala <etalvala@google.com>2015-06-09 14:15:15 -0700
commitef9db7d81b0ce1093944b9e3d5efb6ab756f5cbc (patch)
tree1da0095e07b68bbda31cbc64144ae6cc4cf0af10 /media/jni
parente37cf3b8d614019c5570f945110bfbc5a8b09713 (diff)
downloadframeworks_base-ef9db7d81b0ce1093944b9e3d5efb6ab756f5cbc.zip
frameworks_base-ef9db7d81b0ce1093944b9e3d5efb6ab756f5cbc.tar.gz
frameworks_base-ef9db7d81b0ce1093944b9e3d5efb6ab756f5cbc.tar.bz2
Add more specific consumer names for common buffer queue endpoints.
Change-Id: I744bdcba6e60e5efd8865f725b09a9f791d76160
Diffstat (limited to 'media/jni')
-rw-r--r--media/jni/android_media_ImageReader.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/media/jni/android_media_ImageReader.cpp b/media/jni/android_media_ImageReader.cpp
index 49614bd..635fa11 100644
--- a/media/jni/android_media_ImageReader.cpp
+++ b/media/jni/android_media_ImageReader.cpp
@@ -72,6 +72,12 @@ static struct {
jmethodID ctor;
} gSurfacePlaneClassInfo;
+// Get an ID that's unique within this process.
+static int32_t createProcessUniqueId() {
+ static volatile int32_t globalCounter = 0;
+ return android_atomic_inc(&globalCounter);
+}
+
// ----------------------------------------------------------------------------
class JNIImageReaderContext : public ConsumerBase::FrameAvailableListener
@@ -808,6 +814,9 @@ static void ImageReader_init(JNIEnv* env, jobject thiz, jobject weakThiz,
sp<ConsumerBase> consumer;
sp<CpuConsumer> cpuConsumer;
sp<BufferItemConsumer> opaqueConsumer;
+ String8 consumerName = String8::format("ImageReader-%dx%df%xm%d-%d-%d",
+ width, height, format, maxImages, getpid(),
+ createProcessUniqueId());
if (isFormatOpaque(nativeFormat)) {
// Use the SW_READ_NEVER usage to tell producer that this format is not for preview or video
// encoding. The only possibility will be ZSL output.
@@ -819,6 +828,7 @@ static void ImageReader_init(JNIEnv* env, jobject thiz, jobject weakThiz,
return;
}
ctx->setOpaqueConsumer(opaqueConsumer);
+ opaqueConsumer->setName(consumerName);
consumer = opaqueConsumer;
} else {
cpuConsumer = new CpuConsumer(gbConsumer, maxImages, /*controlledByApp*/true);
@@ -828,6 +838,7 @@ static void ImageReader_init(JNIEnv* env, jobject thiz, jobject weakThiz,
return;
}
ctx->setCpuConsumer(cpuConsumer);
+ cpuConsumer->setName(consumerName);
consumer = cpuConsumer;
}