[vlc-devel] [PATCH] demux: avformat: fix use NULL as string
Zhao Zhili
quinkblack at foxmail.com
Tue Jan 30 03:35:34 CET 2018
On 2018年01月30日 09:56, Zhao Zhili wrote:
> long_name can be NULL if enable-small
> ---
> modules/demux/avformat/demux.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
> index 6932462..9887a0b 100644
> --- a/modules/demux/avformat/demux.c
> +++ b/modules/demux/avformat/demux.c
> @@ -396,7 +396,7 @@ int avformat_OpenDemux( vlc_object_t *p_this )
> es_fmt.i_original_fourcc = VLC_FOURCC('L','A','T','M');
> es_fmt.b_packetized = false;
> }
> - else if(cp->codec_id == AV_CODEC_ID_AAC &&
> + else if(cp->codec_id == AV_CODEC_ID_AAC && p_sys->fmt->long_name &&
> strstr(p_sys->fmt->long_name, "raw ADTS AAC"))
The patch just fix the NULL pointer issue as is. Since long_name can be
NULL,
we need to fix the original problem in another way.
> {
> es_fmt.i_original_fourcc = VLC_FOURCC('A','D','T','S');
> @@ -659,7 +659,7 @@ int avformat_OpenDemux( vlc_object_t *p_this )
>
> msg_Dbg( p_demux, "AVFormat(%s %s) supported stream", AVPROVIDER(LIBAVFORMAT), LIBAVFORMAT_IDENT );
> msg_Dbg( p_demux, " - format = %s (%s)",
> - p_sys->fmt->name, p_sys->fmt->long_name );
> + p_sys->fmt->name, p_sys->fmt->long_name ? p_sys->fmt->long_name : "null" );
> msg_Dbg( p_demux, " - start time = %"PRId64, i_start_time );
> msg_Dbg( p_demux, " - duration = %"PRId64,
> ( p_sys->ic->duration != (int64_t)AV_NOPTS_VALUE ) ?
More information about the vlc-devel
mailing list