vdr <-> vdr-xine <-> xine-lib and vdpau and HD recordings

Message ID 4D966FF0.6040202@gmx.de
State New
Headers

Commit Message

Joerg Riechardt April 2, 2011, 12:38 a.m. UTC
  Problem solved with this patch:
    delete readFrame; // might not have been stored in the buffer in 
Action()
    readFrame = NULL;
    playFrame = NULL;
@@ -388,6 +388,8 @@
    int pc = 0;

    readIndex = Resume();
+  int resume = readIndex;
+  bool firsttime = true;
    if (readIndex >= 0)
       isyslog("resuming replay at index %d (%s)", readIndex, 
*IndexToHMSF(readIndex, true, framesPerSecond));

@@ -452,6 +454,12 @@
                     else if (index) {
                        uint16_t FileNumber;
                        off_t FileOffset;
+                      if (firsttime) {
+                        if (readIndex == (resume + 32)) {
+                        Goto((readIndex - 32));// prevents dropped 
frames in xine vdpau h264
+                        firsttime = false;
+                        }
+                      }
                        if (index->Get(readIndex + 1, &FileNumber, 
&FileOffset, &readIndependent, &Length) && NextFile(FileNumber, FileOffset))
                           readIndex++;
                        else
@@ -760,7 +768,7 @@
          if (Index > 0)
             Index = index->GetNextIFrame(Index, false, NULL, NULL, 
NULL, true);
          if (Index >= 0)
-           readIndex = Index - 1; // Action() will first increment it!
+           readIndex = Index; // prevents dropped frames in xine vdpau h264
          }
       Play();
       }
  

Comments

Klaus Schmidinger April 2, 2011, 9:18 p.m. UTC | #1
On 02.04.2011 02:38, Joerg Riechardt wrote:
> Problem solved with this patch:
> --- dvbplayer.c.orig 2010-03-07 15:24:26.000000000 +0100
> +++ dvbplayer.c 2011-04-02 01:57:21.016535946 +0200
> @@ -320,7 +320,7 @@
> if (nonBlockingFileReader)
> nonBlockingFileReader->Clear();
> if (!firstPacket) // don't set the readIndex twice if Empty() is called more than once
> - readIndex = ptsIndex.FindIndex(DeviceGetSTC()) - 1; // Action() will first increment it!
> + readIndex = ptsIndex.FindIndex(DeviceGetSTC()); // prevents dropped frames in xine vdpau h264
> delete readFrame; // might not have been stored in the buffer in Action()
> readFrame = NULL;
> playFrame = NULL;
> @@ -388,6 +388,8 @@
> int pc = 0;
>
> readIndex = Resume();
> + int resume = readIndex;
> + bool firsttime = true;
> if (readIndex >= 0)
> isyslog("resuming replay at index %d (%s)", readIndex, *IndexToHMSF(readIndex, true, framesPerSecond));
>
> @@ -452,6 +454,12 @@
> else if (index) {
> uint16_t FileNumber;
> off_t FileOffset;
> + if (firsttime) {
> + if (readIndex == (resume + 32)) {
> + Goto((readIndex - 32));// prevents dropped frames in xine vdpau h264
> + firsttime = false;
> + }
> + }
> if (index->Get(readIndex + 1, &FileNumber, &FileOffset, &readIndependent, &Length) && NextFile(FileNumber, FileOffset))
> readIndex++;
> else
> @@ -760,7 +768,7 @@
> if (Index > 0)
> Index = index->GetNextIFrame(Index, false, NULL, NULL, NULL, true);
> if (Index >= 0)
> - readIndex = Index - 1; // Action() will first increment it!
> + readIndex = Index; // prevents dropped frames in xine vdpau h264
> }
> Play();
> }

I can't help the feeling that this is a problem that should
be addressed in xine, rather than working around it in VDR.

Klaus
  
Joerg Riechardt April 2, 2011, 10:30 p.m. UTC | #2
Am 02.04.2011 23:18, schrieb Klaus Schmidinger:
> On 02.04.2011 02:38, Joerg Riechardt wrote:
>> Problem solved with this patch:
>> --- dvbplayer.c.orig 2010-03-07 15:24:26.000000000 +0100
>> +++ dvbplayer.c 2011-04-02 01:57:21.016535946 +0200
>> @@ -320,7 +320,7 @@
>> if (nonBlockingFileReader)
>> nonBlockingFileReader->Clear();
>> if (!firstPacket) // don't set the readIndex twice if Empty() is
>> called more than once
>> - readIndex = ptsIndex.FindIndex(DeviceGetSTC()) - 1; // Action() will
>> first increment it!
>> + readIndex = ptsIndex.FindIndex(DeviceGetSTC()); // prevents dropped
>> frames in xine vdpau h264
>> delete readFrame; // might not have been stored in the buffer in Action()
>> readFrame = NULL;
>> playFrame = NULL;
>> @@ -388,6 +388,8 @@
>> int pc = 0;
>>
>> readIndex = Resume();
>> + int resume = readIndex;
>> + bool firsttime = true;
>> if (readIndex >= 0)
>> isyslog("resuming replay at index %d (%s)", readIndex,
>> *IndexToHMSF(readIndex, true, framesPerSecond));
>>
>> @@ -452,6 +454,12 @@
>> else if (index) {
>> uint16_t FileNumber;
>> off_t FileOffset;
>> + if (firsttime) {
>> + if (readIndex == (resume + 32)) {
>> + Goto((readIndex - 32));// prevents dropped frames in xine vdpau h264
>> + firsttime = false;
>> + }
>> + }
>> if (index->Get(readIndex + 1, &FileNumber, &FileOffset,
>> &readIndependent, &Length) && NextFile(FileNumber, FileOffset))
>> readIndex++;
>> else
>> @@ -760,7 +768,7 @@
>> if (Index > 0)
>> Index = index->GetNextIFrame(Index, false, NULL, NULL, NULL, true);
>> if (Index >= 0)
>> - readIndex = Index - 1; // Action() will first increment it!
>> + readIndex = Index; // prevents dropped frames in xine vdpau h264
>> }
>> Play();
>> }
>
> I can't help the feeling that this is a problem that should
> be addressed in xine, rather than working around it in VDR.
>
> Klaus

I agree. I just thought, until that happens, it is nice for those 
concerned to have that patch.
And maybe this patch gives an idea for a fix in xine.
Joerg
  

Patch

--- dvbplayer.c.orig    2010-03-07 15:24:26.000000000 +0100
+++ dvbplayer.c 2011-04-02 01:57:21.016535946 +0200
@@ -320,7 +320,7 @@ 
    if (nonBlockingFileReader)
       nonBlockingFileReader->Clear();
    if (!firstPacket) // don't set the readIndex twice if Empty() is 
called more than once
-     readIndex = ptsIndex.FindIndex(DeviceGetSTC()) - 1;  // Action() 
will first increment it!
+     readIndex = ptsIndex.FindIndex(DeviceGetSTC());  // prevents 
dropped frames in xine vdpau h264