From 458a21a62ad445ce79a55a8bb03b66c2ba280747 Mon Sep 17 00:00:00 2001 From: Frank Schmirler Date: Wed, 30 Oct 2013 21:18:56 +0100 Subject: [PATCH] Fixed channel switch issues with priority > 0 --- CONTRIBUTORS | 3 +++ HISTORY | 1 + client/device.c | 36 +++++++++++++++++------------------- client/socket.c | 7 +++---- 4 files changed, 24 insertions(+), 23 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 0d6c481..cba51c1 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -221,3 +221,6 @@ thomasjfox hivdr for adding the pos= parameter for replaying recordings from a certain position for suggesting to add the HTTP "Server" header + +hummel99 + for helping to debug channel switch issues with priority > 0 diff --git a/HISTORY b/HISTORY index e624361..a80137b 100644 --- a/HISTORY +++ b/HISTORY @@ -1,6 +1,7 @@ VDR Plugin 'streamdev' Revision History --------------------------------------- +- Fixed channel switch issues with priority > 0 - Removed noisy debug messages - Fixed HTTP menu destruction - API change of VDR 2.1.2 diff --git a/client/device.c b/client/device.c index 8a19c25..de0865f 100644 --- a/client/device.c +++ b/client/device.c @@ -90,14 +90,6 @@ bool cStreamdevDevice::IsTunedToTransponder(const cChannel *Channel) bool cStreamdevDevice::ProvidesChannel(const cChannel *Channel, int Priority, bool *NeedsDetachReceivers) const { -#if APIVERSNUM >= 10725 - bool prio = Priority == IDLEPRIORITY || Priority >= m_ClientSocket->Priority(); -#else - bool prio = Priority < 0 || Priority > m_ClientSocket->Priority(); -#endif - bool res = prio; - bool ndr = false; - if (m_Disabled || Channel == m_DenyChannel) return false; @@ -116,6 +108,20 @@ bool cStreamdevDevice::ProvidesChannel(const cChannel *Channel, int Priority, return false; } + int newPrio = Priority; + if (Priority == LIVEPRIORITY) { + if (m_ClientSocket->ServerVersion() >= 100 || StreamdevClientSetup.LivePriority >= 0) + newPrio = StreamdevClientSetup.LivePriority; + } + +#if APIVERSNUM >= 10725 + bool prio = Priority == IDLEPRIORITY || newPrio >= m_ClientSocket->Priority(); +#else + bool prio = Priority < 0 || newPrio > m_ClientSocket->Priority(); +#endif + bool res = prio; + bool ndr = false; + #if APIVERSNUM >= 10722 if (IsTunedToTransponder(Channel)) { #else @@ -129,18 +135,10 @@ bool cStreamdevDevice::ProvidesChannel(const cChannel *Channel, int Priority, ndr = true; } else if (prio) { - if (Priority == LIVEPRIORITY) { - if (m_ClientSocket->ServerVersion() >= 100) { - Priority = StreamdevClientSetup.LivePriority; - UpdatePriority(true); - } - else { - if (StreamdevClientSetup.LivePriority >= 0) - Priority = StreamdevClientSetup.LivePriority; - } - } + if (Priority == LIVEPRIORITY && m_ClientSocket->ServerVersion() >= 100) + UpdatePriority(true); - res = m_ClientSocket->ProvidesChannel(Channel, Priority); + res = m_ClientSocket->ProvidesChannel(Channel, newPrio); ndr = Receiving(); if (m_ClientSocket->ServerVersion() >= 100) diff --git a/client/socket.c b/client/socket.c index 23a1dca..eeece5d 100644 --- a/client/socket.c +++ b/client/socket.c @@ -40,10 +40,9 @@ cClientSocket::~cClientSocket() void cClientSocket::Reset(void) { - for (int it = 0; it < si_Count; ++it) { - if (m_DataSockets[it] != NULL) - DELETENULL(m_DataSockets[it]); - } + for (int it = 0; it < si_Count; ++it) + DELETENULL(m_DataSockets[it]); + m_Priority = -100; } cTBSocket *cClientSocket::DataSocket(eSocketId Id) const {