[vlc-devel] [PATCH] demux: es: Replace swab(3) with own implementation
Steve Lhomme
robux4 at ycbcr.xyz
Mon Feb 19 08:24:06 CET 2018
Le 18/02/2018 à 23:41, CapacitorSet a écrit :
> This is a fix for https://trac.videolan.org/vlc/ticket/19673, where swab(3) was being used incorrectly as an in-place operation. It replaces
> the usage of swab(3) with a custom implementation.
> ---
> modules/demux/mpeg/es.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/modules/demux/mpeg/es.c b/modules/demux/mpeg/es.c
> index 5d646ac2c4..4b579a7f28 100644
> --- a/modules/demux/mpeg/es.c
> +++ b/modules/demux/mpeg/es.c
> @@ -498,8 +498,13 @@ static bool Parse( demux_t *p_demux, block_t **pp_output )
> {
> if( p_sys->codec.b_use_word && !p_sys->b_big_endian && p_block_in->i_buffer > 0 )
> {
> - /* Convert to big endian */
> - swab( p_block_in->p_buffer, p_block_in->p_buffer, p_block_in->i_buffer );
> + /* Convert to big endian using a handmade version of swab(3) */
> + for( size_t i = 1; i < p_block_in->i_buffer; i++ )
i += 2 ?
> + {
> + uint8_t p_tmp = p_block_in->p_buffer[i];
> + p_block_in->p_buffer[i] = p_block_in->p_buffer[i - 1];
> + p_block_in->p_buffer[i - 1] = p_tmp;
> + }
> }
>
> p_block_in->i_pts = p_block_in->i_dts = p_sys->b_start || p_sys->b_initial_sync_failed ? VLC_TS_0 : VLC_TS_INVALID;
More information about the vlc-devel
mailing list