From e05675e32e19f2e2ec6ecc7605f962c4eebcfba6 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Fri, 6 Mar 2020 16:57:24 +0000 Subject: [PATCH] Fix segfault in subs unpause --- dvbsubtitles.cc | 8 ++++---- log.cc | 10 ++++++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/dvbsubtitles.cc b/dvbsubtitles.cc index 4663d13..5a1b740 100644 --- a/dvbsubtitles.cc +++ b/dvbsubtitles.cc @@ -884,7 +884,7 @@ void DVBSubtitles::pause() void DVBSubtitles::unPause() { - Log::getInstance()->log("DVBSubs", Log::DEBUG, "subs pause"); + Log::getInstance()->log("DVBSubs", Log::DEBUG, "subs unpause"); input_mutex.lock(); if (!running) @@ -957,7 +957,7 @@ void DVBSubtitles::threadMethod() // just store the packet and allow next signal to start things off Log::getInstance()->log("DVBSubs", Log::DEBUG, "signalRecalcWLTO but Video PTS == 0"); } - else + else if (worklist.size()) // It is possible to be called to recalc when there are no packets { worklistTimeoutPointActive = true; Log::getInstance()->log("DVBSubs", Log::DEBUG, "Calc: Num packets available: %i", worklist.size()); @@ -968,6 +968,7 @@ void DVBSubtitles::threadMethod() if (diff < 60 * 1000) { worklistTimeoutPoint = std::chrono::system_clock::now() + std::chrono::milliseconds(diff); + Log::getInstance()->log("DVBSubs", Log::DEBUG, "Calc'd new worklistTimeoutPoint"); } else { @@ -977,9 +978,8 @@ void DVBSubtitles::threadMethod() // FIXME check if this still works worklistTimeoutPoint = std::chrono::system_clock::now(); + Log::getInstance()->log("DVBSubs", Log::DEBUG, "Problem packet"); } - - Log::getInstance()->log("DVBSubs", Log::DEBUG, "Calc'd new worklistTimeoutPoint"); } } else if (waitExpireST) // do real work - subtitletimeout diff --git a/log.cc b/log.cc index eb80502..867042a 100644 --- a/log.cc +++ b/log.cc @@ -19,10 +19,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "log.h" +#include +#include +#include #include "vdr.h" + +#include "log.h" + + #ifdef __ANDROID__ #include #endif @@ -133,7 +139,7 @@ int Log::log(const char *fromModule, int level,const char* message, ...) if (level == DEBUG) strcpy(levelString, "[debug] "); #ifndef WIN32 - spaceLeft -= SNPRINTF(&buffer[150-spaceLeft], spaceLeft, "%s %lu %s - ", levelString, pthread_self(), fromModule); + spaceLeft -= SNPRINTF(&buffer[150-spaceLeft], spaceLeft, "%s %lu %li %s - ", levelString, pthread_self(), syscall(SYS_gettid), fromModule); #else spaceLeft -= SNPRINTF(&buffer[150-spaceLeft], spaceLeft, "%s %s - ", levelString, fromModule); #endif -- 2.39.2