187a6d5fb0
- Bump PORTREVISION.
75 lines
2.2 KiB
Text
75 lines
2.2 KiB
Text
commit 81bde12cd5d36a5bb0f1bc5791977b58cc34f91e
|
|
Author: Alexander Pipelka <alexander.pipelka@gmail.com>
|
|
Date: Mon Dec 19 10:30:16 2011 +0100
|
|
|
|
wait until streaming stopped before switching to a new channel, thanks Juergen Lock
|
|
|
|
diff --git a/src/xvdr/xvdrclient.c b/src/xvdr/xvdrclient.c
|
|
index ced735e..8078454 100644
|
|
--- a/src/xvdr/xvdrclient.c
|
|
+++ b/src/xvdr/xvdrclient.c
|
|
@@ -72,6 +72,7 @@ static uint32_t recid2uid(const char* recid)
|
|
}
|
|
|
|
cMutex cXVDRClient::m_timerLock;
|
|
+cMutex cXVDRClient::m_switchLock;
|
|
|
|
cXVDRClient::cXVDRClient(int fd, unsigned int id, const char *ClientAdr)
|
|
{
|
|
@@ -183,6 +184,7 @@ void cXVDRClient::Action(void)
|
|
|
|
bool cXVDRClient::StartChannelStreaming(const cChannel *channel, uint32_t timeout)
|
|
{
|
|
+ cMutexLock lock(&m_switchLock);
|
|
m_Streamer = new cLiveStreamer(timeout);
|
|
m_Streamer->SetLanguage(m_LanguageIndex, m_LangStreamType);
|
|
|
|
@@ -192,12 +194,10 @@ bool cXVDRClient::StartChannelStreaming(const cChannel *channel, uint32_t timeou
|
|
|
|
void cXVDRClient::StopChannelStreaming()
|
|
{
|
|
+ cMutexLock lock(&m_switchLock);
|
|
+ delete m_Streamer;
|
|
+ m_Streamer = NULL;
|
|
m_isStreaming = false;
|
|
- if (m_Streamer)
|
|
- {
|
|
- delete m_Streamer;
|
|
- m_Streamer = NULL;
|
|
- }
|
|
}
|
|
|
|
void cXVDRClient::TimerChange(const cTimer *Timer, eTimerChange Change)
|
|
@@ -640,8 +640,7 @@ bool cXVDRClient::processChannelStream_Open() /* OPCODE 20 */
|
|
if(timeout == 0)
|
|
timeout = XVDRServerConfig.stream_timeout;
|
|
|
|
- if (m_isStreaming)
|
|
- StopChannelStreaming();
|
|
+ StopChannelStreaming();
|
|
|
|
Channels.Lock(false);
|
|
const cChannel *channel = NULL;
|
|
@@ -679,9 +678,7 @@ bool cXVDRClient::processChannelStream_Open() /* OPCODE 20 */
|
|
|
|
bool cXVDRClient::processChannelStream_Close() /* OPCODE 21 */
|
|
{
|
|
- if (m_isStreaming)
|
|
- StopChannelStreaming();
|
|
-
|
|
+ StopChannelStreaming();
|
|
return true;
|
|
}
|
|
|
|
diff --git a/src/xvdr/xvdrclient.h b/src/xvdr/xvdrclient.h
|
|
index e602c70..99bae64 100644
|
|
--- a/src/xvdr/xvdrclient.h
|
|
+++ b/src/xvdr/xvdrclient.h
|
|
@@ -64,6 +64,7 @@ private:
|
|
uint32_t m_protocolVersion;
|
|
cMutex m_msgLock;
|
|
static cMutex m_timerLock;
|
|
+ static cMutex m_switchLock;
|
|
int m_compressionLevel;
|
|
int m_LanguageIndex;
|
|
eStreamType m_LangStreamType;
|