[vlc-commits] demux: es: fix swab usage
Francois Cartegnie
git at videolan.org
Mon Dec 24 10:24:15 CET 2018
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Dec 24 10:21:55 2018 +0100| [bf4e354d6420cd09ac144d7ee2e5a6ee70c7bd33] | committer: Francois Cartegnie
demux: es: fix swab usage
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bf4e354d6420cd09ac144d7ee2e5a6ee70c7bd33
---
modules/demux/mpeg/es.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/modules/demux/mpeg/es.c b/modules/demux/mpeg/es.c
index 731049bf14..54daf63f64 100644
--- a/modules/demux/mpeg/es.c
+++ b/modules/demux/mpeg/es.c
@@ -507,10 +507,22 @@ 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 );
+ block_t *old = p_block_in;
+ p_block_in = block_Alloc( p_block_in->i_buffer );
+ if( p_block_in )
+ {
+ block_CopyProperties( p_block_in, old );
+ swab( old->p_buffer, p_block_in->p_buffer, old->i_buffer );
+ }
+ block_Release( old );
}
- p_block_in->i_pts = p_block_in->i_dts = p_sys->b_start || p_sys->b_initial_sync_failed ? VLC_TICK_0 : VLC_TICK_INVALID;
+ if( p_block_in )
+ {
+ p_block_in->i_pts =
+ p_block_in->i_dts = (p_sys->b_start || p_sys->b_initial_sync_failed) ?
+ VLC_TICK_0 : VLC_TICK_INVALID;
+ }
}
p_sys->b_initial_sync_failed = p_sys->b_start; /* Only try to resync once */
More information about the vlc-commits
mailing list