ret = AVERROR(ENOMEM);
goto fail;
}
- sub_path_size = strlen(dirname) + strlen(segment->sub_filename) + 1;
- sub_path = av_malloc(sub_path_size);
- if (!sub_path) {
- ret = AVERROR(ENOMEM);
- goto fail;
- }
av_strlcpy(path, dirname, path_size);
av_strlcat(path, segment->filename, path_size);
path, strerror(errno));
}
- av_strlcpy(sub_path, dirname, sub_path_size);
- av_strlcat(sub_path, segment->sub_filename, sub_path_size);
- if (unlink(sub_path) < 0) {
- av_log(hls, AV_LOG_ERROR, "failed to delete old segment %s: %s\n",
- sub_path, strerror(errno));
+ if (segment->sub_filename[0] != '\0') {
+ sub_path_size = strlen(dirname) + strlen(segment->sub_filename) + 1;
+ sub_path = av_malloc(sub_path_size);
+ if (!sub_path) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+
+ av_strlcpy(sub_path, dirname, sub_path_size);
+ av_strlcat(sub_path, segment->sub_filename, sub_path_size);
+ if (unlink(sub_path) < 0) {
+ av_log(hls, AV_LOG_ERROR, "failed to delete old segment %s: %s\n",
+ sub_path, strerror(errno));
+ }
+ av_free(sub_path);
}
av_freep(&path);
- av_free(sub_path);
previous_segment = segment;
segment = previous_segment->next;
av_free(previous_segment);
if(hls->has_subtitle)
av_strlcpy(en->sub_filename, av_basename(hls->vtt_avf->filename), sizeof(en->sub_filename));
+ else
+ en->sub_filename[0] = '\0';
en->duration = duration;
en->pos = pos;
}
av_dict_free(&options);
- if (oc->oformat->priv_class && oc->priv_data)
+ /* We only require one PAT/PMT per segment. */
+ if (oc->oformat->priv_class && oc->priv_data) {
+ char period[21];
+
+ snprintf(period, sizeof(period), "%d", (INT_MAX / 2) - 1);
+
av_opt_set(oc->priv_data, "mpegts_flags", "resend_headers", 0);
+ av_opt_set(oc->priv_data, "sdt_period", period, 0);
+ av_opt_set(oc->priv_data, "pat_period", period, 0);
+ }
if (c->vtt_basename)
avformat_write_header(vtt_oc,NULL);