mirror of https://git.ffmpeg.org/ffmpeg.git
avformat/hlsenc: fix ticket 6231
check if the hls_flags is byterange_mode and check if should close fd Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
This commit is contained in:
parent
7cebc5a9cc
commit
d3ce067e76
|
@ -1362,6 +1362,7 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||||
end_pts, AV_TIME_BASE_Q) >= 0) {
|
end_pts, AV_TIME_BASE_Q) >= 0) {
|
||||||
int64_t new_start_pos;
|
int64_t new_start_pos;
|
||||||
char *old_filename = av_strdup(hls->avf->filename);
|
char *old_filename = av_strdup(hls->avf->filename);
|
||||||
|
int byterange_mode = (hls->flags & HLS_SINGLE_FILE) || (hls->max_seg_size > 0);
|
||||||
|
|
||||||
if (!old_filename) {
|
if (!old_filename) {
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
@ -1372,9 +1373,11 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||||
new_start_pos = avio_tell(hls->avf->pb);
|
new_start_pos = avio_tell(hls->avf->pb);
|
||||||
hls->size = new_start_pos - hls->start_pos;
|
hls->size = new_start_pos - hls->start_pos;
|
||||||
|
|
||||||
ff_format_io_close(s, &oc->pb);
|
if (!byterange_mode) {
|
||||||
if (hls->vtt_avf) {
|
ff_format_io_close(s, &oc->pb);
|
||||||
ff_format_io_close(s, &hls->vtt_avf->pb);
|
if (hls->vtt_avf) {
|
||||||
|
ff_format_io_close(s, &hls->vtt_avf->pb);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ((hls->flags & HLS_TEMP_FILE) && oc->filename[0]) {
|
if ((hls->flags & HLS_TEMP_FILE) && oc->filename[0]) {
|
||||||
if (!(hls->flags & HLS_SINGLE_FILE) || (hls->max_seg_size <= 0))
|
if (!(hls->flags & HLS_SINGLE_FILE) || (hls->max_seg_size <= 0))
|
||||||
|
|
Loading…
Reference in New Issue