Merge "Better transport stream timestamp handling." into jb-mr1-dev
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 8e950aa..dd491f5 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -1175,7 +1175,7 @@
         //  }
         AutoMutex lock(mLock);
         requestExit();
-        mWaitWorkCV.signal();
+        mWaitWorkCV.broadcast();
     }
     // When Thread::requestExitAndWait is made virtual and this method is renamed to
     // "virtual status_t requestExitAndWait()", replace by "return Thread::requestExitAndWait();"
@@ -6323,7 +6323,7 @@
         mActiveTrack->mState = TrackBase::RESUMING;
         // signal thread to start
         ALOGV("Signal record thread");
-        mWaitWorkCV.signal();
+        mWaitWorkCV.broadcast();
         // do not wait for mStartStopCond if exiting
         if (exitPending()) {
             mActiveTrack.clear();
diff --git a/services/camera/libcameraservice/Camera2Client.cpp b/services/camera/libcameraservice/Camera2Client.cpp
index 495feda..a83977f 100644
--- a/services/camera/libcameraservice/Camera2Client.cpp
+++ b/services/camera/libcameraservice/Camera2Client.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "Camera2Client"
+#define LOG_TAG "Camera2"
 #define ATRACE_TAG ATRACE_TAG_CAMERA
 //#define LOG_NDEBUG 0
 
@@ -102,27 +102,27 @@
     String8 threadName;
 
     mFrameProcessor = new FrameProcessor(this);
-    threadName = String8::format("Camera2Client[%d]::FrameProcessor",
+    threadName = String8::format("C2-%d-FrameProc",
             mCameraId);
     mFrameProcessor->run(threadName.string());
 
     mCaptureSequencer = new CaptureSequencer(this);
-    threadName = String8::format("Camera2Client[%d]::CaptureSequencer",
+    threadName = String8::format("C2-%d-CaptureSeq",
             mCameraId);
     mCaptureSequencer->run(threadName.string());
 
     mJpegProcessor = new JpegProcessor(this, mCaptureSequencer);
-    threadName = String8::format("Camera2Client[%d]::JpegProcessor",
+    threadName = String8::format("C2-%d-JpegProc",
             mCameraId);
     mJpegProcessor->run(threadName.string());
 
     mZslProcessor = new ZslProcessor(this, mCaptureSequencer);
-    threadName = String8::format("Camera2Client[%d]::ZslProcessor",
+    threadName = String8::format("C2-%d-ZslProc",
             mCameraId);
     mZslProcessor->run(threadName.string());
 
     mCallbackProcessor = new CallbackProcessor(this);
-    threadName = String8::format("Camera2Client[%d]::CallbackProcessor",
+    threadName = String8::format("C2-%d-CallbkProc",
             mCameraId);
     mCallbackProcessor->run(threadName.string());
 
diff --git a/services/camera/libcameraservice/Camera2Device.cpp b/services/camera/libcameraservice/Camera2Device.cpp
index 81c0496..2e4098e 100644
--- a/services/camera/libcameraservice/Camera2Device.cpp
+++ b/services/camera/libcameraservice/Camera2Device.cpp
@@ -14,7 +14,8 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "Camera2Device"
+#define LOG_TAG "Camera2-Device"
+#define ATRACE_TAG ATRACE_TAG_CAMERA
 //#define LOG_NDEBUG 0
 //#define LOG_NNDEBUG 0  // Per-frame verbose logging
 
@@ -25,6 +26,7 @@
 #endif
 
 #include <utils/Log.h>
+#include <utils/Trace.h>
 #include "Camera2Device.h"
 
 namespace android {
@@ -33,16 +35,19 @@
         mId(id),
         mDevice(NULL)
 {
+    ATRACE_CALL();
     ALOGV("%s: Created device for camera %d", __FUNCTION__, id);
 }
 
 Camera2Device::~Camera2Device()
 {
+    ATRACE_CALL();
     disconnect();
 }
 
 status_t Camera2Device::initialize(camera_module_t *module)
 {
+    ATRACE_CALL();
     ALOGV("%s: Initializing device for camera %d", __FUNCTION__, mId);
     if (mDevice != NULL) {
         ALOGE("%s: Already initialized!", __FUNCTION__);
@@ -130,6 +135,7 @@
 }
 
 status_t Camera2Device::disconnect() {
+    ATRACE_CALL();
     status_t res = OK;
     if (mDevice) {
         ALOGV("%s: Closing device for camera %d", __FUNCTION__, mId);
@@ -139,6 +145,7 @@
             ALOGW("%s: Closing camera device %d with %d requests in flight!",
                     __FUNCTION__, mId, inProgressCount);
         }
+        mReprocessStreams.clear();
         mStreams.clear();
         res = mDevice->common.close(&mDevice->common);
         if (res != OK) {
@@ -153,7 +160,7 @@
 }
 
 status_t Camera2Device::dump(int fd, const Vector<String16>& args) {
-
+    ATRACE_CALL();
     String8 result;
     int detailLevel = 0;
     int n = args.size();
@@ -200,6 +207,7 @@
 }
 
 status_t Camera2Device::capture(CameraMetadata &request) {
+    ATRACE_CALL();
     ALOGV("%s: E", __FUNCTION__);
 
     mRequestQueue.enqueue(request.release());
@@ -208,17 +216,20 @@
 
 
 status_t Camera2Device::setStreamingRequest(const CameraMetadata &request) {
+    ATRACE_CALL();
     ALOGV("%s: E", __FUNCTION__);
     CameraMetadata streamRequest(request);
     return mRequestQueue.setStreamSlot(streamRequest.release());
 }
 
 status_t Camera2Device::clearStreamingRequest() {
+    ATRACE_CALL();
     return mRequestQueue.setStreamSlot(NULL);
 }
 
 status_t Camera2Device::createStream(sp<ANativeWindow> consumer,
         uint32_t width, uint32_t height, int format, size_t size, int *id) {
+    ATRACE_CALL();
     status_t res;
     ALOGV("%s: E", __FUNCTION__);
 
@@ -239,6 +250,7 @@
 }
 
 status_t Camera2Device::createReprocessStreamFromStream(int outputId, int *id) {
+    ATRACE_CALL();
     status_t res;
     ALOGV("%s: E", __FUNCTION__);
 
@@ -276,6 +288,7 @@
 
 status_t Camera2Device::getStreamInfo(int id,
         uint32_t *width, uint32_t *height, uint32_t *format) {
+    ATRACE_CALL();
     ALOGV("%s: E", __FUNCTION__);
     bool found = false;
     StreamList::iterator streamI;
@@ -301,6 +314,7 @@
 
 status_t Camera2Device::setStreamTransform(int id,
         int transform) {
+    ATRACE_CALL();
     ALOGV("%s: E", __FUNCTION__);
     bool found = false;
     StreamList::iterator streamI;
@@ -321,6 +335,7 @@
 }
 
 status_t Camera2Device::deleteStream(int id) {
+    ATRACE_CALL();
     ALOGV("%s: E", __FUNCTION__);
     bool found = false;
     for (StreamList::iterator streamI = mStreams.begin();
@@ -346,6 +361,7 @@
 }
 
 status_t Camera2Device::deleteReprocessStream(int id) {
+    ATRACE_CALL();
     ALOGV("%s: E", __FUNCTION__);
     bool found = false;
     for (ReprocessStreamList::iterator streamI = mReprocessStreams.begin();
@@ -374,6 +390,7 @@
 
 status_t Camera2Device::createDefaultRequest(int templateId,
         CameraMetadata *request) {
+    ATRACE_CALL();
     status_t err;
     ALOGV("%s: E", __FUNCTION__);
     camera_metadata_t *rawRequest;
@@ -384,6 +401,7 @@
 }
 
 status_t Camera2Device::waitUntilDrained() {
+    ATRACE_CALL();
     static const uint32_t kSleepTime = 50000; // 50 ms
     static const uint32_t kMaxSleepTime = 10000000; // 10 s
     ALOGV("%s: Camera %d: Starting wait", __FUNCTION__, mId);
@@ -406,6 +424,7 @@
 }
 
 status_t Camera2Device::setNotifyCallback(NotificationListener *listener) {
+    ATRACE_CALL();
     status_t res;
     res = mDevice->ops->set_notify_callback(mDevice, notificationCallback,
             reinterpret_cast<void*>(listener) );
@@ -420,6 +439,7 @@
         int32_t ext2,
         int32_t ext3,
         void *user) {
+    ATRACE_CALL();
     NotificationListener *listener = reinterpret_cast<NotificationListener*>(user);
     ALOGV("%s: Notification %d, arguments %d, %d, %d", __FUNCTION__, msg_type,
             ext1, ext2, ext3);
@@ -454,6 +474,7 @@
 }
 
 status_t Camera2Device::getNextFrame(CameraMetadata *frame) {
+    ATRACE_CALL();
     status_t res;
     camera_metadata_t *rawFrame;
     res = mFrameQueue.dequeue(&rawFrame);
@@ -466,6 +487,7 @@
 }
 
 status_t Camera2Device::triggerAutofocus(uint32_t id) {
+    ATRACE_CALL();
     status_t res;
     ALOGV("%s: Triggering autofocus, id %d", __FUNCTION__, id);
     res = mDevice->ops->trigger_action(mDevice,
@@ -478,6 +500,7 @@
 }
 
 status_t Camera2Device::triggerCancelAutofocus(uint32_t id) {
+    ATRACE_CALL();
     status_t res;
     ALOGV("%s: Canceling autofocus, id %d", __FUNCTION__, id);
     res = mDevice->ops->trigger_action(mDevice,
@@ -490,6 +513,7 @@
 }
 
 status_t Camera2Device::triggerPrecaptureMetering(uint32_t id) {
+    ATRACE_CALL();
     status_t res;
     ALOGV("%s: Triggering precapture metering, id %d", __FUNCTION__, id);
     res = mDevice->ops->trigger_action(mDevice,
@@ -503,6 +527,7 @@
 
 status_t Camera2Device::pushReprocessBuffer(int reprocessStreamId,
         buffer_handle_t *buffer, wp<BufferReleasedListener> listener) {
+    ATRACE_CALL();
     ALOGV("%s: E", __FUNCTION__);
     bool found = false;
     status_t res = OK;
@@ -545,6 +570,7 @@
             mStreamSlotCount(0),
             mSignalConsumer(true)
 {
+    ATRACE_CALL();
     camera2_request_queue_src_ops::dequeue_request = consumer_dequeue;
     camera2_request_queue_src_ops::request_count = consumer_buffer_count;
     camera2_request_queue_src_ops::free_request = consumer_free;
@@ -555,6 +581,7 @@
 }
 
 Camera2Device::MetadataQueue::~MetadataQueue() {
+    ATRACE_CALL();
     Mutex::Autolock l(mMutex);
     freeBuffers(mEntries.begin(), mEntries.end());
     freeBuffers(mStreamSlot.begin(), mStreamSlot.end());
@@ -562,6 +589,7 @@
 
 // Connect to camera2 HAL as consumer (input requests/reprocessing)
 status_t Camera2Device::MetadataQueue::setConsumerDevice(camera2_device_t *d) {
+    ATRACE_CALL();
     status_t res;
     res = d->ops->set_request_queue_src_ops(d,
             this);
@@ -571,6 +599,7 @@
 }
 
 status_t Camera2Device::MetadataQueue::setProducerDevice(camera2_device_t *d) {
+    ATRACE_CALL();
     status_t res;
     res = d->ops->set_frame_queue_dst_ops(d,
             this);
@@ -579,6 +608,7 @@
 
 // Real interfaces
 status_t Camera2Device::MetadataQueue::enqueue(camera_metadata_t *buf) {
+    ATRACE_CALL();
     ALOGVV("%s: E", __FUNCTION__);
     Mutex::Autolock l(mMutex);
 
@@ -589,6 +619,7 @@
 }
 
 int Camera2Device::MetadataQueue::getBufferCount() {
+    ATRACE_CALL();
     Mutex::Autolock l(mMutex);
     if (mStreamSlotCount > 0) {
         return CAMERA2_REQUEST_QUEUE_IS_BOTTOMLESS;
@@ -599,6 +630,7 @@
 status_t Camera2Device::MetadataQueue::dequeue(camera_metadata_t **buf,
         bool incrementCount)
 {
+    ATRACE_CALL();
     ALOGVV("%s: E", __FUNCTION__);
     status_t res;
     Mutex::Autolock l(mMutex);
@@ -631,6 +663,7 @@
     mEntries.erase(mEntries.begin());
 
     if (incrementCount) {
+        ATRACE_INT("cam2_request", mFrameCount);
         camera_metadata_entry_t frameCount;
         res = find_camera_metadata_entry(b,
                 ANDROID_REQUEST_FRAME_COUNT,
@@ -663,6 +696,7 @@
 
 status_t Camera2Device::MetadataQueue::setStreamSlot(camera_metadata_t *buf)
 {
+    ATRACE_CALL();
     ALOGV("%s: E", __FUNCTION__);
     Mutex::Autolock l(mMutex);
     if (buf == NULL) {
@@ -694,6 +728,7 @@
 status_t Camera2Device::MetadataQueue::setStreamSlot(
         const List<camera_metadata_t*> &bufs)
 {
+    ATRACE_CALL();
     ALOGV("%s: E", __FUNCTION__);
     Mutex::Autolock l(mMutex);
     status_t res;
@@ -717,6 +752,7 @@
 
 status_t Camera2Device::MetadataQueue::dump(int fd,
         const Vector<String16>& args) {
+    ATRACE_CALL();
     String8 result;
     status_t notLocked;
     notLocked = mMutex.tryLock();
@@ -763,6 +799,7 @@
 }
 
 status_t Camera2Device::MetadataQueue::signalConsumerLocked() {
+    ATRACE_CALL();
     status_t res = OK;
     notEmpty.signal();
     if (mSignalConsumer && mDevice != NULL) {
@@ -780,6 +817,7 @@
         List<camera_metadata_t*>::iterator start,
         List<camera_metadata_t*>::iterator end)
 {
+    ATRACE_CALL();
     while (start != end) {
         free_camera_metadata(*start);
         start = mStreamSlot.erase(start);
@@ -820,6 +858,7 @@
         const camera2_request_queue_src_ops_t *q,
         camera_metadata_t *old_buffer)
 {
+    ATRACE_CALL();
     MetadataQueue *queue = getInstance(q);
     free_camera_metadata(old_buffer);
     return OK;
@@ -830,6 +869,7 @@
         size_t entries, size_t bytes,
         camera_metadata_t **buffer)
 {
+    ATRACE_CALL();
     camera_metadata_t *new_buffer =
             allocate_camera_metadata(entries, bytes);
     if (new_buffer == NULL) return NO_MEMORY;
@@ -841,6 +881,7 @@
         const camera2_frame_queue_dst_ops_t *q,
         camera_metadata_t *old_buffer)
 {
+    ATRACE_CALL();
     free_camera_metadata(old_buffer);
     return OK;
 }
@@ -881,6 +922,7 @@
 }
 
 Camera2Device::StreamAdapter::~StreamAdapter() {
+    ATRACE_CALL();
     if (mState != RELEASED) {
         release();
     }
@@ -889,6 +931,7 @@
 status_t Camera2Device::StreamAdapter::connectToDevice(
         sp<ANativeWindow> consumer,
         uint32_t width, uint32_t height, int format, size_t size) {
+    ATRACE_CALL();
     status_t res;
     ALOGV("%s: E", __FUNCTION__);
 
@@ -1057,6 +1100,7 @@
 }
 
 status_t Camera2Device::StreamAdapter::release() {
+    ATRACE_CALL();
     status_t res;
     ALOGV("%s: Releasing stream %d", __FUNCTION__, mId);
     if (mState >= ALLOCATED) {
@@ -1082,6 +1126,7 @@
 }
 
 status_t Camera2Device::StreamAdapter::setTransform(int transform) {
+    ATRACE_CALL();
     status_t res;
     if (mState < CONNECTED) {
         ALOGE("%s: Cannot set transform on unconnected stream", __FUNCTION__);
@@ -1098,6 +1143,7 @@
 
 status_t Camera2Device::StreamAdapter::dump(int fd,
         const Vector<String16>& args) {
+    ATRACE_CALL();
     String8 result = String8::format("      Stream %d: %d x %d, format 0x%x\n",
             mId, mWidth, mHeight, mFormat);
     result.appendFormat("        size %d, usage 0x%x, requested format 0x%x\n",
@@ -1121,6 +1167,7 @@
 
 int Camera2Device::StreamAdapter::dequeue_buffer(const camera2_stream_ops_t *w,
         buffer_handle_t** buffer) {
+    ATRACE_CALL();
     int res;
     StreamAdapter* stream =
             const_cast<StreamAdapter*>(static_cast<const StreamAdapter*>(w));
@@ -1148,6 +1195,7 @@
 int Camera2Device::StreamAdapter::enqueue_buffer(const camera2_stream_ops_t* w,
         int64_t timestamp,
         buffer_handle_t* buffer) {
+    ATRACE_CALL();
     StreamAdapter *stream =
             const_cast<StreamAdapter*>(static_cast<const StreamAdapter*>(w));
     stream->mFrameCount++;
@@ -1182,6 +1230,7 @@
 
 int Camera2Device::StreamAdapter::cancel_buffer(const camera2_stream_ops_t* w,
         buffer_handle_t* buffer) {
+    ATRACE_CALL();
     StreamAdapter *stream =
             const_cast<StreamAdapter*>(static_cast<const StreamAdapter*>(w));
     ALOGVV("Stream %d cancel: Buffer %p",
@@ -1206,6 +1255,7 @@
 
 int Camera2Device::StreamAdapter::set_crop(const camera2_stream_ops_t* w,
         int left, int top, int right, int bottom) {
+    ATRACE_CALL();
     int state = static_cast<const StreamAdapter*>(w)->mState;
     if (state != ACTIVE) {
         ALOGE("%s: Called when in bad state: %d", __FUNCTION__, state);
@@ -1233,11 +1283,13 @@
         mActiveBuffers(0),
         mFrameCount(0)
 {
+    ATRACE_CALL();
     camera2_stream_in_ops::acquire_buffer = acquire_buffer;
     camera2_stream_in_ops::release_buffer = release_buffer;
 }
 
 Camera2Device::ReprocessStreamAdapter::~ReprocessStreamAdapter() {
+    ATRACE_CALL();
     if (mState != RELEASED) {
         release();
     }
@@ -1245,6 +1297,7 @@
 
 status_t Camera2Device::ReprocessStreamAdapter::connectToDevice(
         const sp<StreamAdapter> &outputStream) {
+    ATRACE_CALL();
     status_t res;
     ALOGV("%s: E", __FUNCTION__);
 
@@ -1286,6 +1339,7 @@
 }
 
 status_t Camera2Device::ReprocessStreamAdapter::release() {
+    ATRACE_CALL();
     status_t res;
     ALOGV("%s: Releasing stream %d", __FUNCTION__, mId);
     if (mState >= ACTIVE) {
@@ -1315,6 +1369,7 @@
 
 status_t Camera2Device::ReprocessStreamAdapter::pushIntoStream(
     buffer_handle_t *handle, const wp<BufferReleasedListener> &releaseListener) {
+    ATRACE_CALL();
     // TODO: Some error checking here would be nice
     ALOGV("%s: Pushing buffer %p to stream", __FUNCTION__, (void*)(*handle));
 
@@ -1327,6 +1382,7 @@
 
 status_t Camera2Device::ReprocessStreamAdapter::dump(int fd,
         const Vector<String16>& args) {
+    ATRACE_CALL();
     String8 result =
             String8::format("      Reprocess stream %d: %d x %d, fmt 0x%x\n",
                     mId, mWidth, mHeight, mFormat);
@@ -1345,6 +1401,7 @@
 int Camera2Device::ReprocessStreamAdapter::acquire_buffer(
     const camera2_stream_in_ops_t *w,
         buffer_handle_t** buffer) {
+    ATRACE_CALL();
     int res;
     ReprocessStreamAdapter* stream =
             const_cast<ReprocessStreamAdapter*>(
@@ -1376,6 +1433,7 @@
 int Camera2Device::ReprocessStreamAdapter::release_buffer(
     const camera2_stream_in_ops_t* w,
     buffer_handle_t* buffer) {
+    ATRACE_CALL();
     ReprocessStreamAdapter *stream =
             const_cast<ReprocessStreamAdapter*>(
                 static_cast<const ReprocessStreamAdapter*>(w) );
diff --git a/services/camera/libcameraservice/camera2/BurstCapture.cpp b/services/camera/libcameraservice/camera2/BurstCapture.cpp
index 5020819..f4a2aa1 100644
--- a/services/camera/libcameraservice/camera2/BurstCapture.cpp
+++ b/services/camera/libcameraservice/camera2/BurstCapture.cpp
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-#define LOG_NDEBUG 0
-#define LOG_TAG "BurstCapture"
+//#define LOG_NDEBUG 0
+#define LOG_TAG "Camera2-BurstCapture"
 
 #include <utils/Log.h>
 #include <utils/Trace.h>
diff --git a/services/camera/libcameraservice/camera2/CallbackProcessor.cpp b/services/camera/libcameraservice/camera2/CallbackProcessor.cpp
index ca917f2..ede97a6 100644
--- a/services/camera/libcameraservice/camera2/CallbackProcessor.cpp
+++ b/services/camera/libcameraservice/camera2/CallbackProcessor.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "Camera2Client::CallbackProcessor"
+#define LOG_TAG "Camera2-CallbackProcessor"
 #define ATRACE_TAG ATRACE_TAG_CAMERA
 //#define LOG_NDEBUG 0
 
diff --git a/services/camera/libcameraservice/camera2/CameraMetadata.cpp b/services/camera/libcameraservice/camera2/CameraMetadata.cpp
index 8399e20..835587d 100644
--- a/services/camera/libcameraservice/camera2/CameraMetadata.cpp
+++ b/services/camera/libcameraservice/camera2/CameraMetadata.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "CameraMetadata"
+#define LOG_TAG "Camera2-Metadata"
 #include <utils/Log.h>
 #include <utils/Errors.h>
 
diff --git a/services/camera/libcameraservice/camera2/CaptureSequencer.cpp b/services/camera/libcameraservice/camera2/CaptureSequencer.cpp
index 6d7c54f..c9498c2 100644
--- a/services/camera/libcameraservice/camera2/CaptureSequencer.cpp
+++ b/services/camera/libcameraservice/camera2/CaptureSequencer.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "Camera2Client::CaptureSequencer"
+#define LOG_TAG "Camera2-CaptureSequencer"
 #define ATRACE_TAG ATRACE_TAG_CAMERA
 //#define LOG_NDEBUG 0
 
@@ -169,7 +169,11 @@
     if (client == 0) return false;
 
     if (mCaptureState < ERROR) {
+        CaptureState oldState = mCaptureState;
         mCaptureState = (this->*kStateManagers[mCaptureState])(client);
+        if (ATRACE_ENABLED() && oldState != mCaptureState) {
+            ATRACE_INT("cam2_capt_state", mCaptureState);
+        }
     } else {
         ALOGE("%s: Bad capture state: %s",
                 __FUNCTION__, kStateNames[mCaptureState]);
@@ -181,7 +185,6 @@
 
 CaptureSequencer::CaptureState CaptureSequencer::manageIdle(sp<Camera2Client> &client) {
     status_t res;
-    ATRACE_CALL();
     Mutex::Autolock l(mInputMutex);
     while (!mStartCapture) {
         res = mStartCaptureSignal.waitRelative(mInputMutex,
diff --git a/services/camera/libcameraservice/camera2/FrameProcessor.cpp b/services/camera/libcameraservice/camera2/FrameProcessor.cpp
index d3d7b3e..0c8560b 100644
--- a/services/camera/libcameraservice/camera2/FrameProcessor.cpp
+++ b/services/camera/libcameraservice/camera2/FrameProcessor.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "Camera2Client::FrameProcessor"
+#define LOG_TAG "Camera2-FrameProcessor"
 #define ATRACE_TAG ATRACE_TAG_CAMERA
 //#define LOG_NDEBUG 0
 
@@ -92,6 +92,7 @@
                     __FUNCTION__, client->getCameraId());
             break;
         }
+        ATRACE_INT("cam2_frame", entry.data.i32[0]);
 
         res = processFaceDetect(frame, client);
         if (res != OK) break;
diff --git a/services/camera/libcameraservice/camera2/JpegCompressor.cpp b/services/camera/libcameraservice/camera2/JpegCompressor.cpp
index 55964b6..702ef58 100644
--- a/services/camera/libcameraservice/camera2/JpegCompressor.cpp
+++ b/services/camera/libcameraservice/camera2/JpegCompressor.cpp
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-#define LOG_NDEBUG 0
-#define LOG_TAG "JpegCompressor"
+//#define LOG_NDEBUG 0
+#define LOG_TAG "Camera2-JpegCompressor"
 
 #include <utils/Log.h>
 #include <ui/GraphicBufferMapper.h>
diff --git a/services/camera/libcameraservice/camera2/JpegProcessor.cpp b/services/camera/libcameraservice/camera2/JpegProcessor.cpp
index 0538363..27f0fd9 100644
--- a/services/camera/libcameraservice/camera2/JpegProcessor.cpp
+++ b/services/camera/libcameraservice/camera2/JpegProcessor.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "Camera2Client::JpegProcessor"
+#define LOG_TAG "Camera2-JpegProcessor"
 #define ATRACE_TAG ATRACE_TAG_CAMERA
 //#define LOG_NDEBUG 0
 
diff --git a/services/camera/libcameraservice/camera2/Parameters.cpp b/services/camera/libcameraservice/camera2/Parameters.cpp
index 82783e3..ec85f9c 100644
--- a/services/camera/libcameraservice/camera2/Parameters.cpp
+++ b/services/camera/libcameraservice/camera2/Parameters.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "Camera2::Parameters"
+#define LOG_TAG "Camera2-Parameters"
 #define ATRACE_TAG ATRACE_TAG_CAMERA
 //#define LOG_NDEBUG 0
 
diff --git a/services/camera/libcameraservice/camera2/ZslProcessor.cpp b/services/camera/libcameraservice/camera2/ZslProcessor.cpp
index c7a679e..9516f97 100644
--- a/services/camera/libcameraservice/camera2/ZslProcessor.cpp
+++ b/services/camera/libcameraservice/camera2/ZslProcessor.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "Camera2Client::ZslProcessor"
+#define LOG_TAG "Camera2-ZslProcessor"
 #define ATRACE_TAG ATRACE_TAG_CAMERA
 //#define LOG_NDEBUG 0
 //#define LOG_NNDEBUG 0