From 4cc684e530bef5fcee8d4cb31dd610410dfdc9e0 Mon Sep 17 00:00:00 2001 From: lordjaxom Date: Fri, 11 Feb 2005 17:02:22 +0000 Subject: [PATCH] - blargh --- server/livestreamer.c | 2 +- server/streamer.c | 6 +++++- server/streamer.h | 5 ++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/server/livestreamer.c b/server/livestreamer.c index aef55ef..35986f3 100644 --- a/server/livestreamer.c +++ b/server/livestreamer.c @@ -91,7 +91,7 @@ bool cStreamdevLiveStreamer::SetPid(int Pid, bool On) if (m_NumPids > 0) { Dprintf("Creating Receiver to respect changed pids\n"); m_Receiver = new cStreamdevLiveReceiver(this, m_Channel->Ca(), m_Priority, m_Pids); - if (m_Device != NULL) { + if (IsRunning() && m_Device != NULL) { Dprintf("Attaching new receiver\n"); Attach(); } diff --git a/server/streamer.c b/server/streamer.c index acd4790..a6afea8 100644 --- a/server/streamer.c +++ b/server/streamer.c @@ -1,5 +1,5 @@ /* - * $Id: streamer.c,v 1.7 2005/02/11 16:44:15 lordjaxom Exp $ + * $Id: streamer.c,v 1.8 2005/02/11 17:02:22 lordjaxom Exp $ */ #include @@ -57,6 +57,7 @@ void cStreamdevWriter::Action(void) cStreamdevStreamer::cStreamdevStreamer(const char *Name): cThread(Name), m_Active(false), + m_Running(false), m_Writer(NULL), m_RingBuffer(new cRingBufferLinear(STREAMERBUFSIZE, TS_SIZE * 2, true, "streamdev-streamer")), @@ -79,6 +80,7 @@ void cStreamdevStreamer::Start(cTBSocket *Socket) { Dprintf("start streamer\n"); m_Writer = new cStreamdevWriter(Socket, this); + m_Running = true; Attach(); } @@ -98,7 +100,9 @@ void cStreamdevStreamer::Stop(void) m_Active = false; Cancel(3); } + Detach(); DELETENULL(m_Writer); + m_Running = false; } void cStreamdevStreamer::Action(void) diff --git a/server/streamer.h b/server/streamer.h index 295b8ca..ed6c5cd 100644 --- a/server/streamer.h +++ b/server/streamer.h @@ -1,5 +1,5 @@ /* - * $Id: streamer.h,v 1.5 2005/02/11 16:44:15 lordjaxom Exp $ + * $Id: streamer.h,v 1.6 2005/02/11 17:02:22 lordjaxom Exp $ */ #ifndef VDR_STREAMDEV_STREAMER_H @@ -36,6 +36,7 @@ public: class cStreamdevStreamer: public cThread { private: bool m_Active; + bool m_Running; cStreamdevWriter *m_Writer; cRingBufferLinear *m_RingBuffer; cRingBufferLinear *m_SendBuffer; @@ -43,6 +44,8 @@ private: protected: virtual void Action(void); + bool IsRunning(void) const { return m_Running; } + public: cStreamdevStreamer(const char *Name); virtual ~cStreamdevStreamer();