diff --git a/videodev-svbcam.cc b/videodev-svbcam.cc index bc60f69..40f63ee 100644 --- a/videodev-svbcam.cc +++ b/videodev-svbcam.cc @@ -333,9 +333,12 @@ int VideoDev_SVBCam::Grab(VideoFrameRaw *vf) { if ((err = SVBGetVideoData(camid, inframe, (long)inframe_size, 50)) != SVB_SUCCESS) { if (err != SVB_ERROR_TIMEOUT) { print_error(err); - UnLockMutex(); + // UnLockMutex(); <-- Warum? return VDEV_STATUS_ERROR; } + else { + return VDEV_STATUS_AGAIN; + } } LockMutex(); vf->CopyFrom(inframe_pixfmt, inframe_w, inframe_h, inframe_size, inframe); diff --git a/videodev.cc b/videodev.cc index 1988abe..50e9b8d 100644 --- a/videodev.cc +++ b/videodev.cc @@ -140,6 +140,7 @@ void VideoDev::SetConfig(std::string dev, int w, int h, std::string format, std: #define CYCLETIME 0.050 void VideoDev::ThreadProcess() { struct timeval cycle_timestamp; + int numframes = 0; int lastsec = 0; float cycle_time = 0.0; float cycle_wait = 0.0; @@ -178,6 +179,7 @@ void VideoDev::ThreadProcess() { Convert(&cdata, &threaddata.vf, threaddata.vfr.data, threaddata.vfr.size, threaddata.vfr.pixfmt, threaddata.vfr.w, threaddata.vfr.h); switch (i) { case VDEV_STATUS_OK: + numframes++; if (callback) gdk_threads_add_idle(callback, &threaddata); break; @@ -193,8 +195,9 @@ void VideoDev::ThreadProcess() { cycle_time = get_cycletime(&cycle_timestamp); cycle_wait = (CYCLETIME - cycle_time) + cycle_wait; if (lastsec != cycle_timestamp.tv_sec) { - printf ("%s:%d %s cycle_time:%f Freq:%f Hz \r", __FILE__, __LINE__, __FUNCTION__, cycle_time, (1.0/cycle_time)); + printf ("%s:%d %s Loop: cycle_time:%f Freq:%f Hz Frames:%d \r", __FILE__, __LINE__, __FUNCTION__, cycle_time, (1.0/cycle_time), numframes); lastsec = cycle_timestamp.tv_sec; + numframes = 0; } if (cycle_wait > 0.0 && cycle_wait < 1.0 ) usleep ((int)(cycle_wait * 1000000.0)); }