[FFmpeg-devel] [PATCH 4/6] RTMP output: add header compression for output

Kostya kostya.shishkov
Thu Dec 3 18:18:33 CET 2009


On Thu, Dec 03, 2009 at 07:06:59PM +0200, Sergiy wrote:
> 2009/12/3 Kostya <kostya.shishkov at gmail.com>:
> 
> > Just set for each 12-byte header ts_delta = timestamp and don't bother
> > about special case.
> 
> done

> ---
>  libavformat/rtmppkt.c |   25 ++++++++++++++++++++++++-
>  1 files changed, 24 insertions(+), 1 deletions(-)
> 
> diff --git a/libavformat/rtmppkt.c b/libavformat/rtmppkt.c
> index 2eab1c1..b4cbc50 100644
> --- a/libavformat/rtmppkt.c
> +++ b/libavformat/rtmppkt.c
> @@ -155,7 +155,19 @@ int ff_rtmp_packet_write(URLContext *h, RTMPPacket *pkt,
>      int off = 0;
>      pkt->ts_delta = pkt->timestamp - prev_pkt[pkt->channel_id].timestamp;
>  
> -    //TODO: header compression
> +    //if channel_id = 0, this is first presentation of prev_pkt, send full hdr.
> +    if (prev_pkt[pkt->channel_id].channel_id &&
> +        pkt->extra == prev_pkt[pkt->channel_id].extra) {
> +        if (pkt->type == prev_pkt[pkt->channel_id].type &&
> +            pkt->data_size == prev_pkt[pkt->channel_id].data_size) {
> +            mode = RTMP_PS_FOURBYTES;
> +            if (pkt->ts_delta == prev_pkt[pkt->channel_id].ts_delta ||

> +                pkt->ts_delta == prev_pkt[pkt->channel_id].timestamp)

This part of condition is not needed anymore, it will only trigger false
positives.




More information about the ffmpeg-devel mailing list