Re: [vdr] FF card AV sync problems, possible fix to VDR (fwd)

2008-03-17 Thread Dr. Werner Fink
On Sat, Mar 15, 2008 at 03:12:49PM +0100, Halim Sahin wrote:
 Hi Werner and List,
 On Mi, Mär 07, 2007 at 04:36:12 +0100, Dr. Werner 
 Fink wrote:
  Beside a small problem of Video underruns during change
  from AC3 to Mpeg-Audio and at the start of a replay,
  I see no problems.  At least the problem with broken
  Mpeg-Audio frames are gone.  Hopefully I've something
  ready at this evening :^)
 
 Is this the mentioned firmware?  
 http://www.suse.de/~werner/test_av-f22623.tar.bz2
 
 What is the current status of the dvb firmware?
 Are you planning to release a new version?

I'm currently very busy with my little daughter most
free time but I'm also working on the firmware.  It
has taken some time and will take some time.

   Werner

-- 
AC3 loop through sound card http://bitstreamout.sourceforge.net/
Howto http://www.vdr-portal.de/board/thread.php?threadid=1958
--
 Having a smoking section in a restaurant is like having
 a  peeing section in a swimming pool. -- Edward Burr

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] FF card AV sync problems, possible fix to VDR (fwd)

2008-03-15 Thread Halim Sahin
Hi Werner and List,
On Mi, Mär 07, 2007 at 04:36:12 +0100, Dr. Werner 
Fink wrote:
 Beside a small problem of Video underruns during change
 from AC3 to Mpeg-Audio and at the start of a replay,
 I see no problems.  At least the problem with broken
 Mpeg-Audio frames are gone.  Hopefully I've something
 ready at this evening :^)

Is this the mentioned firmware?  
http://www.suse.de/~werner/test_av-f22623.tar.bz2

What is the current status of the dvb firmware?
Are you planning to release a new version?
BR.
Halim


___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] FF card AV sync problems, possible fix to VDR (fwd)

2007-03-07 Thread Dr. Werner Fink
On Sun, Mar 04, 2007 at 12:42:11PM +, Morfsta wrote:
 Hi Werner,
 
 Were there problems?

Beside a small problem of Video underruns during change
from AC3 to Mpeg-Audio and at the start of a replay,
I see no problems.  At least the problem with broken
Mpeg-Audio frames are gone.  Hopefully I've something
ready at this evening :^)


   Werner

 On 2/23/07, Dr. Werner Fink [EMAIL PROTECTED] wrote:
 On Thu, Feb 22, 2007 at 06:18:11PM +, Morfsta wrote:
  Hi Werner,
 
  Any idea when you will be able to release the new firmware for testing?
 
 I'm just testing the stuff in real live on my productions system ;)
 Knock on wood that this stays stable ...
 
  Werner

-- 
AC3 loop through sound card http://bitstreamout.sourceforge.net/
Howto http://www.vdr-portal.de/board/thread.php?threadid=1958
--
 Having a smoking section in a restaurant is like having
 a  peeing section in a swimming pool. -- Edward Burr

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] FF card AV sync problems, possible fix to VDR (fwd)

2007-03-07 Thread VDR User

On 3/7/07, Dr. Werner Fink [EMAIL PROTECTED] wrote:


AC3 loop through sound card http://bitstreamout.sourceforge.net/
Howto http://www.vdr-portal.de/board/thread.php?threadid=1958



German language howtos are useless to all us english-speaking vdr users (and
there are a LOT of us!).  Perhaps someone can bother to translate.

Thanks.
___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


[vdr] FF card AV sync problems, possible fix to VDR (fwd)

2007-03-04 Thread Morfsta

Hi Werner,

Were there problems?

Morfsta

On 2/23/07, Dr. Werner Fink [EMAIL PROTECTED] wrote:


On Thu, Feb 22, 2007 at 06:18:11PM +, Morfsta wrote:
 Hi Werner,

 Any idea when you will be able to release the new firmware for testing?

I'm just testing the stuff in real live on my productions system ;)
Knock on wood that this stays stable ...

 Werner

--
Having a smoking section in a restaurant is like having
 a peeing section in a swimming pool. -- Edward Burr

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] FF card AV sync problems, possible fix to VDR (fwd)

2007-02-23 Thread Dr. Werner Fink
On Thu, Feb 22, 2007 at 06:18:11PM +, Morfsta wrote:
 Hi Werner,
 
 Any idea when you will be able to release the new firmware for testing?

I'm just testing the stuff in real live on my productions system ;)
Knock on wood that this stays stable ...

  Werner

-- 
  Having a smoking section in a restaurant is like having
  a peeing section in a swimming pool. -- Edward Burr

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] FF card AV sync problems, possible fix to VDR (fwd)

2007-02-22 Thread Dr. Werner Fink
On Wed, Feb 21, 2007 at 11:12:43PM +0100, Reinhard Nissl wrote:
 
 Actually, I don't know how this is done in the case of a FF card and
 what the firmware has to do in this regard. A guess -- which could
 explain the issues you see -- would be that sync is not maintained
 continuously. So after having maintained sync for some time, audio and
 video frames are simply taken out of some FIFOs at a constant rate and
 presented to the user -- this should keep audio and video in sync as
 originally maintained. But when then for example an audio frame gets
 lost due to a lost TS packet, audio and video get out of sync as the
 lost packet brakes filling the FIFOs at a constant rate. When you try to
 reproduce this effect by seeking back in the recording, then sync is
 maintained actively and you don't see this issue again at that position
 in the recording.

