VDR 1.5.17 - pre 1.3.19 compatibility mode problems

Message ID 200804090854.56839.stefan@lucke.in-berlin.de
State New
Headers

Commit Message

Stefan Lucke April 9, 2008, 6:54 a.m. UTC
  On Wednesday 05 March 2008, Klaus Schmidinger wrote:
> On 03/04/08 10:58, Tero Siironen wrote:
> > Hi,
> > 
> > I upgraded from VDR 1.4.7 to 1.5.17 and noticed that some of my old  
> > recordings won't play decently with this new version. Here's a syslog  
> > entry and example clip can be found from http://kotisivu.suomi.net/izero/vdr-darwin/ddmode_example.zip 
> >   (9MB)
> > 
> > Those problematic recordings were done with some 1.3.x series VDR with  
> > ttxtsubs plugin in fall 2004. Plays fine with VDR 1.4.7, but playback  
> > stutters when playing with VDR 1.5.17. My system has DVB-C FF 2.1 and  
> > DVB-C budget cards. Running on Fedora 5.
> 
> My guess would be that the offending data comes from the ttxtsubs plugin.
> Maybe you need to patch VDR to become aware of this.

My guess is that this is introduced by vdr-1.5.11

Original vdr-1.6.0:
Apr  9 08:29:38 jarada vdr: [7997] replay /net_data/video/Extra/Enterprise_1/%1-01_Aufbruch_ins_Unbekannte_-_Teil_1/2004-01-31.19:05.99.99.rec
Apr  9 08:29:38 jarada vdr: [7997] playing '/net_data/video/Extra/Enterprise_1/%1-01_Aufbruch_ins_Unbekannte_-_Teil_1/2004-01-31.19:05.99.99.rec/001.vdr'
Apr  9 08:29:38 jarada vdr: [7997] loading /net_data/video/Extra/Enterprise_1/%1-01_Aufbruch_ins_Unbekannte_-_Teil_1/2004-01-31.19:05.99.99.rec//marks.vdr
Apr  9 08:29:38 jarada vdr: [8019] dvbplayer thread started (pid=7997, tid=8019)
Apr  9 08:29:38 jarada vdr: [8020] non blocking file reader thread started (pid=7997, tid=8020)
Apr  9 08:29:38 jarada vdr: [8019] unknown PS1 packet, substream id = EB (counter is at 0)
Apr  9 08:29:38 jarada vdr: [8019] unknown PS1 packet, substream id = 0B (counter is at 1)
Apr  9 08:29:38 jarada vdr: [8019] unknown PS1 packet, substream id = D1 (counter is at 2)
Apr  9 08:29:38 jarada vdr: [8019] unknown PS1 packet, substream id = 5D (counter is at 3)
Apr  9 08:29:38 jarada vdr: [8019] unknown PS1 packet, substream id = F0 (counter is at 4)
Apr  9 08:29:38 jarada vdr: [8019] unknown PS1 packet, substream id = 7E (counter is at 5)

