[vlc-devel] [PATCH 2/3] Enable VP8 RTP packetization

Jean-Baptiste Kempf jb at videolan.org
Sun Dec 8 12:51:11 CET 2013


On 08 Dec, Andrey Utkin wrote :
> +#define RTP_VP8_HEADER_SIZE 1
> +#define RTP_VP8_PAYLOAD_START (12 + RTP_VP8_HEADER_SIZE)

Extra line break please.

> +static int rtp_packetize_vp8( sout_stream_id_t *id, block_t *in )
> +{
> +    int     i_max   = rtp_mtu (id) - RTP_VP8_HEADER_SIZE;
> +    int     i_count = ( in->i_buffer + i_max - 1 ) / i_max;
> +
> +    uint8_t *p_data = in->p_buffer;
> +    int     i_data  = in->i_buffer;
> +    int     i;
> +
> +    for( i = 0; i < i_count; i++ )

Please, use C99

> +    {
> +        int i_payload = __MIN( i_max, i_data );

Is that guaranteed to be positive?

> +        block_t *out = block_Alloc( RTP_VP8_PAYLOAD_START + i_payload );

block_Alloc cannot fail?

> +        /* rtp common header */
> +        rtp_packetize_common( id, out, (i == i_count - 1),
> +                      (in->i_pts > VLC_TS_INVALID ? in->i_pts : in->i_dts) );
> +        memcpy( &out->p_buffer[RTP_VP8_PAYLOAD_START], p_data, i_payload );
> +
> +        out->i_buffer = RTP_VP8_PAYLOAD_START + i_payload;
> +        out->i_dts    = in->i_dts + i * in->i_length / i_count;
> +        out->i_length = in->i_length / i_count;
> +
> +        rtp_packetize_send( id, out );
> +
> +        p_data += i_payload;
> +        i_data -= i_payload;
> +    }
> +
> +    return VLC_SUCCESS;
> +}
> -- 
> 1.8.1.5
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel

-- 
With my kindest regards,

-- 
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device



More information about the vlc-devel mailing list