If the resulting Mpeg-Audio stream is broken in such a way that
the HW-Decoder runs into trouble from which it can not recover
the Audio HW_buffer gets emptied very fast which .. in fact ..
results in a silent but very fast video sequence.  For the next
firmware I've added a dectection of such an unrecoverable audio
decoder error to restart the audio decoder as fast as possible.

Btw: With xine and mplayer I hear a short noise and nothing
happen with the running picture. Maybe the mplay software
decoder its self has some checking about the Mpeg-Audio stream
and the AV synchronization does not depend on the audio PTS.


 Werner

-- 
  Having a smoking section in a restaurant is like having
  a peeing section in a swimming pool. -- Edward Burr

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] FF card AV sync problems, possible fix to VDR (fwd)

2007-02-22 Thread Kartsa

Halim Sahin kirjoitti:
This has been very illuminating. Maybe I made some mistake with the 
logging because there really is no TS continuity error in the log. I 
definitely have -l 3 on commandline (just checked with ps -ef). And I 



Under debian Systems you must look in to /var/log/syslog and
not in to /var/log/messages.
It depends on your syslog configuration.
Maybe it helps.
  
Thanks, but in FC it is /var/log/messages :) And everything else is in 
messages file. There is no syslog file. But it has to be something to do 
with where the messages are at least trying to be written. Maybe I'll 
figure it out some day :)


\\Kartsa

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


[vdr] FF card AV sync problems, possible fix to VDR (fwd)

2007-02-22 Thread Morfsta

Hi Werner,

Any idea when you will be able to release the new firmware for testing?

Kind Regards,

Morfsta


On 2/22/07, Dr. Werner Fink [EMAIL PROTECTED] wrote:


For the next firmware I've added a dectection of such an unrecoverable
audio
decoder error to restart the audio decoder as fast as possible.
___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] FF card AV sync problems, possible fix to VDR (fwd)

2007-02-22 Thread Reinhard Nissl
Hi,

Dr. Werner Fink wrote:

 On Wed, Feb 21, 2007 at 11:12:43PM +0100, Reinhard Nissl wrote:

 Actually, I don't know how this is done in the case of a FF card and
 what the firmware has to do in this regard. A guess -- which could
 explain the issues you see -- would be that sync is not maintained
 continuously. So after having maintained sync for some time, audio and
 video frames are simply taken out of some FIFOs at a constant rate and
 presented to the user -- this should keep audio and video in sync as
 originally maintained. But when then for example an audio frame gets
 lost due to a lost TS packet, audio and video get out of sync as the
 lost packet brakes filling the FIFOs at a constant rate. When you try to
 reproduce this effect by seeking back in the recording, then sync is
 maintained actively and you don't see this issue again at that position
 in the recording.
 
 If the resulting Mpeg-Audio stream is broken in such a way that
 the HW-Decoder runs into trouble from which it can not recover
 the Audio HW_buffer gets emptied very fast which .. in fact ..
 results in a silent but very fast video sequence.  For the next
 firmware I've added a dectection of such an unrecoverable audio
 decoder error to restart the audio decoder as fast as possible.
 
 Btw: With xine and mplayer I hear a short noise and nothing
 happen with the running picture. Maybe the mplay software
 decoder its self has some checking about the Mpeg-Audio stream
 and the AV synchronization does not depend on the audio PTS.

Well, in xine it works like that:

The demuxer thread reads the PES packets from the input stream,
determines whether the packet is audio respectively video, get's an
empty buffer from either the audio respectively video input buffer pool,
fills the buffer with the PES payload, transfers PTS from the PES packet
to the buffer when PTS is available in the PES packet and puts the
buffer into the audio respectively video input FIFO of the decoders.

Audio and video is decoded by different threads. Each one takes a buffer
from its input FIFO, stores the contained PTS value internally when one
is available to have it ready when the next access unit (= an audio
respectively video frame) is started. The buffer's data is decoded into
the current access unit's output buffer. When a new access unit starts,
the current output buffer is put into the audio respectively video
output FIFO and a new output buffer is allocated from the audio
respectively video output buffer pool. When a PTS value is available,
the PTS value is transferred into the current access unit's output
buffer. Otherwise, the PTS value of the last access unit's output buffer
is incremented by the last access unit's duration (= either audio
respectively video frame duration) and transferred instead. As a result
each decoded audio respectively video frame has now a PTS value assigned
to it (to be precise, transferring the PTS value translates it into an
internal representation which is used next).

Audio and video presentation is done by different threads. Each one
takes an output buffer (= access unit (= audio respectively video
frame)) from its associated decoder output FIFO, reads the PTS value and
compares it to the STC which is provided by the so called metronom. When
PTS is larger than STC, the video output thread simply sleeps until PTS
is less or equal to STC and when it awakes, it writes the output buffer
into the graphics card's video memory. The audio output thread behaves
similar, although it has to generate silence audio data for the sound
card in the case where sleeping for a longer time would cause the sound
card's input buffer to underrun.

