Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

tvheadend add-on: removed the socket abort, since it blocks the main …

…thread. thanks @FernetMenta for the pointer. don't wait for a packet in a loop in demux Read(). + fix commit
  • Loading branch information...
commit a2131e127e72d84f78997650414fe9c7fd0f0fe4 1 parent dc6a520
@opdenkamp authored
View
9 xbmc/pvrclients/tvheadend/HTSPConnection.cpp
@@ -132,15 +132,6 @@ void CHTSPConnection::Close()
}
}
-void CHTSPConnection::Abort(void)
-{
- CLockObject lock(m_mutex);
- m_bIsConnected = false;
-
- if(m_socket && m_socket->IsOpen())
- m_socket->Shutdown();
-}
-
htsmsg_t* CHTSPConnection::ReadMessage(int iInitialTimeout /* = 10000 */, int iDatapacketTimeout /* = 10000 */)
{
void* buf;
View
1  xbmc/pvrclients/tvheadend/HTSPConnection.h
@@ -42,7 +42,6 @@ class CHTSPConnection
bool Connect(void);
void Close();
- void Abort();
bool IsConnected(void);
int GetProtocol() const { return m_iProtocol; }
const char *GetServerName() const { return m_strServerName.c_str(); }
View
78 xbmc/pvrclients/tvheadend/HTSPDemux.cpp
@@ -28,7 +28,6 @@ using namespace ADDON;
CHTSPDemux::CHTSPDemux() :
m_bIsRadio(false),
- m_bAbort(false),
m_subs(0),
m_channel(0),
m_tag(0),
@@ -65,7 +64,6 @@ bool CHTSPDemux::Open(const PVR_CHANNEL &channelinfo)
void CHTSPDemux::Close()
{
- m_bAbort = true;
m_session->Close();
}
@@ -92,59 +90,55 @@ bool CHTSPDemux::GetStreamProperties(PVR_STREAM_PROPERTIES* props)
void CHTSPDemux::Abort()
{
m_Streams.iStreamCount = 0;
- m_bAbort = true;
- m_session->Abort();
}
DemuxPacket* CHTSPDemux::Read()
{
- htsmsg_t * msg;
- const char* method;
- while((msg = m_session->ReadMessage(1000)) && !m_bAbort)
- {
- method = htsmsg_get_str(msg, "method");
- if(method == NULL)
- break;
+ htsmsg_t *msg = m_session->ReadMessage(1000, 1000);
+ if (!msg)
+ return PVR->AllocateDemuxPacket(0);
- uint32_t subs;
- if(htsmsg_get_u32(msg, "subscriptionId", &subs) || subs != m_subs)
- {
- htsmsg_destroy(msg);
- continue;
- }
+ const char *method = htsmsg_get_str(msg, "method");
+ if (!method)
+ return PVR->AllocateDemuxPacket(0);
- if (strcmp("subscriptionStart", method) == 0)
- {
- ParseSubscriptionStart(msg);
- DemuxPacket* pkt = PVR->AllocateDemuxPacket(0);
- pkt->iStreamId = DMX_SPECIALID_STREAMCHANGE;
- htsmsg_destroy(msg);
- return pkt;
- }
- else if(strcmp("subscriptionStop", method) == 0)
- ParseSubscriptionStop (msg);
- else if(strcmp("subscriptionStatus", method) == 0)
- ParseSubscriptionStatus(msg);
- else if(strcmp("queueStatus" , method) == 0)
- ParseQueueStatus(msg);
- else if(strcmp("signalStatus" , method) == 0)
- ParseSignalStatus(msg);
- else if(strcmp("muxpkt" , method) == 0)
- {
- DemuxPacket *pkt = ParseMuxPacket(msg);
- htsmsg_destroy(msg);
- return pkt;
- }
+ uint32_t subs;
+ if(htsmsg_get_u32(msg, "subscriptionId", &subs) || subs != m_subs)
+ {
+ // switching channels
+ htsmsg_destroy(msg);
+ return PVR->AllocateDemuxPacket(0);
+ }
- break;
+ if (strcmp("subscriptionStart", method) == 0)
+ {
+ ParseSubscriptionStart(msg);
+ DemuxPacket* pkt = PVR->AllocateDemuxPacket(0);
+ pkt->iStreamId = DMX_SPECIALID_STREAMCHANGE;
+ htsmsg_destroy(msg);
+ return pkt;
+ }
+ else if(strcmp("subscriptionStop", method) == 0)
+ ParseSubscriptionStop(msg);
+ else if(strcmp("subscriptionStatus", method) == 0)
+ ParseSubscriptionStatus(msg);
+ else if(strcmp("queueStatus" , method) == 0)
+ ParseQueueStatus(msg);
+ else if(strcmp("signalStatus" , method) == 0)
+ ParseSignalStatus(msg);
+ else if(strcmp("muxpkt" , method) == 0)
+ {
+ DemuxPacket *pkt = ParseMuxPacket(msg);
+ htsmsg_destroy(msg);
+ return pkt;
}
if(msg)
{
htsmsg_destroy(msg);
- DemuxPacket* pkt = PVR->AllocateDemuxPacket(0);
- return pkt;
+ return PVR->AllocateDemuxPacket(0);
}
+
return NULL;
}
View
1  xbmc/pvrclients/tvheadend/HTSPDemux.h
@@ -54,7 +54,6 @@ class CHTSPDemux
CHTSPConnection *m_session;
bool m_bIsRadio;
- bool m_bAbort;
bool m_bResetNeeded;
unsigned m_subs;
int m_channel;
View
2  xbmc/pvrclients/tvheadend/client.cpp
@@ -481,7 +481,7 @@ PVR_ERROR SignalStatus(PVR_SIGNAL_STATUS &signalStatus)
if (HTSPDemuxer && HTSPDemuxer->GetSignalStatus(signalStatus))
return PVR_ERROR_NO_ERROR;
- return PVR_ERROR_SERVER_ERROR;
+ return PVR_ERROR_NOT_POSSIBLE;
}
void DemuxAbort(void)
Please sign in to comment.
Something went wrong with that request. Please try again.