Unified · Split
| @@ -145,6 +145,8 @@ typedef struct DASHContext { · 144 unmodified lines | ||
| 145 | 145 | int ignore_io_errors; |
| 146 | 146 | int lhls; |
| 147 | 147 | int master_publish_rate; |
| 148 | + int nr_of_streams_to_flush; | |
| 149 | + int nr_of_streams_flushed; | |
| 148 | 150 | } DASHContext; |
| 149 | 151 | |
| 150 | 152 | static struct codec_string { |
| @@ -1089,6 +1091,7 @@ static int dash_init(AVFormatContext *s) · 938 unmodified lines | ||
| 1089 | 1091 | char *ptr; |
| 1090 | 1092 | char basename[1024]; |
| 1091 | 1093 | |
| 1094 | + c->nr_of_streams_to_flush = 0; | |
| 1092 | 1095 | if (c->single_file_name) |
| 1093 | 1096 | c->single_file = 1; |
| 1094 | 1097 | if (c->single_file) |
| @@ -1302,12 +1305,18 @@ static int dash_init(AVFormatContext *s) · 207 unmodified lines | ||
| 1302 | 1305 | os->max_pts = AV_NOPTS_VALUE; |
| 1303 | 1306 | os->last_dts = AV_NOPTS_VALUE; |
| 1304 | 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 | 1313 | if (!c->has_video && c->seg_duration <= 0) { |
| 1308 | 1314 | av_log(s, AV_LOG_WARNING, "no video stream and no seg duration set\n"); |
| 1309 | 1315 | return AVERROR(EINVAL); |
| 1310 | 1316 | } |
| 1317 | + | |
| 1318 | + c->nr_of_streams_flushed = 0; | |
| 1319 | + | |
| 1311 | 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 | 1636 | ret = write_manifest(s, final); |
| 1637 | + } | |
| 1621 | 1638 | return ret; |
| 1622 | 1639 | } |
| 1623 | 1640 | |