[vlc-devel] [PATCH] demux/ogg: remove always false condition
Zhao Zhili
quinkblack at foxmail.com
Thu Oct 8 14:58:27 CEST 2020
On 10/8/20 8:50 PM, Steve Lhomme wrote:
> On 2020-10-08 14:43, Marvin Scholz wrote:
>>
>>
>> On 8 Oct 2020, at 14:39, Steve Lhomme wrote:
>>
>>> On 2020-10-08 14:33, Marvin Scholz wrote:
>>>> Stream re-use could never happen, as p_stream->p_es is always NULL
>>>> here, as implied by the earlier check:
>>>>
>>>> if ( p_stream->p_es == NULL && !p_stream->b_finished )
>>>
>>> I think the title and explanation is misleading. It's true that
>>> p_stream->p_es here is always false. So the whole if() block should
>>> go away, not just this line. But that's not what you are doing, you
>>> are actually discarding the (false) value, so that stream re-use works.
>>
>> I am not sure what you mean, which whole if block should go away? I
>> assume that the other checks that
>> ensure codec and cat matches is actually important, so I can not just
>> remove them?
>
> if (A && B && C && false)
> {}
>
> The code block will never be executed.
For non-functional change:
1. If a condition is always false, remove the code block.
1. If a condition is always true, remove the condition.
I think you are trying to do a functional change, but the title and
commit message hint the other way.
>
>
>>>
>>>> ---
>>>> modules/demux/ogg.c | 2 +-
>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/modules/demux/ogg.c b/modules/demux/ogg.c
>>>> index 90edf1cb7e0..cedaccca068 100644
>>>> --- a/modules/demux/ogg.c
>>>> +++ b/modules/demux/ogg.c
>>>> @@ -2141,7 +2141,7 @@ static void Ogg_CreateES( demux_t *p_demux,
>>>> bool stable_id )
>>>> if( p_old_stream &&
>>>> p_old_stream->fmt.i_cat == p_stream->fmt.i_cat &&
>>>> p_old_stream->fmt.i_codec ==
>>>> p_stream->fmt.i_codec &&
>>>> - p_old_stream->p_es != NULL && p_stream->p_es !=
>>>> NULL )
>>>> + p_old_stream->p_es != NULL )
>>>> {
>>>> msg_Dbg( p_demux, "will reuse old stream to avoid
>>>> glitch" );
>>>> -- 2.24.3 (Apple Git-128)
>>>>
>>>> _______________________________________________
>>>> vlc-devel mailing list
>>>> To unsubscribe or modify your subscription options:
>>>> https://mailman.videolan.org/listinfo/vlc-devel
>>>>
>>> _______________________________________________
>>> vlc-devel mailing list
>>> To unsubscribe or modify your subscription options:
>>> https://mailman.videolan.org/listinfo/vlc-devel
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
More information about the vlc-devel
mailing list