From 47464a077f7cc3a5d4ed18ae456cfe2a3b1ee992 Mon Sep 17 00:00:00 2001 From: emveepee Date: Mon, 1 Feb 2021 17:06:23 -0500 Subject: [PATCH] Timeshift fixes Force radix 10 on stroll, fix missing count on a duration check, cast stream times to int 64 --- pvr.nextpvr/addon.xml.in | 2 +- pvr.nextpvr/changelog.txt | 5 +++++ src/BackendRequest.cpp | 3 ++- src/buffers/ClientTimeshift.cpp | 4 ++-- src/buffers/RollingFile.cpp | 8 ++++---- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/pvr.nextpvr/addon.xml.in b/pvr.nextpvr/addon.xml.in index 5cf6fe42..55dea1f0 100644 --- a/pvr.nextpvr/addon.xml.in +++ b/pvr.nextpvr/addon.xml.in @@ -1,7 +1,7 @@ @ADDON_DEPENDS@ diff --git a/pvr.nextpvr/changelog.txt b/pvr.nextpvr/changelog.txt index 39f99e1a..c3b02b14 100644 --- a/pvr.nextpvr/changelog.txt +++ b/pvr.nextpvr/changelog.txt @@ -1,3 +1,8 @@ +v8.2.1 +- Fixed a missing count on another duration call +- force radix 10 on strtoll +- Add 64 bit cast to time_t for + v8.2.0 - Flag timers with invalid channel life - Automatically renew sid lifetime on playback close diff --git a/src/BackendRequest.cpp b/src/BackendRequest.cpp index 7168ca42..3f704573 100644 --- a/src/BackendRequest.cpp +++ b/src/BackendRequest.cpp @@ -49,7 +49,8 @@ namespace NextPVR RenewSID(); } } - kodi::Log(ADDON_LOG_DEBUG, "DoRequest return %s %d %d %d", resource.c_str(), resultCode, response.length(), std::chrono::duration_cast(std::chrono::steady_clock::now() - start)); + int milliseconds = static_cast(std::chrono::duration_cast(std::chrono::steady_clock::now() - start).count()); + kodi::Log(ADDON_LOG_DEBUG, "DoRequest return %s %d %d %d", resource.c_str(), resultCode, response.length(), milliseconds); return resultCode; } diff --git a/src/buffers/ClientTimeshift.cpp b/src/buffers/ClientTimeshift.cpp index 42aeb75e..ed87a5be 100644 --- a/src/buffers/ClientTimeshift.cpp +++ b/src/buffers/ClientTimeshift.cpp @@ -187,10 +187,10 @@ bool ClientTimeShift::GetStreamInfo() tinyxml2::XMLNode* filesNode = doc.FirstChildElement("map"); if (filesNode != nullptr) { - stream_duration = strtoll(filesNode->FirstChildElement("stream_duration")->GetText(), nullptr, 0); + stream_duration = strtoll(filesNode->FirstChildElement("stream_duration")->GetText(), nullptr, 10); if (stream_duration != 0) { - m_stream_length = strtoll(filesNode->FirstChildElement("stream_length")->GetText(), nullptr, 0); + m_stream_length = strtoll(filesNode->FirstChildElement("stream_length")->GetText(), nullptr, 10); m_stream_duration = stream_duration / 1000; if (m_stream_duration > m_settings.m_timeshiftBufferSeconds) { diff --git a/src/buffers/RollingFile.cpp b/src/buffers/RollingFile.cpp index 9fb7bd40..1bd1d2ad 100644 --- a/src/buffers/RollingFile.cpp +++ b/src/buffers/RollingFile.cpp @@ -141,8 +141,8 @@ bool RollingFile::GetStreamInfo() tinyxml2::XMLNode* filesNode = doc.FirstChildElement("Files"); if (filesNode != nullptr) { - stream_length = strtoll(filesNode->FirstChildElement("Length")->GetText(), nullptr, 0); - duration = strtoll(filesNode->FirstChildElement("Duration")->GetText(), nullptr, 0); + stream_length = strtoll(filesNode->FirstChildElement("Length")->GetText(), nullptr, 10); + duration = strtoll(filesNode->FirstChildElement("Duration")->GetText(), nullptr, 10); XMLUtils::GetBoolean(filesNode, "Complete", m_complete); kodi::Log(ADDON_LOG_DEBUG, "channel.stream.info %lld %lld %d %d", stream_length, duration, m_complete, m_bytesPerSecond.load()); if (m_complete == true) @@ -281,8 +281,8 @@ PVR_ERROR RollingFile::GetStreamTimes(kodi::addon::PVRStreamTimes& stimes) return RecordingBuffer::GetStreamTimes(stimes); stimes.SetStartTime(m_streamStart); stimes.SetPTSStart(0); - stimes.SetPTSBegin((m_rollingStartSeconds - m_streamStart) * STREAM_TIME_BASE); - stimes.SetPTSEnd((time(nullptr) - m_streamStart) * STREAM_TIME_BASE); + stimes.SetPTSBegin(static_cast(m_rollingStartSeconds - m_streamStart) * STREAM_TIME_BASE); + stimes.SetPTSEnd(static_cast(time(nullptr) - m_streamStart) * STREAM_TIME_BASE); return PVR_ERROR_NO_ERROR; }