Skip to content

Commit

Permalink
Merge pull request kodi-pvr#636 from ksooo/fix-stutter-on-wakeup-2
Browse files Browse the repository at this point in the history
[Omega] Fix TV channels stuttering after wake from suspend - take 2
  • Loading branch information
ksooo authored Nov 15, 2023
2 parents 842826f + cf1a904 commit 1b2152b
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pvr.hts/addon.xml.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon
id="pvr.hts"
version="21.1.1"
version="21.1.2"
name="Tvheadend HTSP Client"
provider-name="Adam Sutton, Sam Stenvall, Lars Op den Kamp, Kai Sommerfeld">
<requires>@ADDON_DEPENDS@</requires>
Expand Down
3 changes: 3 additions & 0 deletions pvr.hts/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v21.1.2
- Fix TV channels stuttering after wake from suspend - take 2

v21.1.1
- Fix TV channels stuttering after wake from suspend

Expand Down
15 changes: 11 additions & 4 deletions src/Tvheadend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1503,6 +1503,7 @@ bool CTvheadend::Connected(std::unique_lock<std::recursive_mutex>& lock)
else
htsmsg_add_u32(msg, "epg", 0);

m_stateRebuilt = false;
msg = m_conn->SendAndWait0(lock, "enableAsyncMetadata", msg);
if (!msg)
{
Expand Down Expand Up @@ -1876,15 +1877,21 @@ void CTvheadend::PushEpgEventUpdate(const Event& epg, EPG_EVENT_STATE state)

void CTvheadend::SyncInitCompleted()
{
if (!m_stateRebuilt)
{
m_stateRebuilt = true;

for (auto* dmx : m_dmx)
dmx->RebuildState();

m_vfs->RebuildState();
}

/* check state engine */
if (m_asyncState.GetState() != ASYNC_INIT)
return;

/* Rebuild state */
for (auto* dmx : m_dmx)
dmx->RebuildState();

m_vfs->RebuildState();
m_timeRecordings.RebuildState();
m_autoRecordings.RebuildState();

Expand Down
1 change: 1 addition & 0 deletions src/Tvheadend.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ class ATTR_DLL_LOCAL CTvheadend : public kodi::addon::CInstancePVRClient,
tvheadend::HTSPDemuxer* m_dmx_active;
bool m_streamchange;
tvheadend::HTSPVFS* m_vfs;
bool m_stateRebuilt{false};

HTSPMessageQueue m_queue;

Expand Down
2 changes: 2 additions & 0 deletions src/tvheadend/HTSPDemuxer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ void HTSPDemuxer::RebuildState()
Logger::Log(LogLevel::LEVEL_DEBUG, "demux re-starting stream");

std::unique_lock<std::recursive_mutex> lock(m_conn.Mutex());

m_subscription.SendUnsubscribe(lock);
m_subscription.SendSubscribe(lock, 0, 0, true);
m_subscription.SendSpeed(lock, 0, true);

Expand Down

0 comments on commit 1b2152b

Please sign in to comment.