summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorEino-Ville Talvala <etalvala@google.com>2012-07-25 15:23:36 -0700
committerEino-Ville Talvala <etalvala@google.com>2012-07-25 15:23:36 -0700
commit803cbf6190f16f7b2c43cbc51d0df21ec888abdd (patch)
tree59dfc0f1cadc394645ee8bd0547aebf4a8c28604 /services
parent78822d73af1e7f6b8b297fc7f98ef7f8257cc10a (diff)
downloadframeworks_av-803cbf6190f16f7b2c43cbc51d0df21ec888abdd.zip
frameworks_av-803cbf6190f16f7b2c43cbc51d0df21ec888abdd.tar.gz
frameworks_av-803cbf6190f16f7b2c43cbc51d0df21ec888abdd.tar.bz2
Camera2: Use more buffers for video encoding.
To avoid starvation, set the number of simultaneously available buffers to the encoder to 8. Bug: 6243944 Change-Id: I6d0e9f3c0426d62d374c0ae0d427bf5189141adf
Diffstat (limited to 'services')
-rw-r--r--services/camera/libcameraservice/Camera2Client.cpp6
-rw-r--r--services/camera/libcameraservice/Camera2Client.h5
2 files changed, 6 insertions, 5 deletions
diff --git a/services/camera/libcameraservice/Camera2Client.cpp b/services/camera/libcameraservice/Camera2Client.cpp
index 2e1940a..47d1588 100644
--- a/services/camera/libcameraservice/Camera2Client.cpp
+++ b/services/camera/libcameraservice/Camera2Client.cpp
@@ -769,7 +769,7 @@ void Camera2Client::releaseRecordingFrame(const sp<IMemory>& mem) {
}
buffer_handle_t imgBuffer = *(buffer_handle_t*)(data + 4);
ALOGV("%s: Camera %d: Freeing buffer_handle_t %p", __FUNCTION__, mCameraId,
- imgBuffer, *(uint32_t*)(data + 4));
+ imgBuffer);
res = mRecordingConsumer->freeBuffer(imgBuffer);
if (res != OK) {
ALOGE("%s: Camera %d: Unable to free recording frame (buffer_handle_t: %p):"
@@ -1623,7 +1623,7 @@ void Camera2Client::onRecordingFrameAvailable() {
memcpy(data, &type, 4);
memcpy(data + 4, &imgBuffer, sizeof(buffer_handle_t));
ALOGV("%s: Camera %d: Sending out buffer_handle_t %p",
- __FUNCTION__, mCameraId, imgBuffer, *(uint32_t*)(data + 4));
+ __FUNCTION__, mCameraId, imgBuffer);
currentClient = mCameraClient;
}
// Call outside mICameraLock to allow re-entrancy from notification
@@ -2615,7 +2615,7 @@ status_t Camera2Client::updateRecordingStream() {
if (mRecordingConsumer == 0) {
// Create CPU buffer queue endpoint
- mRecordingConsumer = new MediaConsumer(4);
+ mRecordingConsumer = new MediaConsumer(kRecordingHeapCount);
mRecordingConsumer->setFrameAvailableListener(new RecordingWaiter(this));
mRecordingConsumer->setName(String8("Camera2Client::RecordingConsumer"));
mRecordingWindow = new SurfaceTextureClient(
diff --git a/services/camera/libcameraservice/Camera2Client.h b/services/camera/libcameraservice/Camera2Client.h
index d7836ca..83fe94e 100644
--- a/services/camera/libcameraservice/Camera2Client.h
+++ b/services/camera/libcameraservice/Camera2Client.h
@@ -238,8 +238,9 @@ private:
sp<Camera2Heap> mRecordingHeap;
// TODO: This needs to be queried from somewhere, or the BufferQueue needs
- // to be passed all the way to stagefright
- static const size_t kRecordingHeapCount = 4;
+ // to be passed all the way to stagefright. Right now, set to a large number
+ // to avoid starvation of the video encoders.
+ static const size_t kRecordingHeapCount = 8;
size_t mRecordingHeapHead, mRecordingHeapFree;
// Handle new recording image buffers
void onRecordingFrameAvailable();