Loading camera/camera2/ICameraDeviceUser.cpp +23 −1 Original line number Diff line number Diff line Loading @@ -48,7 +48,8 @@ enum { GET_CAMERA_INFO, WAIT_UNTIL_IDLE, FLUSH, PREPARE PREPARE, TEAR_DOWN }; namespace { Loading Loading @@ -365,6 +366,20 @@ public: return reply.readInt32(); } virtual status_t tearDown(int streamId) { ALOGV("tearDown"); Parcel data, reply; data.writeInterfaceToken(ICameraDeviceUser::getInterfaceDescriptor()); data.writeInt32(streamId); remote()->transact(TEAR_DOWN, data, &reply); reply.readExceptionCode(); return reply.readInt32(); } private: Loading Loading @@ -570,6 +585,13 @@ status_t BnCameraDeviceUser::onTransact( reply->writeInt32(prepare(streamId)); return NO_ERROR; } break; case TEAR_DOWN: { CHECK_INTERFACE(ICameraDeviceUser, data, reply); int streamId = data.readInt32(); reply->writeNoException(); reply->writeInt32(tearDown(streamId)); return NO_ERROR; } break; default: return BBinder::onTransact(code, data, reply, flags); Loading include/camera/camera2/ICameraDeviceUser.h +6 −0 Original line number Diff line number Diff line Loading @@ -138,6 +138,12 @@ public: * Preallocate buffers for a given output stream asynchronously. */ virtual status_t prepare(int streamId) = 0; /** * Free all unused buffers for a given output stream. */ virtual status_t tearDown(int streamId) = 0; }; // ---------------------------------------------------------------------------- Loading services/camera/libcameraservice/api2/CameraDeviceClient.cpp +32 −0 Original line number Diff line number Diff line Loading @@ -719,6 +719,38 @@ status_t CameraDeviceClient::prepare(int streamId) { return res; } status_t CameraDeviceClient::tearDown(int streamId) { ATRACE_CALL(); ALOGV("%s", __FUNCTION__); status_t res = OK; if ( (res = checkPid(__FUNCTION__) ) != OK) return res; Mutex::Autolock icl(mBinderSerializationLock); // Guard against trying to prepare non-created streams ssize_t index = NAME_NOT_FOUND; for (size_t i = 0; i < mStreamMap.size(); ++i) { if (streamId == mStreamMap.valueAt(i)) { index = i; break; } } if (index == NAME_NOT_FOUND) { ALOGW("%s: Camera %d: Invalid stream ID (%d) specified, no stream " "created yet", __FUNCTION__, mCameraId, streamId); return BAD_VALUE; } // Also returns BAD_VALUE if stream ID was not valid or if the stream is in // use res = mDevice->tearDown(streamId); return res; } status_t CameraDeviceClient::dump(int fd, const Vector<String16>& args) { String8 result; result.appendFormat("CameraDeviceClient[%d] (%p) dump:\n", Loading services/camera/libcameraservice/api2/CameraDeviceClient.h +3 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,9 @@ public: // Prepare stream by preallocating its buffers virtual status_t prepare(int streamId); // Tear down stream resources by freeing its unused buffers virtual status_t tearDown(int streamId); /** * Interface used by CameraService */ Loading services/camera/libcameraservice/common/CameraDeviceBase.h +5 −0 Original line number Diff line number Diff line Loading @@ -288,6 +288,11 @@ class CameraDeviceBase : public virtual RefBase { */ virtual status_t prepare(int streamId) = 0; /** * Free stream resources by dumping its unused gralloc buffers. */ virtual status_t tearDown(int streamId) = 0; /** * Get the HAL device version. */ Loading Loading
camera/camera2/ICameraDeviceUser.cpp +23 −1 Original line number Diff line number Diff line Loading @@ -48,7 +48,8 @@ enum { GET_CAMERA_INFO, WAIT_UNTIL_IDLE, FLUSH, PREPARE PREPARE, TEAR_DOWN }; namespace { Loading Loading @@ -365,6 +366,20 @@ public: return reply.readInt32(); } virtual status_t tearDown(int streamId) { ALOGV("tearDown"); Parcel data, reply; data.writeInterfaceToken(ICameraDeviceUser::getInterfaceDescriptor()); data.writeInt32(streamId); remote()->transact(TEAR_DOWN, data, &reply); reply.readExceptionCode(); return reply.readInt32(); } private: Loading Loading @@ -570,6 +585,13 @@ status_t BnCameraDeviceUser::onTransact( reply->writeInt32(prepare(streamId)); return NO_ERROR; } break; case TEAR_DOWN: { CHECK_INTERFACE(ICameraDeviceUser, data, reply); int streamId = data.readInt32(); reply->writeNoException(); reply->writeInt32(tearDown(streamId)); return NO_ERROR; } break; default: return BBinder::onTransact(code, data, reply, flags); Loading
include/camera/camera2/ICameraDeviceUser.h +6 −0 Original line number Diff line number Diff line Loading @@ -138,6 +138,12 @@ public: * Preallocate buffers for a given output stream asynchronously. */ virtual status_t prepare(int streamId) = 0; /** * Free all unused buffers for a given output stream. */ virtual status_t tearDown(int streamId) = 0; }; // ---------------------------------------------------------------------------- Loading
services/camera/libcameraservice/api2/CameraDeviceClient.cpp +32 −0 Original line number Diff line number Diff line Loading @@ -719,6 +719,38 @@ status_t CameraDeviceClient::prepare(int streamId) { return res; } status_t CameraDeviceClient::tearDown(int streamId) { ATRACE_CALL(); ALOGV("%s", __FUNCTION__); status_t res = OK; if ( (res = checkPid(__FUNCTION__) ) != OK) return res; Mutex::Autolock icl(mBinderSerializationLock); // Guard against trying to prepare non-created streams ssize_t index = NAME_NOT_FOUND; for (size_t i = 0; i < mStreamMap.size(); ++i) { if (streamId == mStreamMap.valueAt(i)) { index = i; break; } } if (index == NAME_NOT_FOUND) { ALOGW("%s: Camera %d: Invalid stream ID (%d) specified, no stream " "created yet", __FUNCTION__, mCameraId, streamId); return BAD_VALUE; } // Also returns BAD_VALUE if stream ID was not valid or if the stream is in // use res = mDevice->tearDown(streamId); return res; } status_t CameraDeviceClient::dump(int fd, const Vector<String16>& args) { String8 result; result.appendFormat("CameraDeviceClient[%d] (%p) dump:\n", Loading
services/camera/libcameraservice/api2/CameraDeviceClient.h +3 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,9 @@ public: // Prepare stream by preallocating its buffers virtual status_t prepare(int streamId); // Tear down stream resources by freeing its unused buffers virtual status_t tearDown(int streamId); /** * Interface used by CameraService */ Loading
services/camera/libcameraservice/common/CameraDeviceBase.h +5 −0 Original line number Diff line number Diff line Loading @@ -288,6 +288,11 @@ class CameraDeviceBase : public virtual RefBase { */ virtual status_t prepare(int streamId) = 0; /** * Free stream resources by dumping its unused gralloc buffers. */ virtual status_t tearDown(int streamId) = 0; /** * Get the HAL device version. */ Loading