History

libavformat/dashenc : Prevent writing manifest files multiple times

joepadmiraal committed 7 years ago

Commit 951561b1 parent 4d2f6211 file · +18 −1Browse files

Unified · Split

libavformat/dashenc.c+18−1
@@ -145,6 +145,8 @@ typedef struct DASHContext { · 144 unmodified lines
145 int ignore_io_errors;145 int ignore_io_errors;
146 int lhls;146 int lhls;
147 int master_publish_rate;147 int master_publish_rate;
148 int nr_of_streams_to_flush;
149 int nr_of_streams_flushed;
148} DASHContext;150} DASHContext;
149 151
150static struct codec_string {152static struct codec_string {
@@ -1089,6 +1091,7 @@ static int dash_init(AVFormatContext *s) · 938 unmodified lines
1089 char *ptr;1091 char *ptr;
1090 char basename[1024];1092 char basename[1024];
1091 1093
1094 c->nr_of_streams_to_flush = 0;
1092 if (c->single_file_name)1095 if (c->single_file_name)
1093 c->single_file = 1;1096 c->single_file = 1;
1094 if (c->single_file)1097 if (c->single_file)
@@ -1302,12 +1305,18 @@ static int dash_init(AVFormatContext *s) · 207 unmodified lines
1302 os->max_pts = AV_NOPTS_VALUE;1305 os->max_pts = AV_NOPTS_VALUE;
1303 os->last_dts = AV_NOPTS_VALUE;1306 os->last_dts = AV_NOPTS_VALUE;
1304 os->segment_index = 1;1307 os->segment_index = 1;
1308
1309 if (s->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)
1310 c->nr_of_streams_to_flush++;
1305 }1311 }
1306 1312
1307 if (!c->has_video && c->seg_duration <= 0) {1313 if (!c->has_video && c->seg_duration <= 0) {
1308 av_log(s, AV_LOG_WARNING, "no video stream and no seg duration set\n");1314 av_log(s, AV_LOG_WARNING, "no video stream and no seg duration set\n");
1309 return AVERROR(EINVAL);1315 return AVERROR(EINVAL);
1310 }1316 }
1317
1318 c->nr_of_streams_flushed = 0;
1319
1311 return 0;1320 return 0;
1312}1321}
1313 1322
@@ -1616,8 +1625,16 @@ static int dash_flush(AVFormatContext *s, int final, int stream) · 302 unmodified lines
1616 }1625 }
1617 }1626 }
1618 }1627 }
1619 if (ret >= 0)1628 if (ret >= 0) {
1629 if (c->has_video) {
1630 c->nr_of_streams_flushed++;
1631 if (c->nr_of_streams_flushed != c->nr_of_streams_to_flush)
1632 return ret;
1633
1634 c->nr_of_streams_flushed = 0;
1635 }
1620 ret = write_manifest(s, final);1636 ret = write_manifest(s, final);
1637 }
1621 return ret;1638 return ret;
1622}1639}
1623 1640

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t