[FFmpeg-cvslog] avformat/dashenc: setting @availabilityStartTime when the first frame is ready

Vishwanath Dixit git at videolan.org
Tue Apr 17 12:48:52 EEST 2018


ffmpeg | branch: master | Vishwanath Dixit <vdixit at akamai.com> | Wed Apr 11 12:49:36 2018 +0530| [3e75057a1d702ccc71f858095f64f6cd96f6461e] | committer: Karthick Jeyapal

avformat/dashenc: setting @availabilityStartTime when the first frame is ready

@availabilityStartTime specifies the anchor for the computation of the earliest
availability time (in UTC) for any Segment in the Media Presentation.

As per this requirement, the @AvailabilityStartTime should be set to the
wallclock time at which the first frame of the first segment begins encoding.
But, it was getting set only when the first segment was completely ready. Making
the required correction in this patch. This correction is mainly needed to reduce
the latency in live streaming use cases.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3e75057a1d702ccc71f858095f64f6cd96f6461e
---

 libavformat/dashenc.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index bf06a7be3b..5d5310d004 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -743,9 +743,6 @@ static int write_manifest(AVFormatContext *s, int final)
             update_period = 500;
         avio_printf(out, "\tminimumUpdatePeriod=\"PT%"PRId64"S\"\n", update_period);
         avio_printf(out, "\tsuggestedPresentationDelay=\"PT%"PRId64"S\"\n", c->last_duration / AV_TIME_BASE);
-        if (!c->availability_start_time[0] && s->nb_streams > 0 && c->streams[0].nb_segments > 0) {
-            format_date_now(c->availability_start_time, sizeof(c->availability_start_time));
-        }
         if (c->availability_start_time[0])
             avio_printf(out, "\tavailabilityStartTime=\"%s\"\n", c->availability_start_time);
         format_date_now(now_str, sizeof(now_str));
@@ -1292,6 +1289,10 @@ static int dash_write_packet(AVFormatContext *s, AVPacket *pkt)
     if (os->first_pts == AV_NOPTS_VALUE)
         os->first_pts = pkt->pts;
 
+    if (!c->availability_start_time[0])
+        format_date_now(c->availability_start_time,
+                        sizeof(c->availability_start_time));
+
     if (c->use_template && !c->use_timeline) {
         elapsed_duration = pkt->pts - os->first_pts;
         seg_end_duration = (int64_t) os->segment_index * c->seg_duration;



More information about the ffmpeg-cvslog mailing list