From c057e057f91d4d909d2105d5530187ca6ab17f2c Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 14 Apr 2018 10:24:41 +0200 Subject: [PATCH] Fixed a high CPU load during replay with active progress display --- CONTRIBUTORS | 1 + HISTORY | 2 ++ menu.c | 6 +++++- menu.h | 3 ++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index f1dfc088..4fb011f9 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -3314,6 +3314,7 @@ Matthias Senzel for reporting that the info of a newly edited recording was not available immediately after starting the editing process for reporting a problem with setting the initial offset of the cursor in a list menu + for reporting a high CPU load during replay with active progress display Marek Nazarko for translating OSD texts to the Polish language diff --git a/HISTORY b/HISTORY index 7e57e030..418f26e3 100644 --- a/HISTORY +++ b/HISTORY @@ -9344,3 +9344,5 @@ Video Disk Recorder Revision History - Updated the Italian OSD texts (thanks to Diego Pierotto). - Updated the Hungarian OSD texts (thanks to István Füley). - Updated the French OSD texts (thanks to Bernard Jaulin). +- Fixed a high CPU load during replay with active progress display (reported by Matthias + Senzel). diff --git a/menu.c b/menu.c index 6527c43f..c8a557c1 100644 --- a/menu.c +++ b/menu.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 4.73 2018/04/09 09:20:03 kls Exp $ + * $Id: menu.c 4.74 2018/04/14 10:24:41 kls Exp $ */ #include "menu.h" @@ -45,6 +45,7 @@ #define MAXWAITFORCAMMENU 10 // seconds to wait for the CAM menu to open #define CAMMENURETRYTIMEOUT 3 // seconds after which opening the CAM menu is retried #define CAMRESPONSETIMEOUT 5 // seconds to wait for a response from a CAM +#define PROGRESSTIMEOUT 100 // milliseconds to wait before updating the replay progress display #define MINFREEDISK 300 // minimum free disk space (in MB) required to start recording #define NODISKSPACEDELTA 300 // seconds between "Not enough disk space to start recording!" messages #define MAXCHNAMWIDTH 16 // maximum number of characters of channels' short names shown in schedules menus @@ -5733,6 +5734,8 @@ void cReplayControl::ShowMode(void) bool cReplayControl::ShowProgress(bool Initial) { int Current, Total; + if (!(Initial || updateTimer.TimedOut())) + return visible; if (GetFrameNumber(Current, Total) && Total > 0) { if (!visible) { displayReplay = Skins.Current()->DisplayReplay(modeOnly); @@ -5762,6 +5765,7 @@ bool cReplayControl::ShowProgress(bool Initial) } lastTotal = Total; ShowMode(); + updateTimer.Set(PROGRESSTIMEOUT); return true; } return false; diff --git a/menu.h b/menu.h index b700e27d..3fc9f749 100644 --- a/menu.h +++ b/menu.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.h 4.7 2018/04/02 13:41:49 kls Exp $ + * $Id: menu.h 4.8 2018/04/14 10:24:41 kls Exp $ */ #ifndef __MENU_H @@ -300,6 +300,7 @@ private: bool lastPlay, lastForward; int lastSpeed; time_t timeoutShow; + cTimeMs updateTimer; bool timeSearchActive, timeSearchHide; int timeSearchTime, timeSearchPos; void TimeSearchDisplay(void);