[FFmpeg-devel] [PATCH] avformat/hls:use EXT-X-START instead of live_start_index if it's in playlist

Steven Liu lingjiujianke at gmail.com
Mon Jun 27 05:23:11 EEST 2022


Li Kai <wolfleekay at gmail.com> 于2022年6月25日周六 22:15写道:
>
> OK, I add the option description in doc/demuxers.texi.
>
> About invalid EXT-X-START value, it's not played on Safari.
> So I make it error to handle.
>
> You opinion, it's better way. The latest patch fix it.
>
>
>
@@ -741,6 +744,7 @@ static int parse_playlist(HLSContext *c, const char *url,
     struct segment **prev_segments = NULL;
     int prev_n_segments = 0;
     int64_t prev_start_seq_no = -1;
+    const char *p;

     if (is_http && !in && c->http_persistent && c->playlist_pb) {
         in = c->playlist_pb;
@@ -889,6 +893,20 @@ static int parse_playlist(HLSContext *c, const char *url,
                 cur_init_section->key = NULL;
             }

+        } else if (av_strstart(line, "#EXT-X-START:", &ptr)) {
Can the "const char *p;" move to here? And maybe make a clarify name
will better i think, e.g. const char *time_offset_value?

+            ret = ensure_playlist(c, &pls, url);
+            if (ret < 0) {
+                goto fail;
+            }
+            if (av_strstart(ptr, "TIME-OFFSET=", &p)) {
+                float offset = strtof(p, NULL);
+                pls->start_time_offset = offset * AV_TIME_BASE;
+                pls->time_offset_flag = 1;
+            } else {
+                av_log(c->ctx, AV_LOG_WARNING, "#EXT-X-START value is"
+                                                "invalid, it will be ignored");
+                continue;
+            }
         } else if (av_strstart(line, "#EXT-X-ENDLIST", &ptr)) {
             if (pls)
                 pls->finished = 1;



Thanks
Steven


More information about the ffmpeg-devel mailing list