[vlc-devel] [PATCH 2/4] demux:adaptive: no need to init a local es_format_t to release it right after

Francois Cartegnie fcvlcdev at free.fr
Mon Jan 8 09:34:51 CET 2018


Le 08/01/2018 à 08:37, Steve Lhomme a écrit :
> ---
>  modules/demux/adaptive/plumbing/FakeESOut.cpp | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/modules/demux/adaptive/plumbing/FakeESOut.cpp b/modules/demux/adaptive/plumbing/FakeESOut.cpp
> index 3f3bb1f749..ec618e83db 100644
> --- a/modules/demux/adaptive/plumbing/FakeESOut.cpp
> +++ b/modules/demux/adaptive/plumbing/FakeESOut.cpp
> @@ -87,9 +87,7 @@ void FakeESOut::setExtraInfoProvider( ExtraFMTInfoInterface *extra )
>  
>  FakeESOutID * FakeESOut::createNewID( const es_format_t *p_fmt )
>  {
> -    es_format_t fmtcopy;
> -    es_format_Init( &fmtcopy, p_fmt->i_cat, p_fmt->i_codec );
> -    es_format_Copy( &fmtcopy, p_fmt );
> +    es_format_t fmtcopy = *p_fmt;
>      fmtcopy.i_group = 0; /* Always ignore group for adaptive */
>      fmtcopy.i_id = -1;
>  
> @@ -102,8 +100,6 @@ FakeESOutID * FakeESOut::createNewID( const es_format_t *p_fmt )
>      if(likely(es_id))
>          fakeesidlist.push_back( es_id );
>  
> -    es_format_Clean( &fmtcopy );
> -
>      return es_id;
>  }
>  
> 

The copy has a reason 2 lines below. Demuxer can't know the es creation
has been hijacked and some fields altered.

-- 
Francois Cartegnie
VideoLAN - VLC Developer


More information about the vlc-devel mailing list