Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
demuxer - Seek - set m_seekTime variable to zero before Wait()
It's really a fatal error. If the predicate is not set to zero,
then _PredicateCallbackDefault() function (see platform/mutex.h)
gives true return value. It means that Wait() returns ASAP.

This also means that m_seekTime must not be set to a zero value
in the ParseSubscriptionSkip().
  • Loading branch information
perexg committed Jan 26, 2016
1 parent f265544 commit 457f9de
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/HTSPDemuxer.cpp
Expand Up @@ -165,6 +165,7 @@ bool CHTSPDemuxer::Seek
m_seeking = true;

/* Wait for time */
m_seekTime = 0;
if (!m_seekCond.Wait(m_conn.Mutex(), m_seekTime, Settings::GetInstance().GetResponseTimeout()))
{
Logger::Log(LogLevel::LEVEL_ERROR, "failed to get subscriptionSeek response");
Expand All @@ -178,7 +179,7 @@ bool CHTSPDemuxer::Seek
return false;

/* Store */
*startpts = TVH_TO_DVD_TIME(m_seekTime);
*startpts = TVH_TO_DVD_TIME(m_seekTime - 1);
Logger::Log(LogLevel::LEVEL_TRACE, "demux seek startpts = %lf", *startpts);

return true;
Expand Down Expand Up @@ -511,7 +512,7 @@ void CHTSPDemuxer::ParseSubscriptionSkip ( htsmsg_t *m )
if (htsmsg_get_s64(m, "time", &s64)) {
m_seekTime = INVALID_SEEKTIME;
} else {
m_seekTime = s64;
m_seekTime = s64 < 0 ? 1 : s64 + 1; /* it must not be zero! */
}
Flush(); /* flush old packets (with wrong pts) */
m_seekCond.Broadcast();
Expand Down

0 comments on commit 457f9de

Please sign in to comment.