Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
muxer - flush the queued packets with wrong pts on seek
  • Loading branch information
perexg committed Dec 18, 2015
1 parent 016b0b3 commit 0c1406e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/HTSPDemuxer.cpp
Expand Up @@ -165,13 +165,18 @@ bool CHTSPDemuxer::Seek

htsmsg_destroy(m);

m_seeking = true;

/* Wait for time */
if (!m_seekCond.Wait(m_conn.Mutex(), m_seekTime, tvh->GetSettings().iResponseTimeout))
{
tvherror("failed to get subscriptionSeek response");
m_seeking = false;
Flush(); /* try to resync */
return false;
}

m_seeking = false;
if (m_seekTime == INVALID_SEEKTIME)
return false;

Expand Down Expand Up @@ -585,6 +590,7 @@ void CHTSPDemuxer::ParseSubscriptionSkip ( htsmsg_t *m )
} else {
m_seekTime = s64;
}
Flush(); /* flush old packets (with wrong pts) */
m_seekCond.Broadcast();
}

Expand Down
1 change: 1 addition & 0 deletions src/Tvheadend.h
Expand Up @@ -253,6 +253,7 @@ class CHTSPDemuxer
std::map<int,int> m_streamStat;
int64_t m_seekTime;
PLATFORM::CCondition<volatile int64_t> m_seekCond;
bool m_seeking;
SSourceInfo m_sourceInfo;
SQuality m_signalInfo;
STimeshiftStatus m_timeshiftStatus;
Expand Down

3 comments on commit 0c1406e

@Jalle19
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks sane. Can you make a PR?

@ksooo
Copy link

@ksooo ksooo commented on 0c1406e Dec 18, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I don't get this. Newly introduced m_seeking is set here and there but the value is never checked or used somewhere else?

@Jalle19
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I completely overlooked that. @perexg so only the calls to Flush() are needed?

Please sign in to comment.