From efd83d91a9bd9a485bcda6799f5f681c203a7449 Mon Sep 17 00:00:00 2001
From: Siyuan Huang <saber.huang@samsung.com>
Date: Tue, 30 Jun 2020 13:44:01 +0800
Subject: [PATCH] libavformat/dashenc.c:kill latency when ldash on v2

disable write tmp file to let it using chunk downloading at last segment

Signed-off-by: Siyuan Huang <saber.huang@samsung.com>
---
 libavformat/dashenc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index dc3306a56a..ef6e3d29c6 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -2232,6 +2232,8 @@ static int dash_write_packet(AVFormatContext *s, AVPacket *pkt)
         AVDictionary *opts = NULL;
         const char *proto = avio_find_protocol_name(s->url);
         int use_rename = proto && !strcmp(proto, "file");
+        if (c->ldash)
+            use_rename = 0;
         if (os->segment_type == SEGMENT_TYPE_MP4)
             write_styp(os->ctx->pb);
         os->filename[0] = os->full_path[0] = os->temp_path[0] = '\0';
-- 
2.17.1