In this case there is no sound at all :-(.
Recording was done with vdr-1.2.1.

Plain vdr 1.6.0 with pre_1_3_19 change (from vdr-1.5.11) reverted:
Apr  9 08:25:50 jarada vdr: [7837] replay /net_data/video/Extra/Enterprise_1/%1-01_Aufbruch_ins_Unbekannte_-_Teil_1/2004-01-31.19:05.99.99.rec
Apr  9 08:25:50 jarada vdr: [7837] playing '/net_data/video/Extra/Enterprise_1/%1-01_Aufbruch_ins_Unbekannte_-_Teil_1/2004-01-31.19:05.99.99.rec/001.vdr'
Apr  9 08:25:50 jarada vdr: [7837] loading /net_data/video/Extra/Enterprise_1/%1-01_Aufbruch_ins_Unbekannte_-_Teil_1/2004-01-31.19:05.99.99.rec//marks.vdr
Apr  9 08:25:50 jarada vdr: [7859] dvbplayer thread started (pid=7837, tid=7859)
Apr  9 08:25:50 jarada vdr: [7859] resuming replay at index 69 (0:00:02.20)
Apr  9 08:25:50 jarada vdr: [7860] non blocking file reader thread started (pid=7837, tid=7860)
Apr  9 08:25:50 jarada vdr: [7859] SetBrokenLink: no GOP header found in video packet
Apr  9 08:25:50 jarada vdr: [7859] switching to pre 1.3.19 Dolby Digital compatibility mode

Attached pach fixes this problem for me.

Just found Klaus message from 2007-10-21:
    "[vdr] VDR 1.5.10, Subtitles gets out of sync":
    http://www.linuxtv.org/pipermail/vdr/2007-October/014316.html
  

Comments

Klaus Schmidinger April 12, 2008, 2:10 p.m. UTC | #1
On 04/09/08 08:54, Stefan Lucke wrote:
> On Wednesday 05 March 2008, Klaus Schmidinger wrote:
>> On 03/04/08 10:58, Tero Siironen wrote:
>>> Hi,
>>>
>>> I upgraded from VDR 1.4.7 to 1.5.17 and noticed that some of my old  
>>> recordings won't play decently with this new version. Here's a syslog  
>>> entry and example clip can be found from http://kotisivu.suomi.net/izero/vdr-darwin/ddmode_example.zip 
>>>   (9MB)
>>>
>>> Those problematic recordings were done with some 1.3.x series VDR with  
>>> ttxtsubs plugin in fall 2004. Plays fine with VDR 1.4.7, but playback  
>>> stutters when playing with VDR 1.5.17. My system has DVB-C FF 2.1 and  
>>> DVB-C budget cards. Running on Fedora 5.
>> My guess would be that the offending data comes from the ttxtsubs plugin.
>> Maybe you need to patch VDR to become aware of this.
> 
> My guess is that this is introduced by vdr-1.5.11
> 
> Original vdr-1.6.0:
> Apr  9 08:29:38 jarada vdr: [7997] replay /net_data/video/Extra/Enterprise_1/%1-01_Aufbruch_ins_Unbekannte_-_Teil_1/2004-01-31.19:05.99.99.rec
> Apr  9 08:29:38 jarada vdr: [7997] playing '/net_data/video/Extra/Enterprise_1/%1-01_Aufbruch_ins_Unbekannte_-_Teil_1/2004-01-31.19:05.99.99.rec/001.vdr'
> Apr  9 08:29:38 jarada vdr: [7997] loading /net_data/video/Extra/Enterprise_1/%1-01_Aufbruch_ins_Unbekannte_-_Teil_1/2004-01-31.19:05.99.99.rec//marks.vdr
> Apr  9 08:29:38 jarada vdr: [8019] dvbplayer thread started (pid=7997, tid=8019)
> Apr  9 08:29:38 jarada vdr: [8020] non blocking file reader thread started (pid=7997, tid=8020)
> Apr  9 08:29:38 jarada vdr: [8019] unknown PS1 packet, substream id = EB (counter is at 0)
> Apr  9 08:29:38 jarada vdr: [8019] unknown PS1 packet, substream id = 0B (counter is at 1)
> Apr  9 08:29:38 jarada vdr: [8019] unknown PS1 packet, substream id = D1 (counter is at 2)
> Apr  9 08:29:38 jarada vdr: [8019] unknown PS1 packet, substream id = 5D (counter is at 3)
> Apr  9 08:29:38 jarada vdr: [8019] unknown PS1 packet, substream id = F0 (counter is at 4)
> Apr  9 08:29:38 jarada vdr: [8019] unknown PS1 packet, substream id = 7E (counter is at 5)
> 
> In this case there is no sound at all :-(.
> Recording was done with vdr-1.2.1.
> 
> Plain vdr 1.6.0 with pre_1_3_19 change (from vdr-1.5.11) reverted:
> Apr  9 08:25:50 jarada vdr: [7837] replay /net_data/video/Extra/Enterprise_1/%1-01_Aufbruch_ins_Unbekannte_-_Teil_1/2004-01-31.19:05.99.99.rec
> Apr  9 08:25:50 jarada vdr: [7837] playing '/net_data/video/Extra/Enterprise_1/%1-01_Aufbruch_ins_Unbekannte_-_Teil_1/2004-01-31.19:05.99.99.rec/001.vdr'
> Apr  9 08:25:50 jarada vdr: [7837] loading /net_data/video/Extra/Enterprise_1/%1-01_Aufbruch_ins_Unbekannte_-_Teil_1/2004-01-31.19:05.99.99.rec//marks.vdr
> Apr  9 08:25:50 jarada vdr: [7859] dvbplayer thread started (pid=7837, tid=7859)
> Apr  9 08:25:50 jarada vdr: [7859] resuming replay at index 69 (0:00:02.20)
> Apr  9 08:25:50 jarada vdr: [7860] non blocking file reader thread started (pid=7837, tid=7860)
> Apr  9 08:25:50 jarada vdr: [7859] SetBrokenLink: no GOP header found in video packet
> Apr  9 08:25:50 jarada vdr: [7859] switching to pre 1.3.19 Dolby Digital compatibility mode
> 
> Attached pach fixes this problem for me.

Your patch changed two things: the MIN_PRE_1_3_19_PRIVATESTREAM stuff, which merely
made detection of pre 1.3.19 Dolby Digital data more reliable, and the (Data[7] & 0x01)
check in "// Compatibility mode for old subtitles plugin:". I assume that the latter one
is what's causing your problems.

Can you please reinstate the MIN_PRE_1_3_19_PRIVATESTREAM stuff and check whether just
leaving out the (Data[7] & 0x01) check is enough to fix this?

This additional check was suggested by Marco Schlüßler, so maybe he can comment
on this and maybe find out why this is interfering with the pre 1.3.19 Dolby Digital
detection?

Klaus
  

Patch

--- device.c.orig	2007-11-03 14:30:09.000000000 +0100
+++ device.c	2008-04-08 15:06:51.000000000 +0200
@@ -209,9 +209,6 @@ 
 // The default priority for non-primary devices:
 #define DEFAULTPRIORITY  -1
 
-// The minimum number of unknown PS1 packets to consider this a "pre 1.3.19 private stream":
-#define MIN_PRE_1_3_19_PRIVATESTREAM 10
-
 int cDevice::numDevices = 0;
 int cDevice::useDevice = 0;
 int cDevice::nextCardIndex = 0;
@@ -934,7 +931,7 @@ 
         }
      else
         memset(availableTracks, 0, sizeof(availableTracks));
-     pre_1_3_19_PrivateStream = 0;
+     pre_1_3_19_PrivateStream = false;
      SetAudioChannel(0); // fall back to stereo
      currentAudioTrackMissingCount = 0;
      currentAudioTrack = ttNone;
@@ -1239,7 +1236,7 @@ 
                int PayloadOffset = Data[8] + 9;
 
                // Compatibility mode for old subtitles plugin:
-               if ((Data[7] & 0x01) && (Data[PayloadOffset - 3] & 0x81) == 0x01 && Data[PayloadOffset - 2] == 0x81)
+               if ((Data[PayloadOffset - 3] & 0x81) == 1 && Data[PayloadOffset - 2] == 0x81)
                   PayloadOffset--;
 
                uchar SubStreamId = Data[PayloadOffset];
@@ -1248,13 +1245,11 @@ 
 
                // Compatibility mode for old VDR recordings, where 0xBD was only AC3:
 pre_1_3_19_PrivateStreamDeteced:
-               if (pre_1_3_19_PrivateStream > MIN_PRE_1_3_19_PRIVATESTREAM) {
+               if (pre_1_3_19_PrivateStream) {
                   SubStreamId = c;
                   SubStreamType = 0x80;
                   SubStreamIndex = 0;
                   }
-               else if (pre_1_3_19_PrivateStream)
-                  pre_1_3_19_PrivateStream--; // every known PS1 packet counts down towards 0 to recover from glitches...
                switch (SubStreamType) {
                  case 0x20: // SPU
                  case 0x30: // SPU
@@ -1282,14 +1277,11 @@ 
                       break;
                  default:
                       // Compatibility mode for old VDR recordings, where 0xBD was only AC3:
-                      if (pre_1_3_19_PrivateStream <= MIN_PRE_1_3_19_PRIVATESTREAM) {
-                         dsyslog("unknown PS1 packet, substream id = %02X (counter is at %d)", SubStreamId, pre_1_3_19_PrivateStream);
-                         pre_1_3_19_PrivateStream += 2; // ...and every unknown PS1 packet counts up (the very first one counts twice, but that's ok)
-                         if (pre_1_3_19_PrivateStream > MIN_PRE_1_3_19_PRIVATESTREAM) {
-                            dsyslog("switching to pre 1.3.19 Dolby Digital compatibility mode - substream id = %02X", SubStreamId);
-                            ClrAvailableTracks();
-                            goto pre_1_3_19_PrivateStreamDeteced;
-                            }
+                      if (!pre_1_3_19_PrivateStream) {
+                         dsyslog("switching to pre 1.3.19 Dolby Digital compatibility mode");
+                         ClrAvailableTracks();
+                         pre_1_3_19_PrivateStream = true;
+                         goto pre_1_3_19_PrivateStreamDeteced;
                          }
                  }
                }