So from the above explanation, I don't think that AV synchronization
doesn't depend on the audio PTS -- at least in the case of xine.

Bye.
-- 
Dipl.-Inform. (FH) Reinhard Nissl
mailto:[EMAIL PROTECTED]

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] FF card AV sync problems, possible fix to VDR (fwd)

2007-02-20 Thread Reinhard Nissl
Hi,

Reinhard Nissl wrote:

 Please provide me some of these files which were dumped in the middle
 of a recording. If size matters, you may reduce the number of packets to
 100.

I had a look into the files you've provided me. It looks like some TS
packets get lost. You can simply check this on your own:

od -Ax -t x1 -w188 -v ts_10973_11079_0xC0_004_116796_1000.log \
| tail -n 20 | less -S

will give you something like the lines below (I've croped the long lines
here for readability). Just have a look a the marked column:

 v
 v
02d06c 47 02 94 13 24 84 c0 8b
02d128 47 02 94 14 44 91 b9 1b
02d1e4 47 02 94 15 a5 ab ab a1
02d2a0 47 02 94 16 40 b4 0c c2
02d35c 47 02 94 17 5d c5 6b 5f
02d418 47 02 94 18 72 5c 3e 84
02d4d4 47 02 94 19 05 81 b4 7e
02d590 47 02 94 1a 95 ba dc 2c
02d64c 47 02 94 1b 86 86 fe 12
02d708 47 02 94 1c 2b 22 a6 d9
02d7c4 47 02 94 1d b9 b5 e2 6d
02d880 47 02 94 1e e4 6e 11 17
02d93c 47 02 94 1f 90 00 00 00
02d9f8 47 02 94 10 ca 1b 20 ed
02dab4 47 02 94 11 55 d5 c6 73
02db70 47 02 94 10 e8 69 4d 5a
02dc2c 47 02 94 11 d8 e5 9a 69
02dce8 47 02 94 12 ac 2a 65 ba
02dda4 47 02 94 13 62 35 d1 c4
02de60   ^
 ^

This nibble represents the TS continuity counter. It cycles properly
from 0 to 9 and a to f throughout the file. But near the end the
following sequence appears:

e f 0 1 . . . . . . . . . . . . . . 0 1 2 3

The dot's indicate at least the missing TS packets with counter values:

_ _ _ _ 2 3 4 5 6 7 8 9 a b c d e f _ _ _ _

I wonder why you didn't get lines like the following in your logfile
after enabling the earlier mentioned source lines and specifying

-l 3

on VDR's command line to turn on debug log messages:

Feb 20 21:41:14 video vdr: [27499] TS continuity error (1)
Feb 20 21:41:15 video vdr: [27499] cTS2PES got 0 TS errors, 1 TS
continuity errors

Sad to say, I can hardly help you further as lost TS packets can be
caused by a couple of reasons:

- Dish alignment
- Weather conditions
- Cabling
- Interference with DECT telephones
- DMA/PCI mainboard issues
- High system load / latency
- DVB driver issues

As you can see, VDR just picks up what survived the above stages.

I had lost TS packets over and over just after replacing my PATA drive
by a SATA drive to have the PATA one sent in for repair. I've contacted
the dvb-mailing list and got driver patches for larger DMA buffers.
Extremely large buffers seemed to fix the problem but not completely.
After the PATA drive returned from repair, I've removed the SATA drive
and -- you won't believe it -- everything worked out of the box as
before, even with default drivers (I won't blame here SATA in general --
this is just my personal experience at that time with certain hardware).

BTW: You may wonder why you do not get these messages when watching live
TV with a FF card. The answer is simple: the TS packets never leave the
card in this case, so VDR has no way to report such an issue for example
in case where the problem would be related to dish alignment. But when
you start a recording for example on a single FF card system, TS packets
will then be sent to VDR for the recording and for live TV, so if you
continue to watch the recorded channel, you'll typically get the
cRepacker messages twice for different threads.

Bye.
-- 
Dipl.-Inform. (FH) Reinhard Nissl
mailto:[EMAIL PROTECTED]

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


[vdr] FF card AV sync problems, possible fix to VDR (fwd)

2007-02-20 Thread Morfsta

OK, so Karsta and I are suffering dropped TS packets. I know for sure that
my DVB-T signal is not perfect so it is likely to occasionally lose some TS
packets (freeview in the UK is susceptible to all sorts of interference from
cars, motorbikes, DECT, etc) however, saying there is nothing that we can do
about this because you don't have a *perfect* DVB signal surely isn't the
right answer! My TV copes perfectly well with dropped packets and doesn't go
out of sync, as does my freeview box. Surely if some TS packets are dropped
this shouldn't result in a loss of sync, the system should resync the audio
and continue as before?? It can't be right to say, well we lost some data,
so we can't recover until you change channels up and down, or
fastforward/rewind by 1 minute!

I have spent the last 2 weeks trying different combinations, playing with my
kernel settings, trying USB DVB-T devices rather than the PCI and it makes
absolutely no difference. The TS continuity errors do not go away so I am
convinced it is simply that DVB-T is not as robust as other signals such as
DVB-S or DVB-C. However, VDR should be able to cope and resync with lost
data.

