From 36f76f1612b5fbdd00b15f3a2c88e113b6861e72 Mon Sep 17 00:00:00 2001 From: Guosong Zhou Date: Tue, 18 Oct 2016 06:34:10 +0000 Subject: PD#132108: camera: fix screen display green problem Change-Id: Ia3c7a2e4905940c3d239bdcc03a912c11c0560d2 --- diff --git a/v3/EmulatedFakeCamera3.cpp b/v3/EmulatedFakeCamera3.cpp index c4dae65..54ff21d 100644 --- a/v3/EmulatedFakeCamera3.cpp +++ b/v3/EmulatedFakeCamera3.cpp @@ -2846,6 +2846,11 @@ bool EmulatedFakeCamera3::ReadoutThread::threadLoop() { return false; } + bool workflag = + mParent->mSensor->get_sensor_status(); + if (!workflag) + return true; + ALOGVV("Sensor done with readout for frame %d, captured at %lld ", mCurrentRequest.frameNumber, captureTime); diff --git a/v3/fake-pipeline2/Sensor.cpp b/v3/fake-pipeline2/Sensor.cpp index 2c5048b..1338a14 100644 --- a/v3/fake-pipeline2/Sensor.cpp +++ b/v3/fake-pipeline2/Sensor.cpp @@ -203,6 +203,7 @@ Sensor::Sensor(): mPre_width(0), mPre_height(0), mFlushFlag(false), + mSensorWorkFlag(false), mScene(kResolution[0], kResolution[1], kElectronsPerLuxSecond) { @@ -507,6 +508,8 @@ status_t Sensor::shutDown() { mTemp_buffer = NULL; } + mSensorWorkFlag = false; + ALOGD("%s: Exit", __FUNCTION__); return res; } @@ -1833,6 +1836,10 @@ int Sensor::getPictureSizes(int32_t picSizes[], int size, bool preview) { } +bool Sensor::get_sensor_status() { + return mSensorWorkFlag; +} + void Sensor::captureRaw(uint8_t *img, uint32_t gain, uint32_t stride) { float totalGain = gain/100.0 * kBaseGainFactor; float noiseVarGain = totalGain * totalGain; @@ -2191,6 +2198,7 @@ void Sensor::captureNV21(StreamBuffer b, uint32_t gain) { usleep(5000); mTimeOutCount++; if (mTimeOutCount > 300) { + DBG_LOGA("force sensor reset.\n"); force_reset_sensor(); } continue; @@ -2251,7 +2259,7 @@ void Sensor::captureNV21(StreamBuffer b, uint32_t gain) { mKernelBuffer = mTemp_buffer; } } - + mSensorWorkFlag = true; break; } #endif @@ -2448,7 +2456,7 @@ void Sensor::captureYV12(StreamBuffer b, uint32_t gain) { } else { ALOGE("Unable known sensor format: %d", vinfo->preview.format.fmt.pix.pixelformat); } - + mSensorWorkFlag = true; break; } #endif @@ -2559,8 +2567,8 @@ void Sensor::captureYUYV(uint8_t *img, uint32_t gain, uint32_t stride) { } else { ALOGE("Unable known sensor format: %d", vinfo->preview.format.fmt.pix.pixelformat); } - - break; + mSensorWorkFlag = true; + break; } #endif //mKernelBuffer = src; diff --git a/v3/fake-pipeline2/Sensor.h b/v3/fake-pipeline2/Sensor.h index 5670f24..1f6e77f 100644 --- a/v3/fake-pipeline2/Sensor.h +++ b/v3/fake-pipeline2/Sensor.h @@ -233,6 +233,7 @@ class Sensor: private Thread, public virtual RefBase { void setFrameNumber(uint32_t frameNumber); void setFlushFlag(bool flushFlag); status_t force_reset_sensor(); + bool get_sensor_status(); /* * Controls that cause reconfiguration delay */ @@ -362,6 +363,7 @@ class Sensor: private Thread, public virtual RefBase { uint32_t mPre_width; uint32_t mPre_height; bool mFlushFlag; + bool mSensorWorkFlag; /** * Inherited Thread virtual overrides, and members only used by the * processing thread -- cgit