[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 10:27:46 CET 2018
Le 08/01/2018 à 09:37, Steve Lhomme a écrit :
> Le 08/01/2018 à 09:34, Francois Cartegnie a écrit :
>> 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.
>>
>
> I don't understand. In any case you use fmtcopy which has either the
> original pointers or copied ones. In the end either the pointers are
> copied or they can't be kept at all. It doesn't matter how they are set
> in fmtcopy.
freeing a copy of pointer frees the pointer itself.
--
Francois Cartegnie
VideoLAN - VLC Developer
More information about the vlc-devel
mailing list