[dvblast-devel] PATCH: Avoid jitter in RTP timestamps
Zoilo Gomez
zoilo at xs4all.nl
Tue Sep 22 00:37:55 CEST 2009
Hi Marian,
We are also experiencing some form of jitter, which I believe is related
to PCR somehow.
The jitter is especially noticeable on ticker tapes, like many TV
channels have scrolling horizontally, displaying for example real-time
stock exchange info, or news headlines.
If I stream the TV program over the network using dvblast (or vlc) ,
then the ticker tape does not scroll smoothly anymore; however without
streaming it looks perfect. Therefore I assume that the streamer
introduces some kind of clock jitter into the ts.
Found your patch, and noticed that it has not yet been applied to the
main svn code, so I applied it, but alas: same result. No noticeable
difference; ticker tapes are still jittery.
Perhaps my problem is different, or do you have some suggestion how to
proceed? Do you have a test channel where I can see the difference
with/without patch?
Thank you and best regards,
Zoilo.
> Hi,
>
> after sucessfully setting up dvblast in our environment, I noticed some
> unexpected jitter in RTP timestamps. Closer investigation shows, that this
> is caused by the fact, that kernel feeds us TS packets from DVB cards in
> chunks once per approx. 12 msec. If the packet with PCR happens to be at
> the end of a chunk, next TS packets will only arrive after 12 msec, which
> will make the RTP timestamp inacurate.
>
> The attached patch fixes this problem by taking reference wallclock
> samples during output phase. This way RTP timestamp always matches PCR
> contained in transmitted IP packet.
>
> With kind regards,
>
> M.
>
> --------------------------------------------------------------------------
> ---- ----
> ---- Marian Ďurkovič network manager ----
> ---- ----
> ---- Slovak Technical University Tel: +421 2 571 041 81 ----
> ---- Computer Centre, Nám. Slobody 17 Fax: +421 2 524 94 351 ----
> ---- 812 43 Bratislava, Slovak Republic E-mail/sip: md at bts.sk ----
> ---- ----
> --------------------------------------------------------------------------
> -------------- next part --------------
> Index: output.c
> ===================================================================
> --- output.c (revision 14)
> +++ output.c (working copy)
> @@ -95,7 +95,7 @@
> p_output->p_pmt_section = NULL;
> p_output->p_sdt_section = NULL;
> p_output->i_ref_timestamp = 0;
> - p_output->i_ref_wallclock = mdate();
> + p_output->i_ref_wallclock = 0;
> p_output->i_eit_last_table_id = 0;
>
> p_output->i_maddr = i_maddr;
> @@ -245,9 +245,19 @@
>
> static void rtp_SetHdr( output_t *p_output, uint8_t *p_hdr )
> {
> - mtime_t i_timestamp = p_output->i_ref_timestamp
> - + (mdate() - p_output->i_ref_wallclock) * 9 / 100;
> + mtime_t i_timestamp;
>
> + if (!p_output->i_ref_wallclock)
> + {
> + i_timestamp = p_output->i_ref_timestamp;
> + p_output->i_ref_wallclock = mdate();
> + }
> + else
> + {
> + i_timestamp = p_output->i_ref_timestamp
> + + (mdate() - p_output->i_ref_wallclock) * 9 / 100;
> + }
> +
> p_hdr[0] = 0x80;
> p_hdr[1] = 33;
> p_hdr[2] = p_output->i_cc >> 8;
> Index: demux.c
> ===================================================================
> --- demux.c (revision 14)
> +++ demux.c (working copy)
> @@ -225,7 +225,7 @@
> if ( pp_outputs[j]->i_sid == i_sid )
> {
> pp_outputs[j]->i_ref_timestamp = i_timestamp;
> - pp_outputs[j]->i_ref_wallclock = i_wallclock;
> + pp_outputs[j]->i_ref_wallclock = 0;
> }
> }
> }
More information about the dvblast-devel
mailing list