From 14e27dc4b3dbaecffc26f88495b7bdade7faccc8 Mon Sep 17 00:00:00 2001 From: f4exb Date: Mon, 13 Mar 2017 22:52:49 +0100 Subject: [PATCH] ATV Modulator: count actual number of frames read for camera FPS estimation --- plugins/channeltx/modatv/atvmod.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/channeltx/modatv/atvmod.cpp b/plugins/channeltx/modatv/atvmod.cpp index 34baf16c8..5c6835cb7 100644 --- a/plugins/channeltx/modatv/atvmod.cpp +++ b/plugins/channeltx/modatv/atvmod.cpp @@ -304,17 +304,20 @@ void ATVMod::pullVideo(Real& sample) camera.m_videoHeight, 1); // open splash screen on GUI side getOutputMessageQueue()->push(report); + int nbFrames = 0; time(&start); - for (int i = 0; i < 120; i++) { + for (int i = 0; i < 120; i++) + { camera.m_camera >> frame; + if (!frame.empty()) nbFrames++; } time(&end); double seconds = difftime (end, start); - camera.m_videoFPS = (120 / seconds) * 0.95; // take a 5% guard + camera.m_videoFPS = (nbFrames / seconds) * 0.95; // take a 5% guard camera.m_videoFPSq = camera.m_videoFPS / m_fps; camera.m_videoFPSCount = camera.m_videoFPSq; camera.m_videoPrevFPSCount = 0;