Regards,

Morfsta
___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] FF card AV sync problems, possible fix to VDR (fwd)

2007-02-20 Thread Reinhard Nissl
Hi,

Morfsta wrote:

 OK, so Karsta and I are suffering dropped TS packets. I know for sure
 that my DVB-T signal is not perfect so it is likely to occasionally lose
 some TS packets (freeview in the UK is susceptible to all sorts of
 interference from cars, motorbikes, DECT, etc) however, saying there is
 nothing that we can do about this because you don't have a *perfect* DVB
 signal surely isn't the right answer! My TV copes perfectly well with

Well, what I wanted to say is that I cannot help you any further at this
point. You have to check your hardware/driver whether there is a chance
to minimize packet loss. You did this already as you wrote below -- fine.

 dropped packets and doesn't go out of sync, as does my freeview box.
 Surely if some TS packets are dropped this shouldn't result in a loss of
 sync, the system should resync the audio and continue as before?? It
 can't be right to say, well we lost some data, so we can't recover until
 you change channels up and down, or fastforward/rewind by 1 minute!

You are right -- but don't you think that this thread got a bit off
topic? I've replied in this thread because there were cAudioRepacker
messages and as I've contributed this code to VDR I just wanted to make
sure that it works correctly in this case. Let's now come back to the
topic and concentrate on the AV sync issue.

 I have spent the last 2 weeks trying different combinations, playing
 with my kernel settings, trying USB DVB-T devices rather than the PCI
 and it makes absolutely no difference. The TS continuity errors do not
 go away so I am convinced it is simply that DVB-T is not as robust as
 other signals such as DVB-S or DVB-C. However, VDR should be able to
 cope and resync with lost data.

Well, basically this is not a matter of VDR but of the FF card's
firmware. For example, I do not own a FF card and do not see this AV
sync issue with xine, even when I intentionally drop TS packets by the
attached patch.

I'd like users of FF cards to test this patch. If this triggers AV sync
issues, firmware developers are invited to fix this issue.

Feel free to modify this patch to better simulate real TS packet losses
like bursts of 16 frames.

BE WARNED: *** do not use this patch on a production system ***

