[dvblast-devel] Second PAT generation in PIDs only mode (plus PCR accuracy errors on output)

Vladimir Yakovlev nagos at inbox.ru
Sat Oct 20 18:12:15 CEST 2012


I stumbled on some bug. First of all, i checked output of DVBLAST on
my custom hardware with analyzer DTA-2160
(http://www.dektec.com/Products/PCIe/DTA-2160/index.asp), and got "Pcr
Accuracy error". Accuracy was suspiciously high (in order of tens of
milliseconds). After some analysing, i noticed that DVBlast remove
NULL packets. If I broadcast from DTA, null packets are present.

So, i tried "PIDs only", wrote in config something like this
239.192.0.1:5678	1	0	0,200,201,202,8192
and got Null packets in output, but also two sets of PAT tables (PID
0). One from input stream, other empy, generated by dvblast.

Now I have no time to implement it properly, so I just disable it all together:
===================================
--- ../dvblast-2.2_or/demux.c	2012-09-19 16:36:48.958871023 +0400
+++ ./demux.c	2012-10-18 15:13:25.904255257 +0400
@@ -936,6 +936,7 @@
 static void SendPAT( mtime_t i_dts )
 {
     int i;
+    return;

     for ( i = 0; i < i_nb_outputs; i++ )
     {
===================================

I think it is bug, you probably should look at it.

Another problem was with multiprogram stream. Now DVBlast estimate RTP
timestamps based on pcr of selected program, with multiprogram input
it is impossible.
My hardware (Marvell processor) timestamps each TS packet on input, so
i just use this time.
=========================
diff -u -r ../dvblast-2.2_or/dvblast.h ./dvblast.h
--- ../dvblast-2.2_or/dvblast.h	2012-10-20 20:05:34.983803272 +0400
+++ ./dvblast.h	2012-10-20 20:06:01.147803034 +0400
@@ -70,6 +70,7 @@
     int i_refcount;
     mtime_t i_dts;
     struct block_t *p_next;
+    int timestamp;
 } block_t;

 typedef struct packet_t packet_t;
diff -u -r ../dvblast-2.2_or/marvell.c ./marvell.c
--- ../dvblast-2.2_or/marvell.c	2012-10-20 20:05:34.983803272 +0400
+++ ./marvell.c	2012-10-20 20:08:19.479801766 +0400
@@ -72,6 +72,7 @@
         int ret;
         int i;
         block_t *p_ts, **pp_current = &p_ts;
+        double time;

         //printf("marvell read\n");
         pfd[0].fd = i_handle;
@@ -96,6 +97,9 @@
                 }
                 else{
                         //printf("read %d\n", ret);*/
+                        time = buf[0]|(buf[1]<<8)|(buf[2]<<16)|(buf[3]<<24);
+                        time = time*0.192/11.111;
+                        p_ts->timestamp = (int)time;
                         memcpy(p_ts->p_ts, buf+4, 188);
                         return p_ts;
                 }
diff -u -r ../dvblast-2.2_or/output.c ./output.c
--- ../dvblast-2.2_or/output.c	2012-10-20 20:05:34.983803272 +0400
+++ ./output.c	2012-10-20 20:06:01.143803033 +0400
@@ -261,9 +261,7 @@
         rtp_set_type( p_rtp_hdr, RTP_TYPE_TS );
         rtp_set_seqnum( p_rtp_hdr, p_output->i_seqnum++ );
         rtp_set_timestamp( p_rtp_hdr,
-                           p_output->i_ref_timestamp
-                            + (p_packet->i_dts - p_output->i_ref_wallclock)
-                               * 9 / 100 );
+                            p_packet->p_blocks->timestamp);
         rtp_set_ssrc( p_rtp_hdr, p_output->config.pi_ssrc );

         i_iov = 1;
==============================
After those changes I was able to get accurate stream, with no errors
at all. PCR accuracy 0ns :)
I have no idea, how implement it on native DVBlast :)


More information about the dvblast-devel mailing list