[vlc-devel] [PATCH] Add support for AMT multicast tunneling over non-multicast enabled networks

Ilkka Ollakka ileoo at videolan.org
Tue Apr 30 12:02:31 CEST 2019


On Mon, Apr 29, 2019 at 12:42:25PM -0400, Wayne Brassem wrote:
> Updated submission.
> 
> Notes on this version based on previous code reviews:

Hi,


> +
> +/*****************************************************************************
> + * BlockUDP: Responsible for returning the multicast payload
> + * BlockUDP: Several sections based upon the BlockUDP code in udp.c
> + * 
> + * Default MTU based on number of MPEG-2 transports carried in a 1500 byte Ethernet frame
> + * however the code is able to receive jumbo Ethernet frames and then adjusts the MTU
> + *****************************************************************************/
> +static block_t *BlockUDP(stream_t *p_access, bool *restrict eof)
> +{
> +    access_sys_t *sys = p_access->p_sys;
> +    ssize_t len, shift = 0, tunnel = IP_HDR_LEN + UDP_HDR_LEN + AMT_HDR_LEN;
> +
> +    /* Allocate a packet buffer based on anticipated MTU */
> +    block_t *pkt = block_Alloc(sys->mtu);

I didn't checkin full details of the code, but I don't think you actually need
pkt and memcpy to it?

Why not just do "recvpkt->i_buffer -= shift" and "recvpkt->p_buffer += shift"
and return that? It is not that readable code, but saves one malloc and one
memcpy per call.

> +    {
> +        memcpy( pkt->p_buffer, &recvpkt[shift], len );
> +    }
> +
> +    pkt->i_buffer = len;
> +
> +    free( recvpkt );
> +    return pkt;

-- 
Ilkka Ollakka


More information about the vlc-devel mailing list