From 2b286dab84b2a0524c1deed67fea92200e598c6e Mon Sep 17 00:00:00 2001 From: Alex Ray Date: Wed, 29 May 2013 15:08:29 -0700 Subject: modules: camera: Write back stream parameters max_buffers and usage are read by the framework inside the struct used to pass the stream configuration parameters; scribble our new calculated values whever they are updated internally. Adds logging to stream creation method (reuse/new). Change-Id: I04e12880820571900f2ae80c27100f8aedcf9d02 --- modules/camera/Camera.cpp | 7 +++++-- modules/camera/Stream.cpp | 2 ++ modules/camera/Stream.h | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) (limited to 'modules/camera') diff --git a/modules/camera/Camera.cpp b/modules/camera/Camera.cpp index 42e5cdb..137c5f6 100644 --- a/modules/camera/Camera.cpp +++ b/modules/camera/Camera.cpp @@ -326,10 +326,13 @@ int Camera::configureStreams(camera3_stream_configuration_t *stream_config) // Fill new stream array with reused streams and new streams for (unsigned int i = 0; i < stream_config->num_streams; i++) { astream = stream_config->streams[i]; - if (astream->max_buffers > 0) + if (astream->max_buffers > 0) { + ALOGV("%s:%d: Reusing stream %d", __func__, mId, i); newStreams[i] = reuseStream(astream); - else + } else { + ALOGV("%s:%d: Creating new stream %d", __func__, mId, i); newStreams[i] = new Stream(mId, astream); + } if (newStreams[i] == NULL) { ALOGE("%s:%d: Error processing stream %d", __func__, mId, i); diff --git a/modules/camera/Stream.cpp b/modules/camera/Stream.cpp index 31eefcd..aae7adb 100644 --- a/modules/camera/Stream.cpp +++ b/modules/camera/Stream.cpp @@ -61,6 +61,7 @@ void Stream::setUsage(uint32_t usage) pthread_mutex_lock(&mMutex); if (usage != mUsage) { mUsage = usage; + mStream->usage = usage; unregisterBuffers_L(); } pthread_mutex_unlock(&mMutex); @@ -71,6 +72,7 @@ void Stream::setMaxBuffers(uint32_t max_buffers) pthread_mutex_lock(&mMutex); if (max_buffers != mMaxBuffers) { mMaxBuffers = max_buffers; + mStream->max_buffers = max_buffers; unregisterBuffers_L(); } pthread_mutex_unlock(&mMutex); diff --git a/modules/camera/Stream.h b/modules/camera/Stream.h index 521362e..34abd95 100644 --- a/modules/camera/Stream.h +++ b/modules/camera/Stream.h @@ -52,7 +52,7 @@ class Stream { // The camera device id this stream belongs to const int mId; // Handle to framework's stream, used as a cookie for buffers - const camera3_stream_t *mStream; + camera3_stream_t *mStream; // Stream type: CAMERA3_STREAM_* (see ) const int mType; // Width in pixels of the buffers in this stream -- cgit v1.1