Bug #388
IPTV Imagenio Spain - > epoll_wait = 1
0%
Description
Looks like there's something stopping TVheadend processing streams (UDP, RTP) from Imagenio in Spain. - lastest GITs. - Trying my best to isolate it, but not really a coder so appreciate the assistance.
Attached Wireshark log shows TVheaded is bound to the multicast group (239.0.0.74:8208) and receiving UDP. (User data appears to start the TS header at byte 47, which I think is a little odd given the RTP v2 header is 16 bytes? , haven't got much further with that yet though.)
based on the above monitoring the Epoll_wait() function in iptv_input.c each packet returns a int value of 1 (?) so ends up in a continuous loop.
---
while(1) {
nfds = epoll_wait(iptv_epollfd, &ev, 1, 1);
if(nfds == -1) {
tvhlog(LOG_ERR, "IPTV", "epoll() error - %s, sleeping 1 second",
strerror(errno));
sleep(1);
continue;
}
// tvhlog(LOG_INFO, "IPTV", "\"%d\" epoll() events", nfds); // bad logging...
if(nfds < 1)
continue;
Files
History
Updated by Phill Lavender over 13 years ago
Ok. I can't read C ! It doesn't get stuck in a loop that's what the continue means re-loop.
Real issue here is setting the size of the hlen for the RTP packet, 0x90 is the first byte of a RTP v2 packet.
int hlen = (tsb0 & 0xf) * 4 + 12;
So tsb0 is 0x90 'bitwise and' with 0xf = 0x00. * 4 +12 = 12 so the header is set for 12 bytes, however the header on the attached logs is 28 bytes. Hence it's not getting parsed into the TS packets correctly.
Phill
Updated by Andreas Smas over 13 years ago
Hi
Thanks for a good bug report (which capture and everything)
This is hopefully committed in commit:98975cf4
Updated by Andreas Smas over 13 years ago
- Status changed from New to Fixed
- Target version set to 2.13
Updated by Phill Lavender over 13 years ago
Hi Andreas,
Checked your fix, your missing 4 bytes from the example RTP header I provided in the Wireshark log.
---fix ---
if(tsb[0] & 0x10) {
// Extension (X bit) == true
if(r < hlen + 4)
continue; // Packet size < hlen + extension header
// Skip over extension header (last 2 bytes of header is length)
hlen += ((tsb[hlen + 2] << 8) | tsb[hlen + 3]) * 4;
tvhlog(LOG_DEBUG, "IPTV", "\"%d\":RTP Header Length", hlen); // test logging
---- Proof---
[DEBUG]:IPTV: "24":RTP Header Length
[DEBUG]:IPTV: "24":RTP Header Length
[DEBUG]:IPTV: "24":RTP Header Length
etc
I added (+4) to the end of the last line and it works fine. i.e;
hlen += ((tsb[hlen + 2] << 8) | tsb[hlen + 3]) * 4 + 4 // Don't think this is really the right way to do it though.
Phill
Updated by Phill Lavender about 13 years ago
pull request #40 -
Added Extension Header Length (4 bytes) which isn't included in the EHL field in the Header
Once accepted hopefully closed