Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 06ced051 authored by chenhg's avatar chenhg
Browse files

Avoid segfaults if disconnect USB camera while preview.

BUG: 117575807
Test: manual test by disconnect USB camera while preview.

Change-Id: Ia74b03e7f2a672efd9e9dfd651b5894529daeeee
parent da1d79bf
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -1737,7 +1737,11 @@ bool ExternalCameraDeviceSession::OutputThread::threadLoop() {
    // TODO: see if we can save some computation by converting to YV12 here
    uint8_t* inData;
    size_t inDataSize;
    req->frameIn->map(&inData, &inDataSize);
    if (req->frameIn->map(&inData, &inDataSize) != 0) {
        lk.unlock();
        return onDeviceError("%s: V4L2 buffer map failed", __FUNCTION__);
    }

    // TODO: in some special case maybe we can decode jpg directly to gralloc output?
    ATRACE_BEGIN("MJPGtoI420");
    int res = libyuv::MJPGToI420(