HC2 & tvheadend: continuity counter errors

Post Reply
machello
Posts: 4
Joined: Fri Jun 07, 2019 5:02 pm
languages_spoken: english
ODROIDs: HC2
Has thanked: 0
Been thanked: 0
Contact:

HC2 & tvheadend: continuity counter errors

Unread post by machello » Fri Jun 07, 2019 7:23 pm

I compiled and installed tvheadend on my HC2 to record IP-streams. Basically this works, but I'm getting continuity counter errors. In regular use it's not a whole lot of errors, but every continuity error results in a few corrupted frames, which is annoying.

To pinpoint the problem I did some testing. I'm not quite sure, but I think that the problem is io-related. Of the scenarios I tested there were the most interesting (each run lasted 30 minutes):

- 5x streaming (no recording): no errors
- 5x recording: a few errors
- 5x streaming and hd-activity (copying a file on the hc2): lots of errors (too many to count)

In these tests I used 2 VLANs on the built-in ethernet adapter: one for regular LAN traffic and one of the iptv- streams. I've also tried using a USB-ethernet adapter instead of the built-in ethernet adapter. I can't explain why, but the results I'm getting with the latter setup are a whole lot better.

Any ideas?

I forgot to add:

# uname -a
Linux nas 4.14.111-odroidxu4 #2 SMP PREEMPT Wed May 8 17:30:01 CEST 2019 armv7l GNU/Linux

User avatar
mad_ady
Posts: 5971
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 101 times
Been thanked: 54 times
Contact:

Re: HC2 & tvheadend: continuity counter errors

Unread post by mad_ady » Fri Jun 07, 2019 8:10 pm

What does iotop say when recording? Also keep an eye on htop - is any process keeping the cpu in 100%?
Since your iptv implementation probably uses udp/multicast you can increase your udp receive buffer so that packets don't get dropped there is the process is busy for too long.

machello
Posts: 4
Joined: Fri Jun 07, 2019 5:02 pm
languages_spoken: english
ODROIDs: HC2
Has thanked: 0
Been thanked: 0
Contact:

Re: HC2 & tvheadend: continuity counter errors

Unread post by machello » Fri Jun 07, 2019 9:16 pm

I ran one of the tests again:

5x recording - using VLANs on eth0

At first everything seemd OK, but after a couple of minutes the CC errors began to appear.

IOtop shows:

Total DISK READ : 0.00 B/s | Total DISK WRITE : 7.18 M/s
Actual DISK READ: 0.00 B/s | Actual DISK WRITE: 0.00 B/s
TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND
2650 be/4 hts 0.00 B/s 2.30 M/s 0.00 % 0.00 % tvheadend -f -p /var/run/tvheadend.pid -u hts -g video [tvh:dvr]
2655 be/4 hts 0.00 B/s 1359.08 K/s 0.00 % 0.00 % tvheadend -f -p /var/run/tvheadend.pid -u hts -g video [tvh:dvr]
2656 be/4 hts 0.00 B/s 2.18 M/s 0.00 % 0.00 % tvheadend -f -p /var/run/tvheadend.pid -u hts -g video [tvh:dvr]
2659 be/4 hts 0.00 B/s 1412.98 K/s 0.00 % 0.00 % tvheadend -f -p /var/run/tvheadend.pid -u hts -g video [tvh:dvr]

And top:

top - 14:06:36 up 1:10, 2 users, load average: 0.46, 0.48, 0.41
Tasks: 129 total, 1 running, 67 sleeping, 0 stopped, 0 zombie
%Cpu(s): 2.8 us, 2.6 sy, 0.0 ni, 94.2 id, 0.3 wa, 0.0 hi, 0.2 si, 0.0 st
KiB Mem : 2044884 total, 48268 free, 134308 used, 1862308 buff/cache
KiB Swap: 1022440 total, 1003496 free, 18944 used. 1846448 avail Mem

So, there's hardly any load.

I already tried increasins the UDP buffers, a while ago. Didn't seem to do much difference, but I'll test again.

User avatar
mad_ady
Posts: 5971
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 101 times
Been thanked: 54 times
Contact:

Re: HC2 & tvheadend: continuity counter errors

Unread post by mad_ady » Fri Jun 07, 2019 10:08 pm

What filesystem do you have on your disk? 7MB/s sustained rate shouldn't be a problem for the HC2. Unless it's NTFS, then you need big_writes option

machello
Posts: 4
Joined: Fri Jun 07, 2019 5:02 pm
languages_spoken: english
ODROIDs: HC2
Has thanked: 0
Been thanked: 0
Contact:

Re: HC2 & tvheadend: continuity counter errors

Unread post by machello » Fri Jun 07, 2019 10:31 pm

Good one. But actually that's one of the reasons I stick to ext4 on Linux.

machello
Posts: 4
Joined: Fri Jun 07, 2019 5:02 pm
languages_spoken: english
ODROIDs: HC2
Has thanked: 0
Been thanked: 0
Contact:

Re: HC2 & tvheadend: continuity counter errors

Unread post by machello » Sat Jun 08, 2019 12:53 am

I did some more testing, but I'm not sure what to make of the results.

First, I optimized the udp buffer settings:
net.core.rmem_max = 67108864
net.core.rmem_default = 67108864
net.ipv4.udp_mem=262144 327680 393216
net.core.netdev_max_backlog=2000

Next, I ran the "5x recording" test (i.e. 5 streams of 12Mbps being recorderd simultaneously) and checked with netstat for udp drops: netstat -i –udp eth0.

Scenario 1:
LAN on eth0
IPTV on eth1 = USB-ethernet adapter
Results: 0 drops, 0 CC errors

Scenario 2:
same setup
simultaneously copy a file on the hc1
Results: 0 drops, 51 CC errors

Scenario 3:
LAN on VLAN 1: eth0.1
IPTV on VLAN 2: eth0.2
Results: 42 drops (so far), lots of CC errors

What to make of this? Scenario 2 suggests this might be a priority problem?

And why am I getting worse results when using VLANs on the built-in ethernet device? The USB-ethernet adapter is also a 1Gbps device, but the actual throughput is severly limited by the USB 2.0 connector.

User avatar
mad_ady
Posts: 5971
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 101 times
Been thanked: 54 times
Contact:

Re: HC2 & tvheadend: continuity counter errors

Unread post by mad_ady » Sat Jun 08, 2019 1:15 am

Hard to say... The dot1q driver has been around for a while and I don't remember performance issues with it. Is it possible to stream iptv untagged (e.g. iptv traffic uses the native vlan) and have the other traffic tagged?
How big are the packets? Maybe the dropped ones with vlan headers exceed the mtu on your switch... Though it shouldn't work on your usb adapter...

Post Reply

Return to “Issues”

Who is online

Users browsing this forum: No registered users and 1 guest