[vlc-devel] [PATCH] Fix Metacube header handling with multiple header blocks.

Tristan Matthews tmatth at videolan.org
Sun Mar 29 22:50:38 CEST 2015


Hi,

On Sun, Mar 29, 2015 at 3:30 PM, Steinar H. Gunderson
<steinar+vlc at gunderson.no> wrote:
> Some muxes, e.g. MP4, will send multiple header blocks. These are
> merged by the HTTP server to a single header which is sent out to
> the beginning of each client. However, they are _also_ sent out
> directly on the wire to any client that connected before the first
> block. In this case, we would send two separate Metacube header
> blocks, which would have Cubemap (correctly) discard the first and
> set only the second as header.
>
> This would make us send only part of the MP4 header when sending
> through Cubemap, if Cubemap connected before the first non-header
> block, which would in turn confuse Chrome on Android (although not
> Chrome on e.g. Linux). As Cubemap is pretty aggressive about
> reconnecting (trying every 200 ms), this could easily happen in practice.
> ---
>  modules/access_output/http.c |   21 ++++++++++++++++-----
>  1 file changed, 16 insertions(+), 5 deletions(-)
>
> diff --git a/modules/access_output/http.c b/modules/access_output/http.c
> index f85eb42..65c58fb 100644
> --- a/modules/access_output/http.c
> +++ b/modules/access_output/http.c
> @@ -380,13 +380,17 @@ static ssize_t Write( sout_access_out_t *p_access, block_t *p_buffer )
>                  hdr.csum = hton16( metacube2_compute_crc( &hdr ) );
>
>                  int i_header_size = p_sys->i_header_size + sizeof( hdr );
> -                uint8_t *p_hdr_block = xmalloc( i_header_size );
> -                memcpy( p_hdr_block, &hdr, sizeof( hdr ) );
> -                memcpy( p_hdr_block + sizeof( hdr ), p_sys->p_header, p_sys->i_header_size );
> +                block_t *p_hdr_block = block_Alloc( i_header_size );

You should check that block_Alloc didn't fail here.

Best,
Tristan



More information about the vlc-devel mailing list