Bye.
-- 
Dipl.-Inform. (FH) Reinhard Nissl
mailto:[EMAIL PROTECTED]
--- ../vdr-1.4.5-orig/remux.c	2006-12-01 15:46:25.0 +0100
+++ remux.c	2007-02-21 00:06:03.0 +0100
@@ -1805,7 +2278,7 @@ void cTS2PES::instant_repack(const uint8
 {
   if (!Buf)
  return;
-
+if ((rand() * 100.0 / RAND_MAX) = 0.05) return; // cause 0.05 % TS packet loss
   if (Buf[1]  TS_ERROR)
  tsErrors++;
 
___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] FF card AV sync problems, possible fix to VDR (fwd)

2007-02-19 Thread Kartsa

Reinhard Nissl kirjoitti:

Hi,

Kartsa wrote:

  

So I would like to raise this one up again. After applying the two
changes (dsyslog(TS continuity error (%d), ccCounter) and { *FrameSize
= 0; dsyslog(cAudioRepacker: FrameSize == 0); } in remux.c) I still
get these lines in log (and -l 3 in vdr startup)

vdr: [3600] cAudioRepacker(0xC0): skipped 232 bytes to sync on next
audio frame
vdr: [3600] cAudioRepacker(0xC0): skipped 240 bytes to sync on next
audio frame
vdr: [3600] cAudioRepacker(0xC0): skipped 492 bytes while syncing on
next audio frame

Why does these skipping of bytes appear?



When do you get these lines?

They are OK just after starting a recording or starting transfer mode.

cAudioRepacker tries to suppress this message while initially syncing
but as the sync pattern is allowed to appear as audio frame data, it is
likely that cAudioRepacker get's in sync by mistake.

After having synced, cAudioRepacker uses the indicated frame length as a
guide when looking for the next audio packet. If the sync pattern isn't
found at the guided position, it will seek for it and report the number
of bytes skipped to find it.

This procedure is executed all over the time and once cAudioRepacker has
found a real sync pattern, the indicated frame length will guide
cAudioRepacker precisely to the next audio frame.

Bye.
  


Ok, here is a snapshot of my log. There is no replay going during this 
time but a coupleof recordings are as can be seen. I've stripped channel 
events.


Feb 18 17:14:00 kari vdr: [2670] timer 3 (6 1714-1754 'StrF6msF6') start
Feb 18 17:14:00 kari vdr: [2670] record 
/srv/vdr/StrF6msF6/2007-02-18.17.14.50.99.rec
Feb 18 17:17:02 kari vdr: [3600] cAudioRepacker(0xC0): skipped 284 bytes 
while syncing on next audio frame

Feb 18 17:19:02 kari vdr: [3600] 1 cRepacker messages suppressed
Feb 18 17:19:02 kari vdr: [3600] cAudioRepacker(0xC0): skipped 232 bytes 
to sync on next audio frame
Feb 18 17:20:25 kari vdr: [3600] cAudioRepacker(0xC0): skipped 240 bytes 
to sync on next audio frame
Feb 18 17:21:28 kari vdr: [3600] cAudioRepacker(0xC0): skipped 492 bytes 
while syncing on next audio frame

Feb 18 17:22:56 kari vdr: [3600] 1 cRepacker messages suppressed
Feb 18 17:22:56 kari vdr: [3600] cAudioRepacker(0xC0): skipped 376 bytes 
to sync on next audio frame

Feb 18 17:23:37 kari vdr: [3600] 1 cRepacker messages suppressed
Feb 18 17:23:37 kari vdr: [3600] cAudioRepacker(0xC0): skipped 536 bytes 
to sync on next audio frame

Feb 18 17:26:36 kari vdr: [3600] 1 cRepacker messages suppressed
Feb 18 17:26:36 kari vdr: [3600] cAudioRepacker(0xC0): skipped 112 bytes 
to sync on next audio frame
Feb 18 17:27:21 kari vdr: [3600] cAudioRepacker(0xC0): skipped 304 bytes 
to sync on next audio frame
Feb 18 17:30:37 kari vdr: [3600] cAudioRepacker(0xC0): skipped 352 bytes 
to sync on next audio frame
Feb 18 17:34:41 kari vdr: [3600] cAudioRepacker(0xC0): skipped 304 bytes 
to sync on next audio frame

Feb 18 17:38:13 kari vdr: [3600] 2 cRepacker messages suppressed
Feb 18 17:38:13 kari vdr: [3600] cAudioRepacker(0xC0): skipped 112 bytes 
to sync on next audio frame
Feb 18 17:39:07 kari vdr: [3600] cAudioRepacker(0xC0): skipped 112 bytes 
to sync on next audio frame
Feb 18 17:40:00 kari vdr: [2670] timer 4 (4 1659-1740 'TeinitytF6n 
kasvatusopas') stop
Feb 18 17:40:20 kari vdr: [3600] cAudioRepacker(0xC0): skipped 204 bytes 
while syncing on next audio frame

Feb 18 17:41:00 kari vdr: [2899] EPGSearch: timer conflict check started
Feb 18 17:41:00 kari vdr: [2899] EPGSearch: timer conflict check finished
Feb 18 17:41:23 kari vdr: [2670] deleting timer 4 (4 1659-1740 
'TeinitytF6n kasvatusopas')

Feb 18 17:41:37 kari vdr: [3600] 1 cRepacker messages suppressed
Feb 18 17:41:37 kari vdr: [3600] cAudioRepacker(0xC0): skipped 176 bytes 
to sync on next audio frame
Feb 18 17:43:04 kari vdr: [3600] cAudioRepacker(0xC0): skipped 188 bytes 
while syncing on next audio frame

Feb 18 17:44:33 kari vdr: [3600] 1 cRepacker messages suppressed
Feb 18 17:44:33 kari vdr: [3600] cAudioRepacker(0xC0): skipped 300 bytes 
while syncing on next audio frame

Feb 18 17:45:37 kari vdr: [3600] 2 cRepacker messages suppressed
Feb 18 17:45:37 kari vdr: [3600] cAudioRepacker(0xC0): skipped 296 bytes 
to sync on next audio frame
Feb 18 17:47:55 kari vdr: [3600] cAudioRepacker(0xC0): skipped 664 bytes 
to sync on next audio frame

Feb 18 17:51:00 kari vdr: [3600] 1 cRepacker messages suppressed
Feb 18 17:51:00 kari vdr: [3600] cAudioRepacker(0xC0): skipped 528 bytes 
to sync on next audio frame
Feb 18 17:51:56 kari vdr: [3600] cAudioRepacker(0xC0): skipped 112 bytes 
to sync on next audio frame
Feb 18 17:53:03 kari vdr: [3600] cAudioRepacker(0xC0): skipped 608 bytes 
to sync on next audio frame

Feb 18 17:54:00 kari vdr: [2670] timer 3 (6 1714-1754 'StrF6msF6') stop
Feb 18 17:55:23 kari vdr: [2670] deleting timer 3 (6 1714-1754 
'StrF6msF6')


My log is actually full of these.

\\Kartsa


Re: [vdr] FF card AV sync problems, possible fix to VDR (fwd)

2007-02-19 Thread Reinhard Nissl
Hi,

Kartsa wrote:

 My log is actually full of these.

The attached patch adds a TS packet logger to cAudioRepacker, which
stores the last 1000 TS packets that led to synchronization of
cAudioRepacker into a file to /video.

In your logfile you'll then find lines like the following:

Feb 19 21:41:36 video vdr: [9413] cAudioRepacker(0xC1): skipped 24 bytes
to sync on next audio frame
Feb 19 21:41:36 video vdr: [9413] cTSLogger: dumping to file
'/video/ts_9353_9413_0xC1_000_12_12.log'

Please provide me some of these files which were dumped in the middle
of a recording. If size matters, you may reduce the number of packets to
100.

Bye.
-- 
Dipl.-Inform. (FH) Reinhard Nissl
mailto:[EMAIL PROTECTED]

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] FF card AV sync problems, possible fix to VDR (fwd)

2007-02-19 Thread Reinhard Nissl
Hi,

Kartsa wrote:

 My log is actually full of these.

The attached patch adds a TS packet logger to cAudioRepacker, which
stores the last 1000 TS packets that led to synchronization of
cAudioRepacker into a file to /video.

In your logfile you'll then find lines like the following:

Feb 19 21:41:36 video vdr: [9413] cAudioRepacker(0xC1): skipped 24 bytes
to sync on next audio frame
Feb 19 21:41:36 video vdr: [9413] cTSLogger: dumping to file
'/video/ts_9353_9413_0xC1_000_12_12.log'

Please provide me some of these files which were dumped in the middle
of a recording. If size matters, you may reduce the number of packets to
100.

Bye.
-- 
Dipl.-Inform. (FH) Reinhard Nissl
mailto:[EMAIL PROTECTED]

--- ../vdr-1.4.5-orig/remux.c	2006-12-01 15:46:25.0 +0100
+++ remux.c	2007-02-19 21:39:41.0 +0100
@@ -86,6 +86,65 @@ ePesHeader AnalyzePesHeader(const uchar 
   return phMPEG1; // MPEG 1
 }
 
+// --- cTSLogger -
+
+class cTSLogger
+{
+  cMutex mutex;
+  uchar *buffer;
+  int size;
+  int fill;
+  int64_t count;
+  int dumps;
+  int cid;
+
+public:
+  cTSLogger(int Cid);
+  ~cTSLogger();
+  void Put(const uchar *Data);
+  void Dump();
+};
+
+cTSLogger::cTSLogger(int Cid)
+{
+  size = 1000; // number of TS packets to log
+  buffer = new uchar[size * 188];
+  fill = 0;
+  count = 0;
+  dumps = 0;
+  cid = Cid;
+}
+
+cTSLogger::~cTSLogger()
+{
+  delete [] buffer;
+}
+
+void cTSLogger::Put(const uchar *Data)
+{
+  cMutexLock MutexLock(mutex);
+
+  memcpy(buffer[(count++ % size) * 188], Data, 188);
+  if (fill  size)
+ fill++;
+}
+
+void cTSLogger::Dump()
+{
+  cMutexLock MutexLock(mutex);
+
+  char name[200];
+  sprintf(name, /video/ts_%d_%d_0x%02X_%03d_%lld_%d.log, getpid(), cThread::ThreadId(), cid, dumps++, count, fill);
+  esyslog(cTSLogger: dumping to file '%s', name);
+
+  FILE *f = fopen(name, wb);
+  for (int64_t n = count - fill; n  count; n++)
+  fwrite(buffer[(n % size) * 188], 188, 1, f);
+  fclose(f);
+
+  fill = 0;
+}
+
 // --- cRepacker -
 
 #define MIN_LOG_INTERVAL 10 // min. # of seconds between two consecutive log messages of a cRepacker
@@ -110,6 +169,7 @@ public:
   virtual int QuerySnoopSize(void) { return 0; }
   void SetMaxPacketSize(int MaxPacketSize) { maxPacketSize = MaxPacketSize; }
   void SetSubStreamId(uint8_t SubStreamId) { subStreamId = SubStreamId; }
+  virtual void LogTSPacket(const uchar *Data) {}
   };
 
 cRepacker::cRepacker(void)
