[FFmpeg-cvslog] avformat/dashdec: Remove redundant checks

Andreas Rheinhardt git at videolan.org
Mon Sep 21 06:00:23 EEST 2020


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Sat Sep 19 10:27:34 2020 +0200| [622efc5c83fd77dff52242a9a503cd8dcee8e36f] | committer: Andreas Rheinhardt

avformat/dashdec: Remove redundant checks

This commit removes two always-true checks as well as a dead default
case of a switch. The check when parsing manifests is always true,
because we now jump to the cleaning code in case the format of the
representation is unknown. The default case of the switch is dead,
because the type of the representation is already checked at the
beginning of parse_manifest_representation(). The check when reading
the header is dead, because we error out if an error happened before.

Reviewed-by: Steven Liu <lq at chinaffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=622efc5c83fd77dff52242a9a503cd8dcee8e36f
---

 libavformat/dashdec.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index e1554d077b..d75ff92a7b 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -1049,7 +1049,6 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
             goto free;
         }
 
-        if (rep) {
             if (rep->fragment_duration > 0 && !rep->fragment_timescale)
                 rep->fragment_timescale = 1;
             rep->bandwidth = rep_bandwidth_val ? atoi(rep_bandwidth_val) : 0;
@@ -1071,13 +1070,9 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
                 case AVMEDIA_TYPE_SUBTITLE:
                     ret = av_dynarray_add_nofree(&c->subtitles, &c->n_subtitles, rep);
                     break;
-                default:
-                    av_log(s, AV_LOG_WARNING, "Unsupported the stream type %d\n", type);
-                    break;
             }
             if (ret < 0)
                 goto free;
-        }
     }
 
 end:
@@ -2042,6 +2037,7 @@ static int dash_read_header(AVFormatContext *s)
 {
     DASHContext *c = s->priv_data;
     struct representation *rep;
+    AVProgram *program;
     int ret = 0;
     int stream_index = 0;
     int i;
@@ -2123,8 +2119,6 @@ static int dash_read_header(AVFormatContext *s)
     }
 
     /* Create a program */
-    if (!ret) {
-        AVProgram *program;
         program = av_new_program(s, 0);
         if (!program) {
             ret = AVERROR(ENOMEM);
@@ -2164,7 +2158,6 @@ static int dash_read_header(AVFormatContext *s)
                 av_freep(&rep->lang);
             }
         }
-    }
 
     return 0;
 fail:



More information about the ffmpeg-cvslog mailing list