diff mbox series

[FFmpeg-devel] avformat/demux: Remove dead stores

Message ID 20240524002523.2984524-1-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel] avformat/demux: Remove dead stores | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer May 24, 2024, 12:25 a.m. UTC
Fixes: CID1473512 Unused value
Fixes: CID1529228 Unused value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/demux.c | 5 -----
 1 file changed, 5 deletions(-)

Comments

Andreas Rheinhardt May 24, 2024, 6:21 a.m. UTC | #1
Michael Niedermayer:
> Fixes: CID1473512 Unused value
> Fixes: CID1529228 Unused value
> 
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/demux.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/libavformat/demux.c b/libavformat/demux.c
> index ecefe7e0a74..d0a5a39d052 100644
> --- a/libavformat/demux.c
> +++ b/libavformat/demux.c
> @@ -2998,9 +2998,6 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
>  
>      av_opt_set_int(ic, "skip_clear", 0, AV_OPT_SEARCH_CHILDREN);
>  
> -    if (ret >= 0 && ic->nb_streams)
> -        /* We could not have all the codec parameters before EOF. */
> -        ret = -1;
>      for (unsigned i = 0; i < ic->nb_streams; i++) {
>          AVStream *const st  = ic->streams[i];
>          FFStream *const sti = ffstream(st);
> @@ -3022,8 +3019,6 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
>                     "Could not find codec parameters for stream %d (%s): %s\n"
>                     "Consider increasing the value for the 'analyzeduration' (%"PRId64") and 'probesize' (%"PRId64") options\n",
>                     i, buf, errmsg, ic->max_analyze_duration, ic->probesize);
> -        } else {
> -            ret = 0;
>          }
>      }
>  

IIRC these stores are only dead since
ac5a568e6dff8162a2e982f3571b925f1b207e2c; and it doesn't seem as if this
was intended.

- Andreas
Michael Niedermayer May 24, 2024, 8:52 p.m. UTC | #2
On Fri, May 24, 2024 at 08:21:05AM +0200, Andreas Rheinhardt wrote:
> Michael Niedermayer:
> > Fixes: CID1473512 Unused value
> > Fixes: CID1529228 Unused value
> > 
> > Sponsored-by: Sovereign Tech Fund
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavformat/demux.c | 5 -----
> >  1 file changed, 5 deletions(-)
> > 
> > diff --git a/libavformat/demux.c b/libavformat/demux.c
> > index ecefe7e0a74..d0a5a39d052 100644
> > --- a/libavformat/demux.c
> > +++ b/libavformat/demux.c
> > @@ -2998,9 +2998,6 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
> >  
> >      av_opt_set_int(ic, "skip_clear", 0, AV_OPT_SEARCH_CHILDREN);
> >  
> > -    if (ret >= 0 && ic->nb_streams)
> > -        /* We could not have all the codec parameters before EOF. */
> > -        ret = -1;
> >      for (unsigned i = 0; i < ic->nb_streams; i++) {
> >          AVStream *const st  = ic->streams[i];
> >          FFStream *const sti = ffstream(st);
> > @@ -3022,8 +3019,6 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
> >                     "Could not find codec parameters for stream %d (%s): %s\n"
> >                     "Consider increasing the value for the 'analyzeduration' (%"PRId64") and 'probesize' (%"PRId64") options\n",
> >                     i, buf, errmsg, ic->max_analyze_duration, ic->probesize);
> > -        } else {
> > -            ret = 0;
> >          }
> >      }
> >  
> 
> IIRC these stores are only dead since
> ac5a568e6dff8162a2e982f3571b925f1b207e2c; and it doesn't seem as if this
> was intended.

replaced by:

@@ -3027,9 +3027,11 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
         }
     }

-    ret = compute_chapters_end(ic);
-    if (ret < 0)
+    err = compute_chapters_end(ic);
+    if (err < 0) {
+        ret = err;
         goto find_stream_info_err;
+    }

     /* update the stream parameters from the internal codec contexts */
     for (unsigned i = 0; i < ic->nb_streams; i++) {

[...]
Michael Niedermayer May 27, 2024, 11:38 p.m. UTC | #3
On Fri, May 24, 2024 at 10:52:02PM +0200, Michael Niedermayer wrote:
> On Fri, May 24, 2024 at 08:21:05AM +0200, Andreas Rheinhardt wrote:
> > Michael Niedermayer:
> > > Fixes: CID1473512 Unused value
> > > Fixes: CID1529228 Unused value
> > > 
> > > Sponsored-by: Sovereign Tech Fund
> > > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > > ---
> > >  libavformat/demux.c | 5 -----
> > >  1 file changed, 5 deletions(-)
> > > 
> > > diff --git a/libavformat/demux.c b/libavformat/demux.c
> > > index ecefe7e0a74..d0a5a39d052 100644
> > > --- a/libavformat/demux.c
> > > +++ b/libavformat/demux.c
> > > @@ -2998,9 +2998,6 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
> > >  
> > >      av_opt_set_int(ic, "skip_clear", 0, AV_OPT_SEARCH_CHILDREN);
> > >  
> > > -    if (ret >= 0 && ic->nb_streams)
> > > -        /* We could not have all the codec parameters before EOF. */
> > > -        ret = -1;
> > >      for (unsigned i = 0; i < ic->nb_streams; i++) {
> > >          AVStream *const st  = ic->streams[i];
> > >          FFStream *const sti = ffstream(st);
> > > @@ -3022,8 +3019,6 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
> > >                     "Could not find codec parameters for stream %d (%s): %s\n"
> > >                     "Consider increasing the value for the 'analyzeduration' (%"PRId64") and 'probesize' (%"PRId64") options\n",
> > >                     i, buf, errmsg, ic->max_analyze_duration, ic->probesize);
> > > -        } else {
> > > -            ret = 0;
> > >          }
> > >      }
> > >  
> > 
> > IIRC these stores are only dead since
> > ac5a568e6dff8162a2e982f3571b925f1b207e2c; and it doesn't seem as if this
> > was intended.
> 
> replaced by:
> 
> @@ -3027,9 +3027,11 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
>          }
>      }
> 
> -    ret = compute_chapters_end(ic);
> -    if (ret < 0)
> +    err = compute_chapters_end(ic);
> +    if (err < 0) {
> +        ret = err;
>          goto find_stream_info_err;
> +    }
> 
>      /* update the stream parameters from the internal codec contexts */
>      for (unsigned i = 0; i < ic->nb_streams; i++) {
> 

will apply this modified variant

thx

[...]
diff mbox series

Patch

diff --git a/libavformat/demux.c b/libavformat/demux.c
index ecefe7e0a74..d0a5a39d052 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -2998,9 +2998,6 @@  int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
 
     av_opt_set_int(ic, "skip_clear", 0, AV_OPT_SEARCH_CHILDREN);
 
-    if (ret >= 0 && ic->nb_streams)
-        /* We could not have all the codec parameters before EOF. */
-        ret = -1;
     for (unsigned i = 0; i < ic->nb_streams; i++) {
         AVStream *const st  = ic->streams[i];
         FFStream *const sti = ffstream(st);
@@ -3022,8 +3019,6 @@  int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
                    "Could not find codec parameters for stream %d (%s): %s\n"
                    "Consider increasing the value for the 'analyzeduration' (%"PRId64") and 'probesize' (%"PRId64") options\n",
                    i, buf, errmsg, ic->max_analyze_duration, ic->probesize);
-        } else {
-            ret = 0;
         }
     }