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
145145 int ignore_io_errors;
146146 int lhls;
147147 int master_publish_rate;
148+ int nr_of_streams_to_flush;
149+ int nr_of_streams_flushed;
148150 } DASHContext;
149151
150152 static struct codec_string {
@@ -1089,6 +1091,7 @@ static int dash_init(AVFormatContext *s) · 938 unmodified lines
10891091 char *ptr;
10901092 char basename[1024];
10911093
1094+ c->nr_of_streams_to_flush = 0;
10921095 if (c->single_file_name)
10931096 c->single_file = 1;
10941097 if (c->single_file)
@@ -1302,12 +1305,18 @@ static int dash_init(AVFormatContext *s) · 207 unmodified lines
13021305 os->max_pts = AV_NOPTS_VALUE;
13031306 os->last_dts = AV_NOPTS_VALUE;
13041307 os->segment_index = 1;
1308+
1309+ if (s->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)
1310+ c->nr_of_streams_to_flush++;
13051311 }
13061312
13071313 if (!c->has_video && c->seg_duration <= 0) {
13081314 av_log(s, AV_LOG_WARNING, "no video stream and no seg duration set\n");
13091315 return AVERROR(EINVAL);
13101316 }
1317+
1318+ c->nr_of_streams_flushed = 0;
1319+
13111320 return 0;
13121321 }
13131322
@@ -1616,8 +1625,16 @@ static int dash_flush(AVFormatContext *s, int final, int stream) · 302 unmodified lines
16161625 }
16171626 }
16181627 }
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+ }
16201636 ret = write_manifest(s, final);
1637+ }
16211638 return ret;
16221639 }
16231640

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