@@ -691,6 +837,8 @@ private:
   int frameSize;
   int cid;
   static bool IsValidAudioHeader(uint32_t Header, bool Mpeg2, int *FrameSize = NULL);
+  cTSLogger tsLogger;
+  virtual void LogTSPacket(const uchar *Data) { tsLogger.Put(Data); }
 public:
   cAudioRepacker(int Cid);
   virtual void Reset(void);
@@ -712,6 +861,7 @@ int cAudioRepacker::bitRates[2][3][16] =
   };
 
 cAudioRepacker::cAudioRepacker(int Cid)
+  : tsLogger(Cid)
 {
   cid = Cid;
   Reset();
@@ -842,8 +1302,10 @@ void cAudioRepacker::Repack(cRingBufferL
   if (state == syncing) {
  if (initiallySyncing) // omit report for the typical initial case
 initiallySyncing = false;
- else if (skippedBytes  SkippedBytesLimit) // report that syncing dropped some bytes
+ else if (skippedBytes  SkippedBytesLimit) { // report that syncing dropped some bytes
 LOG(cAudioRepacker(0x%02X): skipped %d bytes to sync on next audio frame, cid, skippedBytes - SkippedBytesLimit);
+tsLogger.Dump();
+}
  skippedBytes = 0;
  // if there is a PES header available, then use it ...
  if (pesHeaderBackupLen  0) {
@@ -1803,6 +2278,8 @@ void cTS2PES::instant_repack(const uint8
 
 void cTS2PES::ts_to_pes(const uint8_t *Buf) // don't need count (=188)
 {
+  if (Buf  repacker) repacker-LogTSPacket(Buf);
+ 
   if (!Buf)
  return;
 
___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] FF card AV sync problems, possible fix to VDR (fwd)

2007-02-18 Thread Reinhard Nissl
Hi,

Kartsa wrote:

 So I would like to raise this one up again. After applying the two
 changes (dsyslog(TS continuity error (%d), ccCounter) and { *FrameSize
 = 0; dsyslog(cAudioRepacker: FrameSize == 0); } in remux.c) I still
 get these lines in log (and -l 3 in vdr startup)
 
 vdr: [3600] cAudioRepacker(0xC0): skipped 232 bytes to sync on next
 audio frame
 vdr: [3600] cAudioRepacker(0xC0): skipped 240 bytes to sync on next
 audio frame
 vdr: [3600] cAudioRepacker(0xC0): skipped 492 bytes while syncing on
 next audio frame
 
 Why does these skipping of bytes appear?

When do you get these lines?

They are OK just after starting a recording or starting transfer mode.

cAudioRepacker tries to suppress this message while initially syncing
but as the sync pattern is allowed to appear as audio frame data, it is
likely that cAudioRepacker get's in sync by mistake.

After having synced, cAudioRepacker uses the indicated frame length as a
guide when looking for the next audio packet. If the sync pattern isn't
found at the guided position, it will seek for it and report the number
of bytes skipped to find it.

This procedure is executed all over the time and once cAudioRepacker has
found a real sync pattern, the indicated frame length will guide
cAudioRepacker precisely to the next audio frame.

Bye.
-- 
Dipl.-Inform. (FH) Reinhard Nissl
mailto:[EMAIL PROTECTED]

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] FF card AV sync problems, possible fix to VDR (fwd)

2007-02-04 Thread Reinhard Nissl
Hi,

Kartsa wrote:

 I also applied both of those changes and have not yet seen either of the
 errors in the log.
 
 I do have thosa same log entrys as morfsta especially if I have more
 than two recordings going on while I am watching a previous recording.
 
 \\Kartsa
 
 Morfsta kirjoitti:

 I made the mods to VDR as you suggested but haven't seen either entry
 in the log file yet.

I've just checked remux.c: the c...Repacker messages are logged using
esyslog() while the suggested changes use dsyslog().

So either change dsyslog() to esyslog() or check the commandline of VDR
whether it includes -l 3 (log debug messages) and depending on your
system setup, debug messages might get logged to a different file.

Bye.
-- 
Dipl.-Inform. (FH) Reinhard Nissl
mailto:[EMAIL PROTECTED]

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] FF card AV sync problems, possible fix to VDR (fwd)

2007-02-04 Thread Kartsa

Reinhard Nissl kirjoitti:

I also applied both of those changes and have not yet seen either of the
errors in the log.

I do have thosa same log entrys as morfsta especially if I have more
than two recordings going on while I am watching a previous recording.

\\Kartsa

Morfsta kirjoitti:



I made the mods to VDR as you suggested but haven't seen either entry
in the log file yet.
  


I've just checked remux.c: the c...Repacker messages are logged using
esyslog() while the suggested changes use dsyslog().

So either change dsyslog() to esyslog() or check the commandline of VDR
whether it includes -l 3 (log debug messages) and depending on your
system setup, debug messages might get logged to a different file.
  
So I added -l 3 to my vdr commandline since it was much easier :) Lets 
see if there starts to be log entrys.


Allthough I did mention earlier having out of sync problems while 
watching a recording I noticed that if I rewieved the same recording 
with no other recordings going on there were no sync problems. Also I 
tried watching the same recording on another vdr over the network there 
were no sync problems even if there were recordings going on in the 
source vdr. But as soon as there were recordings going on in the vdr 
that I was using for watching out of sync started to appear. And I used 
nfs not streaming.


\\Kartsa

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] FF card AV sync problems, possible fix to VDR (fwd)

2007-02-03 Thread Kartsa
I also applied both of those changes and have not yet seen either of the 
errors in the log.


I do have thosa same log entrys as morfsta especially if I have more 
than two recordings going on while I am watching a previous recording.


\\Kartsa

Morfsta kirjoitti:
I lose sync on live tv as well as recordings and get the following in 
/var/log/messages.
 
Feb  3 19:04:18 morfsta vdr: [6714] 1 cRepacker messages suppressed
Feb  3 19:04:18 morfsta vdr: [6714] cAudioRepacker(0xC0): skipped 584 
bytes while syncing on next audio frame

Feb  3 19:04:18 morfsta vdr: [3470] 1 cRepacker messages suppressed
Feb  3 19:04:18 morfsta vdr: [3470] cAudioRepacker(0xC0): skipped 584 
bytes while syncing on next audio frame

Feb  3 19:04:32 morfsta vdr: [6714] 1 cRepacker messages suppressed
Feb  3 19:04:32 morfsta vdr: [6714] cAudioRepacker(0xC0): skipped 588 
bytes to sync on next audio frame

Feb  3 19:04:32 morfsta vdr: [3470] 1 cRepacker messages suppressed
Feb  3 19:04:32 morfsta vdr: [3470] cAudioRepacker(0xC0): skipped 588 
bytes to sync on next audio frame
 
I made the mods to VDR as you suggested but haven't seen either entry 
in the log file yet.
 
I want to try and isolate a recording sample shortly to give to 
Oliver, but obviously there is nothing I can do about the live sync 
problem (you're welcome to visit my house if you like!!!)
 
Regards
 
Morfsta
 
On 2/1/07, *Reinhard Nissl* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:


Hi,

Kartsa wrote:

 Should I do both these changes at the same time or separately?

I think you may apply both changes at the same time.




___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] FF card AV sync problems, possible fix to VDR (fwd)

2007-02-01 Thread Kartsa

Ville Rannikko kirjoitti:

  Hi!
  The newest firmware for FF cards did not completely fix the AV 
desync  problems

  for me.
Can you provide a sample recording where A/V sync fails with the current
firmware?


Oh, well. Turns out that I had somehow failed to install the new 
firmware properly. My test patch is possibly not needed at all.


I still have experienced AV sync problem with the new fw. The problem is 
that I can not reproduce the problem. Replaying the video again does not 
usually give the same result. The sync problem I've experienced with 
this new fw is just a slight out of sync, less than half a second, but 
it is noticeable. I can not really say yet how the problem occurs, what 
are the circumstances. I must check if pausing or jumping causes it or 
is it something changes in the video. Its nowadays so rare :) I was so 
used to have it :)


