diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-05-25 18:52:57 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-05-28 11:18:53 +0200 |
commit | c1638bfae1e704f7fd9541892b61258b4f45f91a (patch) | |
tree | 1a03b21558690364ade888b41c698634b820f76c /libavformat | |
parent | c6e73ad2b783b81e043d1b04c69d8dbe93237068 (diff) | |
download | ffmpeg-c1638bfae1e704f7fd9541892b61258b4f45f91a.tar.gz |
avformat/hlsenc: Don't unnecessarily duplicate baseurl string
Up until now, the HLS muxer duplicated a string for every VariantStream,
although neither the original nor the copies are ever modified. So use
the original directly and stop copying.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/hlsenc.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 1bc3cb210b..77e49b44b1 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -177,7 +177,6 @@ typedef struct VariantStream { char *agroup; /* audio group name */ char *sgroup; /* subtitle group name */ char *ccgroup; /* closed caption group name */ - char *baseurl; char *varname; // variant name } VariantStream; @@ -1525,7 +1524,7 @@ static int hls_window(AVFormatContext *s, int last, VariantStream *vs) ret = ff_hls_write_file_entry(byterange_mode ? hls->m3u8_out : vs->out, en->discont, byterange_mode, en->duration, hls->flags & HLS_ROUND_DURATIONS, - en->size, en->pos, vs->baseurl, + en->size, en->pos, hls->baseurl, en->filename, prog_date_time_p, en->keyframe_size, en->keyframe_pos, hls->flags & HLS_I_FRAMES_ONLY); if (ret < 0) { av_log(s, AV_LOG_WARNING, "ff_hls_write_file_entry get error\n"); @@ -1547,7 +1546,7 @@ static int hls_window(AVFormatContext *s, int last, VariantStream *vs) for (en = vs->segments; en; en = en->next) { ret = ff_hls_write_file_entry(hls->sub_m3u8_out, 0, byterange_mode, en->duration, 0, en->size, en->pos, - vs->baseurl, en->sub_filename, NULL, 0, 0, 0); + hls->baseurl, en->sub_filename, NULL, 0, 0, 0); if (ret < 0) { av_log(s, AV_LOG_WARNING, "ff_hls_write_file_entry get error\n"); } @@ -2581,7 +2580,6 @@ static void hls_deinit(AVFormatContext *s) av_freep(&vs->sgroup); av_freep(&vs->language); av_freep(&vs->ccgroup); - av_freep(&vs->baseurl); av_freep(&vs->varname); } @@ -2956,12 +2954,6 @@ static int hls_init(AVFormatContext *s) *p = '.'; } - if (hls->baseurl) { - vs->baseurl = av_strdup(hls->baseurl); - if (!vs->baseurl) - return AVERROR(ENOMEM); - } - if ((ret = hls_mux_init(s, vs)) < 0) return ret; |