[FFmpeg-devel] [PATCH] change PAT/PMT/SDT playout to be dependant on PTS and not a number of packets.

Michael Niedermayer michaelni at gmx.at
Wed May 18 20:31:00 CEST 2011


On Wed, May 18, 2011 at 02:21:03PM +0100, JULIAN GARDNER wrote:
> Change the way in which the PAT, PMT and SDT are inserted into the Mpeg TS, now dependant on time.
> 
> Set to repeat at
> 
> PAT     250ms
> PMT     375ms
> SDT     1250ms
> 
> Maybe add a way of the user setting these values to give faster or slower playout rates, as this does add to the TS overhead.
>


> Also cleaned up the udp.c, removed some variables and an av_log

ive applied the changes to udp.c


[...]
> @@ -594,21 +611,31 @@ static int mpegts_write_header(AVFormatContext *s)
>  }
>  
>  /* send SDT, PAT and PMT tables regulary */
> -static void retransmit_si_info(AVFormatContext *s)
> +static void retransmit_si_info(AVFormatContext *s, int64_t pts)	// MpegTSWriteStream *ts_st)
>  {
>      MpegTSWrite *ts = s->priv_data;
>      int i;
> +    int64_t temp_pts;
>  
> -    if (++ts->sdt_packet_count == ts->sdt_packet_period) {
> -        ts->sdt_packet_count = 0;
> +    temp_pts = 90*SDT_RETRANS_TIME;
> +    if (ts->sdt_pts==-1 || (abs(ts->sdt_pts-pts)>temp_pts)) {
>          mpegts_write_sdt(s);

> +//	av_log( s, AV_LOG_INFO, "SDT %llx\r\n", pts); // ts_st->payload_pts);
> +        ts->sdt_pts = pts;

tabs are not allowed in git


[...]
> @@ -636,15 +663,14 @@ static uint8_t* write_pcr_bits(uint8_t *buf, int64_t pcr)
>  static void mpegts_insert_null_packet(AVFormatContext *s)
>  {
>      uint8_t *q;
> -    uint8_t buf[TS_PACKET_SIZE];
>  
> -    q = buf;
> +    q = ts_buf;
>      *q++ = 0x47;
>      *q++ = 0x00 | 0x1f;
>      *q++ = 0xff;
>      *q++ = 0x10;

this breaks multithreadad applications

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110518/6c78a82b/attachment.asc>


More information about the ffmpeg-devel mailing list