summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
Diffstat (limited to 'services')
-rw-r--r--services/camera/libcameraservice/Android.mk1
-rw-r--r--services/camera/libcameraservice/Camera2Device.cpp21
-rw-r--r--services/camera/libcameraservice/CameraHardwareInterface.h9
3 files changed, 10 insertions, 21 deletions
diff --git a/services/camera/libcameraservice/Android.mk b/services/camera/libcameraservice/Android.mk
index 9f713fa..8cccf49 100644
--- a/services/camera/libcameraservice/Android.mk
+++ b/services/camera/libcameraservice/Android.mk
@@ -22,6 +22,7 @@ LOCAL_SHARED_LIBRARIES:= \
libcamera_client \
libgui \
libhardware \
+ libsync \
libcamera_metadata
LOCAL_C_INCLUDES += \
diff --git a/services/camera/libcameraservice/Camera2Device.cpp b/services/camera/libcameraservice/Camera2Device.cpp
index 5a37c8d..8d07eee 100644
--- a/services/camera/libcameraservice/Camera2Device.cpp
+++ b/services/camera/libcameraservice/Camera2Device.cpp
@@ -758,7 +758,7 @@ status_t Camera2Device::StreamAdapter::connectToDevice(
ANativeWindowBuffer **anwBuffers = new ANativeWindowBuffer*[mTotalBuffers];
uint32_t bufferIdx = 0;
for (; bufferIdx < mTotalBuffers; bufferIdx++) {
- res = mConsumerInterface->dequeueBuffer(mConsumerInterface.get(),
+ res = native_window_dequeue_buffer_and_wait(mConsumerInterface.get(),
&anwBuffers[bufferIdx]);
if (res != OK) {
ALOGE("%s: Unable to dequeue buffer %d for initial registration for"
@@ -766,15 +766,6 @@ status_t Camera2Device::StreamAdapter::connectToDevice(
goto cleanUpBuffers;
}
- res = mConsumerInterface->lockBuffer(mConsumerInterface.get(),
- anwBuffers[bufferIdx]);
- if (res != OK) {
- ALOGE("%s: Unable to lock buffer %d for initial registration for"
- "stream %d", __FUNCTION__, bufferIdx, mId);
- bufferIdx++;
- goto cleanUpBuffers;
- }
-
buffers[bufferIdx] = anwBuffers[bufferIdx]->handle;
}
@@ -792,7 +783,7 @@ status_t Camera2Device::StreamAdapter::connectToDevice(
cleanUpBuffers:
for (uint32_t i = 0; i < bufferIdx; i++) {
res = mConsumerInterface->cancelBuffer(mConsumerInterface.get(),
- anwBuffers[i]);
+ anwBuffers[i], -1);
if (res != OK) {
ALOGE("%s: Unable to cancel buffer %d after registration",
__FUNCTION__, i);
@@ -878,9 +869,7 @@ int Camera2Device::StreamAdapter::dequeue_buffer(const camera2_stream_ops_t *w,
ANativeWindow *a = toANW(w);
ANativeWindowBuffer* anb;
- res = a->dequeueBuffer(a, &anb);
- if (res != OK) return res;
- res = a->lockBuffer(a, anb);
+ res = native_window_dequeue_buffer_and_wait(a, &anb);
if (res != OK) return res;
*buffer = &(anb->handle);
@@ -911,7 +900,7 @@ int Camera2Device::StreamAdapter::enqueue_buffer(const camera2_stream_ops_t* w,
return err;
}
err = a->queueBuffer(a,
- container_of(buffer, ANativeWindowBuffer, handle));
+ container_of(buffer, ANativeWindowBuffer, handle), -1);
if (err != OK) {
ALOGE("%s: Error queueing buffer to native window: %s (%d)",
__FUNCTION__, strerror(-err), err);
@@ -933,7 +922,7 @@ int Camera2Device::StreamAdapter::cancel_buffer(const camera2_stream_ops_t* w,
stream->mActiveBuffers--;
ANativeWindow *a = toANW(w);
return a->cancelBuffer(a,
- container_of(buffer, ANativeWindowBuffer, handle));
+ container_of(buffer, ANativeWindowBuffer, handle), -1);
}
int Camera2Device::StreamAdapter::set_crop(const camera2_stream_ops_t* w,
diff --git a/services/camera/libcameraservice/CameraHardwareInterface.h b/services/camera/libcameraservice/CameraHardwareInterface.h
index 87a0802..05ac9fa 100644
--- a/services/camera/libcameraservice/CameraHardwareInterface.h
+++ b/services/camera/libcameraservice/CameraHardwareInterface.h
@@ -569,7 +569,7 @@ private:
int rc;
ANativeWindow *a = anw(w);
ANativeWindowBuffer* anb;
- rc = a->dequeueBuffer(a, &anb);
+ rc = native_window_dequeue_buffer_and_wait(a, &anb);
if (!rc) {
*buffer = &anb->handle;
*stride = anb->stride;
@@ -587,8 +587,7 @@ private:
buffer_handle_t* buffer)
{
ANativeWindow *a = anw(w);
- return a->lockBuffer(a,
- container_of(buffer, ANativeWindowBuffer, handle));
+ return 0;
}
static int __enqueue_buffer(struct preview_stream_ops* w,
@@ -596,7 +595,7 @@ private:
{
ANativeWindow *a = anw(w);
return a->queueBuffer(a,
- container_of(buffer, ANativeWindowBuffer, handle));
+ container_of(buffer, ANativeWindowBuffer, handle), -1);
}
static int __cancel_buffer(struct preview_stream_ops* w,
@@ -604,7 +603,7 @@ private:
{
ANativeWindow *a = anw(w);
return a->cancelBuffer(a,
- container_of(buffer, ANativeWindowBuffer, handle));
+ container_of(buffer, ANativeWindowBuffer, handle), -1);
}
static int __set_buffer_count(struct preview_stream_ops* w, int count)