Project

General

Profile

Actions

Bug #388

closed

IPTV Imagenio Spain - > epoll_wait = 1

Bug #388: IPTV Imagenio Spain - > epoll_wait = 1

Added by Phill Lavender about 15 years ago. Updated over 14 years ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
Category:
IPTV
Target version:
Start date:
2011-02-27
Due date:
% Done:

0%

Estimated time:
Found in version:
Affected Versions:

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

capture1 (2.16 MB) capture1 Phill Lavender, 2011-02-27 20:35

Updated by Phill Lavender about 15 years ago Actions #1

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 about 15 years ago Actions #2

Hi

Thanks for a good bug report (which capture and everything)

This is hopefully committed in commit:98975cf4

Updated by Andreas Smas about 15 years ago Actions #3

  • Status changed from New to Fixed
  • Target version set to 2.13

Updated by Phill Lavender about 15 years ago Actions #4

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 over 14 years ago Actions #5

pull request #40 -
Added Extension Header Length (4 bytes) which isn't included in the EHL field in the Header
Once accepted hopefully closed

Actions

Also available in: PDF Atom