]> git.vomp.tv Git - vompclient.git/commitdiff
Fix segfault in subs unpause
authorChris Tallon <chris@vomp.tv>
Fri, 6 Mar 2020 16:57:24 +0000 (16:57 +0000)
committerChris Tallon <chris@vomp.tv>
Fri, 6 Mar 2020 16:57:24 +0000 (16:57 +0000)
dvbsubtitles.cc
log.cc

index 4663d13a8d84d47e3d5412341585a0dc30e87b91..5a1b74011f115d9108afe1c80ec1d0b93a4b364d 100644 (file)
@@ -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 eb805027e000fdbde50cf367e054199c6cbba040..867042ab9d9446457d8cbd1f652f07ce94807647 100644 (file)
--- a/log.cc
+++ b/log.cc
     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
 
-#include "log.h"
+#include <sys/types.h>
+#include <unistd.h>
+#include <sys/syscall.h>
 
 #include "vdr.h"
 
+
+#include "log.h"
+
+
 #ifdef __ANDROID__
 #include <android/log.h>
 #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