\\Kartsa

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] FF card AV sync problems, possible fix to VDR (fwd)

2007-02-01 Thread Kartsa

Ville Rannikko kirjoitti:

  Hi!
  The newest firmware for FF cards did not completely fix the AV 
desync  problems

  for me.
Can you provide a sample recording where A/V sync fails with the current
firmware?


I was just watching an Idols Extra recorded today and there were 
multiple out of sync situations that were allways fixed by a 10s 
backwards jump. I could not see anything in the picture (like periods of 
black etc.) that would cause this. To make the best of this I should 
make the whole recording available somewhere because I would not know 
what to take out of it. And that is not very convenient because of the 
size of the file.


This is what was in the log if this is at all relevant.

Feb  1 21:20:48 vdr: [2635] replay 
/srv/vdr/Idols_Extra/2007-02-01.20.59.50.99.rec

Feb  1 21:20:59 vdr: [3955] 3 cRepacker messages suppressed
Feb  1 21:20:59 vdr: [3955] cAudioRepacker(0xC0): skipped 134 bytes to 
sync on next audio frame

Feb  1 21:22:09 vdr: [3955] 2 cRepacker messages suppressed
Feb  1 21:22:09 vdr: [3955] cAudioRepacker(0xC0): skipped 68 bytes while 
syncing on next audio frame

