From d7dfa0aad6dc94da5227ba7df9b30c021a04be71 Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Sat, 2 Mar 2013 19:58:37 +0200 Subject: [PATCH] Fixed the channel editor and added extra locking into the CURL protocol. --- HISTORY | 1 + protocolcurl.c | 4 ++++ source.c | 5 ++--- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/HISTORY b/HISTORY index c6f3de4..6ba459f 100644 --- a/HISTORY +++ b/HISTORY @@ -198,3 +198,4 @@ VDR Plugin 'iptv' Revision History - Fixed bugs found in the CURL implementation (Thanks to Jeremy Hall). +- Fixed the channel editor. diff --git a/protocolcurl.c b/protocolcurl.c index e4f39dc..74343c3 100644 --- a/protocolcurl.c +++ b/protocolcurl.c @@ -424,6 +424,7 @@ int cIptvProtocolCurl::Read(unsigned char* bufferAddrP, unsigned int bufferLenP) switch (modeM) { case eModeRtsp: { + cMutexLock MutexLock(&mutexM); CURLcode res = CURLE_OK; iptv_curl_easy_setopt(handleM, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_RECEIVE); iptv_curl_easy_perform(handleM); @@ -439,6 +440,7 @@ int cIptvProtocolCurl::Read(unsigned char* bufferAddrP, unsigned int bufferLenP) int running_handles; do { + cMutexLock MutexLock(&mutexM); res = curl_multi_perform(multiM, &running_handles); } while (res == CURLM_CALL_MULTI_PERFORM); @@ -455,7 +457,9 @@ int cIptvProtocolCurl::Read(unsigned char* bufferAddrP, unsigned int bufferLenP) // Check if end of file if (running_handles == 0) { int msgcount; + mutexM.Lock(); CURLMsg *msg = curl_multi_info_read(multiM, &msgcount); + mutexM.Unlock(); if (msg && (msg->msg == CURLMSG_DONE)) { debug("cIptvProtocolCurl::%s(done): %s (%d)", __FUNCTION__, curl_easy_strerror(msg->data.result), msg->data.result); diff --git a/source.c b/source.c index a6f06fe..def10fd 100644 --- a/source.c +++ b/source.c @@ -164,9 +164,8 @@ void cIptvSourceParam::SetData(cChannel *channelP) void cIptvSourceParam::GetData(cChannel *channelP) { debug("cIptvSourceParam::%s(%s)", __FUNCTION__, channelP->Parameters()); - dataM.SetTransponderData(channelP->Source(), channelP->Frequency(), dataM.Srate(), itpM.ToString(Source()), true); - dataM.SetId(nidM, tidM, channelP->Sid(), ridM); - *channelP = dataM; + channelP->SetTransponderData(channelP->Source(), channelP->Frequency(), dataM.Srate(), itpM.ToString(Source()), true); + channelP->SetId(nidM, tidM, channelP->Sid(), ridM); } cOsdItem *cIptvSourceParam::GetOsdItem(void)