From cb3c12b97b07628d06d55cc4de07b782afec03a4 Mon Sep 17 00:00:00 2001 From: peak3d Date: Fri, 1 Sep 2017 10:25:56 +0200 Subject: [PATCH] Segmentloader: retry 10 secs if download fails --- src/common/AdaptiveStream.cpp | 11 ++++++++++- src/common/AdaptiveTree.cpp | 4 +++- src/main.cpp | 3 ++- src/parser/DASHTree.cpp | 5 ++--- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/common/AdaptiveStream.cpp b/src/common/AdaptiveStream.cpp index d143936db..fda497ee3 100755 --- a/src/common/AdaptiveStream.cpp +++ b/src/common/AdaptiveStream.cpp @@ -21,6 +21,7 @@ #include #include #include "../oscompat.h" +#include "../log.h" #include using namespace adaptive; @@ -141,7 +142,15 @@ void AdaptiveStream::worker() do { thread_data_->signal_dl_.wait(lckdl); - bool ret = download_segment(); + bool ret(download_segment()); + unsigned int retryCount(10); + + while (!ret && !stopped_ && retryCount-- && tree_.has_timeshift_buffer_) + { + std::this_thread::sleep_for(std::chrono::seconds(1)); + Log(LOGLEVEL_DEBUG, "AdaptiveStream: trying to reload segment ..."); + ret = download_segment(); + } //Signal finished download { diff --git a/src/common/AdaptiveTree.cpp b/src/common/AdaptiveTree.cpp index 99ca33b1b..bfb9124fb 100755 --- a/src/common/AdaptiveTree.cpp +++ b/src/common/AdaptiveTree.cpp @@ -138,6 +138,8 @@ namespace adaptive seg.range_begin_ += fragmentDuration; seg.range_end_ ++; + Log(LOGLEVEL_DEBUG, "AdaptiveTree: insert live segment: pts: %llu range_end: %llu", seg.startPTS_, seg.range_end_); + for (std::vector::iterator b(adpm->repesentations_.begin()), e(adpm->repesentations_.end()); b != e; ++b) (*b)->segments_.insert(seg); } @@ -214,7 +216,7 @@ namespace adaptive } } } - else if (manifestUpdateParam == "etag") + else if (manifestUpdateParam == "full") { update_parameter_ = manifestUpdateParam; } diff --git a/src/main.cpp b/src/main.cpp index 287adacb0..a93a1094e 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -263,8 +263,9 @@ bool KodiAdaptiveStream::download(const char* url, const std::map