Feb  1 21:25:37 vdr: [3955] 1 cRepacker messages suppressed
Feb  1 21:25:37 vdr: [3955] cAudioRepacker(0xC0): skipped 84 bytes to 
sync on next audio frame
Feb  1 21:26:14 vdr: [3955] cAudioRepacker(0xC0): skipped 68 bytes to 
sync on next audio frame
Feb  1 21:26:45 vdr: [3955] cAudioRepacker(0xC0): skipped 476 bytes 
while syncing on next audio frame

Feb  1 21:32:45 vdr: [3955] 1 cRepacker messages suppressed
Feb  1 21:32:45 vdr: [3955] cAudioRepacker(0xC0): skipped 502 bytes 
while syncing on next audio frame

Feb  1 21:34:52 vdr: [3955] 1 cRepacker messages suppressed
Feb  1 21:34:52 vdr: [3955] cAudioRepacker(0xC0): skipped 232 bytes 
while syncing on next audio frame

Feb  1 21:36:55 vdr: [3955] 3 cRepacker messages suppressed
Feb  1 21:36:55 vdr: [3955] cAudioRepacker(0xC0): skipped 54 bytes to 
sync on next audio frame

Feb  1 21:38:06 vdr: [3955] 2 cRepacker messages suppressed
Feb  1 21:38:06 vdr: [3955] cAudioRepacker(0xC0): skipped 468 bytes 
while syncing on next audio frame

Feb  1 21:40:00 vdr: [2635] timer 22 (5 2059-2140 'Idols Extra') stop

As you can see the recording was on the way as I was watching it.

I've removed two channel events and one ntp event from the log output.

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] FF card AV sync problems, possible fix to VDR (fwd)

2007-02-01 Thread Kartsa

Reinhard Nissl kirjoitti:

If you can reproduce this behaviour, would you please activate the
following line in remux.c:

   dsyslog(TS continuity error (%d), ccCounter);
  
I will try with the recording if the problem reappears and then activate 
that line.

The cRepacker messages might be a result of lost TS packets, which
should be reported by the above line.

Another issue might be, that the audio frames do not contain any length
information. Please modify the line

*FrameSize = 0;

in cAudioRepacker::IsValidAudioHeader to

{ *FrameSize = 0; dsyslog(cAudioRepacker: FrameSize == 0); }

for getting this situation reported.
  

Should I do both these changes at the same time or separately?

\\Kartsa

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


[vdr] FF card AV sync problems, possible fix to VDR (fwd)

2007-01-31 Thread Ville Rannikko

  Hi!
 
 The newest firmware for FF cards did not completely fix the AV desync 
 problems

  for me.
Can you provide a sample recording where A/V sync fails with the current
firmware?


Oh, well. Turns out that I had somehow failed to install the new firmware 
properly. My test patch is possibly not needed at all.


Ville

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr