dvbplayer segfault vdr-1.7.39

Message ID 513BC2B3.40606@tvdr.de
State New
Headers

Commit Message

Klaus Schmidinger March 9, 2013, 11:16 p.m. UTC
  On 09.03.2013 23:38, Mike Booth wrote:
> I am getting the following message when trying to replay recordings.
>
> kernel: [ 8579.175197] dvbplayer[10786]: segfault at a3c7b0d5 ip 0815e942 sp
> a16cdf50 error 4 in vdr[8048000+171000]
>
>
> Anyone have the same problem or any idea what it means?
>
>
> Using xineliboutput from cvs linux-3.8 and vdr-1.7.39.

Please try if the attached patch fixes this.

Klaus
  

Comments

Mike Booth March 10, 2013, 7:36 a.m. UTC | #1
Thanks Klaus. That has fixed it.


Mike
  
Mike Booth March 10, 2013, 7:42 a.m. UTC | #2
Klaus Schmidinger <Klaus.Schmidinger <at> tvdr.de> writes:
Thanks Klaus. That's fixed it.


Regards

Mike
  

Patch

--- dvbplayer.c	2013/02/25 12:15:58	2.32
+++ dvbplayer.c	2013/03/08 13:44:19
@@ -33,6 +33,7 @@ 
 public:
   cPtsIndex(void);
   void Clear(void);
+  bool IsEmpty(void);
   void Put(uint32_t Pts, int Index);
   int FindIndex(uint32_t Pts);
   };
@@ -49,6 +50,12 @@ 
   w = r = 0;
 }
 
+bool cPtsIndex::IsEmpty(void)
+{
+  cMutexLock MutexLock(&mutex);
+  return w == r;
+}
+
 void cPtsIndex::Put(uint32_t Pts, int Index)
 {
   cMutexLock MutexLock(&mutex);
@@ -810,12 +817,14 @@ 
 
 void cDvbPlayer::SetAudioTrack(eTrackType Type, const tTrackId *TrackId)
 {
-  if (isPesRecording)
-     return; // for some unknown reason this doesn't work with PES recordings - causes a segfault
+  if (!cThread::IsMainThread())
+     return; // only do this upon user interaction
   if (playMode == pmPlay) {
-     int Current, Total;
-     if (GetIndex(Current, Total, true))
-        Goto(Current);
+     if (!ptsIndex.IsEmpty()) {
+        int Current, Total;
+        if (GetIndex(Current, Total, true))
+           Goto(Current);
+        }
      }
   else if (playMode == pmPause)
      resyncAfterPause = true;