mpegts: fix broken input handling for inputs with >1 active services..

This affects IPTV where there is only 1 input, if 2 services have the same PIDs
then both services were receiving each others packets and causing a mess!

I think later on I should really remove the transport list from the input and
have it on the mux? I think I did it this way to keep some things simpler, but
it's caused confusion here.

This should fix #1875.
This commit is contained in:
Adam Sutton 2014-01-02 21:29:14 +00:00
parent af15bb2f1c
commit 2d1bd1a254
2 changed files with 8 additions and 4 deletions

View file

@ -345,8 +345,8 @@ mpegts_input_recv_packets
assert(name != NULL);
// TODO: get the input name
tvhtrace("tsdemux", "%s - recv_packets tsb=%p, len=%d, pcr=%p, pcr_pid=%p",
name, tsb, (int)len, pcr, pcr_pid);
tvhtrace("tsdemux", "%s - recv pkts tsb=%p len=%d pcr=%p pcr_pid=%p mmi=%p",
name, tsb, (int)len, pcr, pcr_pid, mmi);
/* Not enough data */
if (len < 188) return len;
@ -364,7 +364,8 @@ mpegts_input_recv_packets
service_t *s;
int pid = ((tsb[i+1] & 0x1f) << 8) | tsb[i+2];
int64_t *ppcr = (pcr_pid && *pcr_pid == pid) ? pcr : NULL;
tvhtrace("tsdemux", "%s - recv_packet for pid %04X (%d)", name, pid, pid);
tvhtrace("tsdemux", "%s - recv pkt for pid %04X (%d) on mmi %p",
name, pid, pid, mmi);
/* Find PID */
if ((mp = mpegts_mux_find_pid(mm, pid, 0))) {
@ -382,6 +383,7 @@ mpegts_input_recv_packets
/* Special case streams */
if (pid == 0) table = stream = 1;
LIST_FOREACH(s, &mi->mi_transports, s_active_link) {
if (((mpegts_service_t*)s)->s_dvb_mux != mmi->mmi_mux) continue;
if (pid == s->s_pmt_pid) stream = 1;
else if (pid == s->s_pcr_pid) stream = 1;
}
@ -389,7 +391,9 @@ mpegts_input_recv_packets
/* Stream data */
if (stream) {
LIST_FOREACH(s, &mi->mi_transports, s_active_link) {
int f = table || (pid == s->s_pmt_pid) || (pid == s->s_pcr_pid);
int f;
if (((mpegts_service_t*)s)->s_dvb_mux != mmi->mmi_mux) continue;
f = table || (pid == s->s_pmt_pid) || (pid == s->s_pcr_pid);
ts_recv_packet1((mpegts_service_t*)s, tsb+i, ppcr, f);
}
}

0
support/iptv_gen.py Normal file → Executable file
View file