diff --git a/lib/dtsc.cpp b/lib/dtsc.cpp index 5941c573..a5673844 100644 --- a/lib/dtsc.cpp +++ b/lib/dtsc.cpp @@ -1151,6 +1151,7 @@ namespace DTSC{ stream.addField("maxkeepaway", RAX_16UINT); stream.addField("bufferwindow", RAX_64UINT); stream.addField("bootmsoffset", RAX_64INT); + stream.addField("utcoffset", RAX_64INT); stream.addField("minfragduration", RAX_64UINT); stream.setRCount(1); stream.setReady(); @@ -1183,6 +1184,7 @@ namespace DTSC{ streamMaxKeepAwayField = stream.getFieldData("maxkeepaway"); streamBufferWindowField = stream.getFieldData("bufferwindow"); streamBootMsOffsetField = stream.getFieldData("bootmsoffset"); + streamUTCOffsetField = stream.getFieldData("utcoffset"); streamMinimumFragmentDurationField = stream.getFieldData("minfragduration"); trackValidField = trackList.getFieldData("valid"); @@ -2088,6 +2090,12 @@ namespace DTSC{ stream.setInt(streamBootMsOffsetField, bootMsOffset); } int64_t Meta::getBootMsOffset() const{return stream.getInt(streamBootMsOffsetField);} + + void Meta::setUTCOffset(int64_t UTCOffset){ + stream.setInt(streamUTCOffsetField, UTCOffset); + } + int64_t Meta::getUTCOffset() const{return stream.getInt(streamUTCOffsetField);} + /*LTS-START*/ void Meta::setMinimumFragmentDuration(uint64_t fragmentDuration){ stream.setInt(streamMinimumFragmentDurationField, fragmentDuration); diff --git a/lib/dtsc.h b/lib/dtsc.h index 1ce21747..19e6756c 100644 --- a/lib/dtsc.h +++ b/lib/dtsc.h @@ -419,6 +419,9 @@ namespace DTSC{ void setBootMsOffset(int64_t bootMsOffset); int64_t getBootMsOffset() const; + void setUTCOffset(int64_t UTCOffset); + int64_t getUTCOffset() const; + std::set getValidTracks(bool skipEmpty = false) const; std::set getMySourceTracks(size_t pid) const; @@ -497,6 +500,7 @@ namespace DTSC{ Util::RelAccXFieldData streamMaxKeepAwayField; Util::RelAccXFieldData streamBufferWindowField; Util::RelAccXFieldData streamBootMsOffsetField; + Util::RelAccXFieldData streamUTCOffsetField; Util::RelAccXFieldData streamMinimumFragmentDurationField; Util::RelAccXFieldData trackValidField; diff --git a/src/input/input_hls.cpp b/src/input/input_hls.cpp index 82090678..8e87623f 100644 --- a/src/input/input_hls.cpp +++ b/src/input/input_hls.cpp @@ -746,6 +746,7 @@ namespace Mist{ } tsStream.clear(); // set bootMsOffset in order to display the program time correctly in the player + meta.setUTCOffset(streamOffset + (Util::unixMS() - Util::bootMS())); meta.setBootMsOffset(streamOffset); return true; } @@ -837,8 +838,8 @@ namespace Mist{ } // set bootMsOffset in order to display the program time correctly in the player + meta.setUTCOffset(streamOffset + (Util::unixMS() - Util::bootMS())); meta.setBootMsOffset(streamOffset); - if (streamIsLive || isLiveDVR){return true;} // Set local vars used for parsing existing headers diff --git a/src/output/output_http_internal.cpp b/src/output/output_http_internal.cpp index 43c8b214..6db95cba 100644 --- a/src/output/output_http_internal.cpp +++ b/src/output/output_http_internal.cpp @@ -505,7 +505,15 @@ namespace Mist{ } json_resp["type"] = (M.getLive() ? "live" : "vod"); if (M.getLive()){ - json_resp["unixoffset"] = M.getBootMsOffset() + (Util::unixMS() - Util::bootMS()); + if (M.getUTCOffset()){ + json_resp["unixoffset"] = M.getUTCOffset(); + }else{ + json_resp["unixoffset"] = M.getBootMsOffset() + (Util::unixMS() - Util::bootMS()); + } + }else{ + if (M.getUTCOffset()){ + json_resp["unixoffset"] = M.getUTCOffset(); + } } // show ALL the meta datas!