心跳和拍照时间对齐的优化处理

serial
Matthew 1 year ago
parent d61784a81d
commit 8a1d399e62

@ -33,6 +33,7 @@ add_definitions(-DUSING_NRSEC)
# add_definitions(-DUSING_DOWSE)
# OUTPUT_CAMERA_DBG_INFO: CARERA
add_definitions(-DOUTPUT_CAMERA_DBG_INFO)
add_definitions(-DALIGN_HB_TIMER_TO_PHOTO)
# set(OpenCV_DIR D:/Workspace/deps/OpenCV-android-sdk/sdk/native/jni/)
set(OPENCV_EXTRA_MODULES_PATH D:/Workspace/Github/opencv_contrib/modules)

@ -189,7 +189,7 @@ CPhoneDevice::CPhoneDevice(JavaVM* vm, jobject service, const std::string& appPa
m_javaService = env->NewGlobalRef(service);
jclass classService = env->GetObjectClass(m_javaService);
mRegisterHeartbeatMid = env->GetMethodID(classService, "registerHeartbeatTimer", "(I)V");
mRegisterHeartbeatMid = env->GetMethodID(classService, "registerHeartbeatTimer", "(IJ)V");
mUpdateTimeMid = env->GetMethodID(classService, "updateTime", "(J)Z");
mUpdateCaptureScheduleMid = env->GetMethodID(classService, "updateCaptureSchedule", "(J)Z");
mStartRecordingMid = env->GetMethodID(classService, "startRecording", "(IJIIIIILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
@ -850,7 +850,7 @@ bool CPhoneDevice::ReleaseWakelock(unsigned long wakelock)
return true;
}
IDevice::timer_uid_t CPhoneDevice::RegisterHeartbeat(unsigned int timerType, unsigned int timeout)
IDevice::timer_uid_t CPhoneDevice::RegisterHeartbeat(unsigned int timerType, unsigned int timeout, time_t tsForNextPhoto)
{
mHeartbeatStartTime = time(NULL);
mHeartbeatDuration = timeout;
@ -866,7 +866,11 @@ IDevice::timer_uid_t CPhoneDevice::RegisterHeartbeat(unsigned int timerType, uns
ALOGE("Failed to get JNI Env");
return 0;
}
env->CallVoidMethod(m_javaService, mRegisterHeartbeatMid, (jint)timeout);
#ifdef ALIGN_HB_TIMER_TO_PHOTO
env->CallVoidMethod(m_javaService, mRegisterHeartbeatMid, (jint)timeout, (jlong)tsForNextPhoto);
#else
env->CallVoidMethod(m_javaService, mRegisterHeartbeatMid, (jint)timeout, 0);
#endif
if (didAttachThread)
{
m_vm->DetachCurrentThread();
@ -1232,8 +1236,6 @@ bool CPhoneDevice::OnImageReady(cv::Mat& mat)
}
#endif
textSize = ft2->getTextSize(it->text, fontSize, thickness, &baseline);
XYLOG(XYLOG_SEVERITY_DEBUG, "%s font Size=%d height: %d baseline=%d", it->text.c_str(), fontSize, textSize.height, baseline);

@ -189,7 +189,7 @@ public:
virtual bool EnableGPS(bool enabled);
virtual float QueryBattaryVoltage(int timesForAvg, bool* isCharging);
virtual bool RequestPosition();
virtual timer_uid_t RegisterHeartbeat(unsigned int timerType, unsigned int timeout);
virtual timer_uid_t RegisterHeartbeat(unsigned int timerType, unsigned int timeout, time_t tsForNextPhoto);
virtual bool TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector<OSD_INFO>& osds, const std::string& path);
virtual bool CloseCamera();
virtual timer_uid_t RegisterTimer(unsigned int timerType, unsigned int timeout, void* data, unsigned long times = 0);

@ -381,7 +381,7 @@ public class MicroPhotoService extends Service {
}
// Will be called fron native
private void registerHeartbeatTimer(int duration) {
private void registerHeartbeatTimer(int duration, long nextPhotoTime) {
int orgHeartbeatDuration = mHeartbeatDuration;
mHeartbeatDuration = duration;
if (orgHeartbeatDuration == 0) {

Loading…
Cancel
Save