From d23578cea95310f501837f67e168d0e0061accf4 Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Sun, 14 Dec 2014 22:08:54 +0200 Subject: [PATCH] Fixed a race condition while updating pids. --- tuner.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tuner.c b/tuner.c index f9c5425..d89d53f 100644 --- a/tuner.c +++ b/tuner.c @@ -189,6 +189,8 @@ bool cSatipTuner::Connect(void) // Just retune if (streamIdM >= 0) { cString uri = cString::sprintf("%sstream=%d?%s", *connectionUri, streamIdM, *streamParamM); + //if (pidsM.Size()) + // uri = cString::sprintf("%s&pids=%s", *uri, *pidsM.ListPids()); debug1("%s Retuning [device %d]", __PRETTY_FUNCTION__, deviceIdM); if (rtspM.Play(*uri)) { keepAliveM.Set(timeoutM); @@ -384,6 +386,7 @@ bool cSatipTuner::SetPid(int pidP, int typeP, bool onP) bool cSatipTuner::UpdatePids(bool forceP) { debug16("%s (%d) tunerState=%s [device %d]", __PRETTY_FUNCTION__, forceP, TunerStateString(currentStateM), deviceIdM); + cMutexLock MutexLock(&mutexM); if (((forceP && pidsM.Size()) || (pidUpdateCacheM.TimedOut() && (addPidsM.Size() || delPidsM.Size()))) && !isempty(*streamAddrM) && (streamIdM > 0)) { cString uri = cString::sprintf("rtsp://%s/stream=%d", *streamAddrM, streamIdM);