[FFmpeg-cvslog] avformat/webmdashenc: Use av_strstart instead of strncmp

Andreas Rheinhardt git at videolan.org
Sun Feb 28 18:43:55 EET 2021


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Wed Feb 24 07:46:22 2021 +0100| [546e3964ddd3762b22860cc581e23ba6d1443a95] | committer: Andreas Rheinhardt

avformat/webmdashenc: Use av_strstart instead of strncmp

It makes the intent clearer and avoids calculating the length
separately.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

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

 libavformat/webmdashenc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/webmdashenc.c b/libavformat/webmdashenc.c
index 04f8cbe39d..332d0466e1 100644
--- a/libavformat/webmdashenc.c
+++ b/libavformat/webmdashenc.c
@@ -133,7 +133,7 @@ static int subsegment_alignment(AVFormatContext *s, const AdaptationSet *as)
     for (i = 1; i < as->nb_streams; i++) {
         AVDictionaryEntry *ts = av_dict_get(s->streams[as->streams[i]]->metadata,
                                             CUE_TIMESTAMPS, NULL, 0);
-        if (!ts || strncmp(gold->value, ts->value, strlen(gold->value))) return 0;
+        if (!ts || !av_strstart(ts->value, gold->value, NULL)) return 0;
     }
     return 1;
 }
@@ -152,7 +152,7 @@ static int bitstream_switching(AVFormatContext *s, const AdaptationSet *as)
                                                    TRACK_NUMBER, NULL, 0);
         AVCodecParameters *par = st->codecpar;
         if (!track_num ||
-            strncmp(gold_track_num->value, track_num->value, strlen(gold_track_num->value)) ||
+            !av_strstart(track_num->value, gold_track_num->value, NULL) ||
             gold_par->codec_id != par->codec_id ||
             gold_par->extradata_size != par->extradata_size ||
             memcmp(gold_par->extradata, par->extradata, par->extradata_size)) {



More information about the ffmpeg-cvslog mailing list