diff options
author | chenhg | 2018-10-10 19:07:21 -0500 |
---|---|---|
committer | chenhg | 2018-10-12 16:17:04 -0500 |
commit | 06ced051d9cc2c8aac6b1ef41a056904600c69d8 (patch) | |
tree | ee2108b4437512f52f5bde2fef2ffb9032ac6a77 /camera | |
parent | da1d79bf07be5936f125456f3075afcbf79d0489 (diff) | |
download | platform-hardware-interfaces-06ced051d9cc2c8aac6b1ef41a056904600c69d8.tar.gz platform-hardware-interfaces-06ced051d9cc2c8aac6b1ef41a056904600c69d8.tar.xz platform-hardware-interfaces-06ced051d9cc2c8aac6b1ef41a056904600c69d8.zip |
Avoid segfaults if disconnect USB camera while preview.
BUG: 117575807
Test: manual test by disconnect USB camera while preview.
Change-Id: Ia74b03e7f2a672efd9e9dfd651b5894529daeeee
Diffstat (limited to 'camera')
-rw-r--r-- | camera/device/3.4/default/ExternalCameraDeviceSession.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/camera/device/3.4/default/ExternalCameraDeviceSession.cpp b/camera/device/3.4/default/ExternalCameraDeviceSession.cpp index 28ca0f35..1b739149 100644 --- a/camera/device/3.4/default/ExternalCameraDeviceSession.cpp +++ b/camera/device/3.4/default/ExternalCameraDeviceSession.cpp | |||
@@ -1737,7 +1737,11 @@ bool ExternalCameraDeviceSession::OutputThread::threadLoop() { | |||
1737 | // TODO: see if we can save some computation by converting to YV12 here | 1737 | // TODO: see if we can save some computation by converting to YV12 here |
1738 | uint8_t* inData; | 1738 | uint8_t* inData; |
1739 | size_t inDataSize; | 1739 | size_t inDataSize; |
1740 | req->frameIn->map(&inData, &inDataSize); | 1740 | if (req->frameIn->map(&inData, &inDataSize) != 0) { |
1741 | lk.unlock(); | ||
1742 | return onDeviceError("%s: V4L2 buffer map failed", __FUNCTION__); | ||
1743 | } | ||
1744 | |||
1741 | // TODO: in some special case maybe we can decode jpg directly to gralloc output? | 1745 | // TODO: in some special case maybe we can decode jpg directly to gralloc output? |
1742 | ATRACE_BEGIN("MJPGtoI420"); | 1746 | ATRACE_BEGIN("MJPGtoI420"); |
1743 | int res = libyuv::MJPGToI420( | 1747 | int res = libyuv::MJPGToI420( |