Merge changes from topic "camera_ndk_fixes" am: 35f148bc5a am: ee6b817886

am: 6928bc3506

Change-Id: Id0738d4d84b4715e2579d6e77f64b795ff1d2cb8
gugelfrei
Jayant Chowdhary 5 years ago committed by android-build-merger
commit e3b3be4826

@ -29,7 +29,7 @@
#include "ACameraCaptureSession.inc"
ACameraDevice::~ACameraDevice() {
mDevice->stopLooper();
mDevice->stopLooperAndDisconnect();
}
namespace android {
@ -112,19 +112,7 @@ CameraDevice::CameraDevice(
}
}
// Device close implementaiton
CameraDevice::~CameraDevice() {
sp<ACameraCaptureSession> session = mCurrentSession.promote();
{
Mutex::Autolock _l(mDeviceLock);
if (!isClosed()) {
disconnectLocked(session);
}
LOG_ALWAYS_FATAL_IF(mCbLooper != nullptr,
"CameraDevice looper should've been stopped before ~CameraDevice");
mCurrentSession = nullptr;
}
}
CameraDevice::~CameraDevice() { }
void
CameraDevice::postSessionMsgAndCleanup(sp<AMessage>& msg) {
@ -892,8 +880,14 @@ CameraDevice::onCaptureErrorLocked(
return;
}
void CameraDevice::stopLooper() {
void CameraDevice::stopLooperAndDisconnect() {
Mutex::Autolock _l(mDeviceLock);
sp<ACameraCaptureSession> session = mCurrentSession.promote();
if (!isClosed()) {
disconnectLocked(session);
}
mCurrentSession = nullptr;
if (mCbLooper != nullptr) {
mCbLooper->unregisterHandler(mHandler->id());
mCbLooper->stop();

@ -40,6 +40,7 @@
#include <camera/NdkCameraManager.h>
#include <camera/NdkCameraCaptureSession.h>
#include "ACameraMetadata.h"
namespace android {
@ -110,7 +111,7 @@ class CameraDevice final : public RefBase {
inline ACameraDevice* getWrapper() const { return mWrapper; };
// Stop the looper thread and unregister the handler
void stopLooper();
void stopLooperAndDisconnect();
private:
friend ACameraCaptureSession;

@ -45,7 +45,7 @@
using namespace android;
ACameraDevice::~ACameraDevice() {
mDevice->stopLooper();
mDevice->stopLooperAndDisconnect();
}
namespace android {
@ -125,19 +125,7 @@ CameraDevice::CameraDevice(
}
}
// Device close implementaiton
CameraDevice::~CameraDevice() {
sp<ACameraCaptureSession> session = mCurrentSession.promote();
{
Mutex::Autolock _l(mDeviceLock);
if (!isClosed()) {
disconnectLocked(session);
}
mCurrentSession = nullptr;
LOG_ALWAYS_FATAL_IF(mCbLooper != nullptr,
"CameraDevice looper should've been stopped before ~CameraDevice");
}
}
CameraDevice::~CameraDevice() { }
void
CameraDevice::postSessionMsgAndCleanup(sp<AMessage>& msg) {
@ -1388,6 +1376,7 @@ CameraDevice::checkAndFireSequenceCompleteLocked() {
// before cbh goes out of scope and causing we call the session
// destructor while holding device lock
cbh.mSession.clear();
postSessionMsgAndCleanup(msg);
}
@ -1400,8 +1389,13 @@ CameraDevice::checkAndFireSequenceCompleteLocked() {
}
}
void CameraDevice::stopLooper() {
void CameraDevice::stopLooperAndDisconnect() {
Mutex::Autolock _l(mDeviceLock);
sp<ACameraCaptureSession> session = mCurrentSession.promote();
if (!isClosed()) {
disconnectLocked(session);
}
mCurrentSession = nullptr;
if (mCbLooper != nullptr) {
mCbLooper->unregisterHandler(mHandler->id());
mCbLooper->stop();

@ -36,6 +36,7 @@
#include <camera/NdkCameraManager.h>
#include <camera/NdkCameraCaptureSession.h>
#include "ACameraMetadata.h"
#include "utils.h"
@ -134,7 +135,7 @@ class CameraDevice final : public RefBase {
inline ACameraDevice* getWrapper() const { return mWrapper; };
// Stop the looper thread and unregister the handler
void stopLooper();
void stopLooperAndDisconnect();
private:
friend ACameraCaptureSession;

Loading…
Cancel
Save