Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix timestamp reporting #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions streamer.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ void cLiveStreamer::Action(void)
{
m_refTime = pkt_data.reftime;
m_refDTS = pkt_data.dts;
m_curDTS = (pkt_data.dts - m_refDTS) / DVD_TIME_BASE + m_refTime;
m_curDTS = (int64_t)m_refTime * DVD_TIME_BASE;
if (m_protocolVersion >= 11)
{
sendStreamTimes();
Expand All @@ -243,7 +243,7 @@ void cLiveStreamer::Action(void)
sendRefTime(pkt_data);
pkt_data.reftime = 0;
}
m_curDTS = (pkt_data.dts - m_refDTS) / DVD_TIME_BASE + m_refTime;
m_curDTS = (pkt_data.dts - m_refDTS) + (int64_t)m_refTime * DVD_TIME_BASE;
if (bufferStatsTimer.TimedOut())
{
sendStreamTimes();
Expand Down Expand Up @@ -846,7 +846,6 @@ void cLiveStreamer::sendStreamTimes()

time_t starttime = m_refTime;
int64_t refDTS = m_refDTS;
time_t current = m_curDTS;

{
#if VDRVERSNUM >= 20301
Expand All @@ -861,22 +860,22 @@ void cLiveStreamer::sendStreamTimes()
#endif
if (!schedule)
return;
const cEvent *event = schedule->GetEventAround(current);
const cEvent *event = schedule->GetEventAround(m_curDTS / DVD_TIME_BASE);
if (event)
{
starttime = event->StartTime();
refDTS = (starttime - m_refTime) * DVD_TIME_BASE + m_refDTS;
refDTS = int64_t(difftime(starttime, m_refTime) * DVD_TIME_BASE) + m_refDTS;
}
}
uint32_t start, end;
bool timeshift;
int64_t mintime = current;
int64_t maxtime = current;
int64_t mintime = m_curDTS;
int64_t maxtime = m_curDTS;
m_Demuxer.BufferStatus(timeshift, start, end);
if (timeshift)
{
mintime = (start - starttime) * DVD_TIME_BASE + refDTS;
maxtime = (end - starttime) * DVD_TIME_BASE + refDTS;
mintime = int64_t(difftime((time_t)start, starttime) * DVD_TIME_BASE) + refDTS;
maxtime = int64_t(difftime((time_t)end, starttime) * DVD_TIME_BASE) + refDTS;
}

resp.add_U8(timeshift);
Expand Down