summaryrefslogtreecommitdiff
path: root/server/livestreamer.c
diff options
context:
space:
mode:
Diffstat (limited to 'server/livestreamer.c')
-rw-r--r--server/livestreamer.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/server/livestreamer.c b/server/livestreamer.c
index ff4f708..7ec7d9e 100644
--- a/server/livestreamer.c
+++ b/server/livestreamer.c
@@ -297,7 +297,7 @@ void cStreamdevPatFilter::Process(u_short Pid, u_char Tid, const u_char *Data, i
if (written != TS_SIZE)
siBuffer.ReportOverflow(TS_SIZE - written);
if (pmtPid != prevPmtPid) {
- m_Streamer->SetPids(pmtPid);
+ m_Streamer->SetPid(pmtPid, true);
Add(pmtPid, 0x02);
pmtVersion = -1;
}
@@ -442,21 +442,28 @@ bool cStreamdevLiveStreamer::SetPids(int Pid, const int *Pids1, const int *Pids2
return true;
}
+void cStreamdevLiveStreamer::SetPriority(int Priority)
+{
+ m_Priority = Priority;
+ StartReceiver();
+}
+
void cStreamdevLiveStreamer::StartReceiver(void)
{
- DELETENULL(m_Receiver);
- if (m_NumPids > 0) {
+ if (m_Device != NULL && m_NumPids > 0 && IsRunning()) {
Dprintf("Creating Receiver to respect changed pids\n");
+ cReceiver *current = m_Receiver;
#if VDRVERSNUM < 10500
m_Receiver = new cStreamdevLiveReceiver(this, m_Channel->Ca(), m_Priority, m_Pids);
#else
m_Receiver = new cStreamdevLiveReceiver(this, m_Channel->GetChannelID(), m_Priority, m_Pids);
#endif
- if (IsRunning() && m_Device != NULL) {
- Dprintf("Attaching new receiver\n");
- Attach();
- }
+ cThreadLock ThreadLock(m_Device);
+ Attach();
+ delete current;
}
+ else
+ DELETENULL(m_Receiver);
}
bool cStreamdevLiveStreamer::SetChannel(const cChannel *Channel, eStreamType StreamType, const int* Apid, const int *Dpid)