Community discussions

MikroTik App
 
kirenida
just joined
Topic Author
Posts: 11
Joined: Sat Apr 24, 2021 10:41 pm

Problems with streaming media over local network after moving to hAp ac2

Sat Apr 24, 2021 11:35 pm

Hello!

I believe I am a rare use case, so here is my setup:

Lenovo laptop running Kubuntu (wifi connection)
hAp ac2
Raspberry pi 3B+ (wired connection)

Distance between laptop and router is 2m with no obstacles (living room, laptop on desk, router on shelf, not practical to run cable, no big electrical devices close to router except hifi amplifier 1m away).

So, I want to send audio from my laptop to my raspberry which is connected to my stereo. For that, I am using pulseaudio, which is sending data using a TCP connection (more info - https://gavv.github.io/articles/pulseau ... d/#tunnels). Audio is usually from a youtube video, but I have the same problems when playing local audio or video files stored on my laptop.

I am getting constant buffer underruns on the raspberrypi, which result in loss of a/v sync and sound dropping out. The buffer underruns are visible in logs made by the receiving pulseaudio server. They appear several times per minute.

I do not get these underruns when the laptop is using a wired connection.

My wireless configuration is: (I removed the mac addresses and network names)
 0  R name="wlan1" mtu=1500 l2mtu=1600 mac-address= arp=enabled disable-running-check=no interface-type=IPQ4019 radio-name="" 
      mode=ap-bridge ssid="" area="" frequency-mode=regulatory-domain country=norway installation=indoor antenna-gain=3 frequency=auto 
      band=2ghz-onlyn channel-width=20mhz secondary-channel="" scan-list=default wireless-protocol=802.11 rate-set=default 
      supported-rates-b=1Mbps,2Mbps,5.5Mbps,11Mbps supported-rates-a/g=6Mbps,9Mbps,12Mbps,18Mbps,24Mbps,36Mbps,48Mbps,54Mbps basic-rates-b=1Mbps 
      basic-rates-a/g=6Mbps max-station-count=2007 distance=indoors tx-power-mode=default vlan-mode=no-tag vlan-id=1 wds-mode=disabled wds-default-bridge=none 
      wds-default-cost=100 wds-cost-range=50-150 wds-ignore-ssid=no update-stats-interval=disabled bridge-mode=enabled default-authentication=yes 
      default-forwarding=yes default-ap-tx-limit=0 default-client-tx-limit=0 wmm-support=required hide-ssid=no security-profile=default wps-mode=disabled 
      station-roaming=disabled disconnect-timeout=3s on-fail-retry-time=100ms preamble-mode=short compression=no allow-sharedkey=no 
      station-bridge-clone-mac=00:00:00:00:00:00 ampdu-priorities=0 guard-interval=any 
      ht-supported-mcs=mcs-0,mcs-1,mcs-2,mcs-3,mcs-4,mcs-5,mcs-6,mcs-7,mcs-8,mcs-9,mcs-10,mcs-11,mcs-12,mcs-13,mcs-14,mcs-15,mcs-16,mcs-17,mcs-18,mcs-19,mcs-20,mcs-
                 21,mcs-22,mcs-23 
      ht-basic-mcs=mcs-0,mcs-1,mcs-2,mcs-3,mcs-4,mcs-5,mcs-6,mcs-7 tx-chains=0,1 rx-chains=0,1 amsdu-limit=8192 amsdu-threshold=8192 tdma-period-size=2 
      nv2-queue-count=2 nv2-qos=default nv2-cell-radius=30 nv2-security=disabled nv2-preshared-key="" nv2-mode=dynamic-downlink nv2-downlink-ratio=50 
      nv2-sync-secret="" hw-retries=2 frame-lifetime=0 adaptive-noise-immunity=ap-and-client-mode hw-fragmentation-threshold=disabled hw-protection-mode=rts-cts 
      hw-protection-threshold=0 frequency-offset=0 rate-selection=advanced multicast-helper=default multicast-buffering=enabled keepalive-frames=enabled 
      skip-dfs-channels=disabled 

 1  R name="wlan2" mtu=1500 l2mtu=1600 mac-address= arp=enabled disable-running-check=no interface-type=IPQ4019 radio-name="" 
      mode=ap-bridge ssid="5" area="" frequency-mode=regulatory-domain country=norway installation=any antenna-gain=3 frequency=auto 
      band=5ghz-onlyac channel-width=20/40/80mhz-XXXX secondary-channel="" scan-list=default wireless-protocol=802.11 rate-set=default 
      supported-rates-a/g=6Mbps,9Mbps,12Mbps,18Mbps,24Mbps,36Mbps,48Mbps,54Mbps basic-rates-a/g=6Mbps max-station-count=2007 distance=indoors tx-power-mode=default 
      vlan-mode=no-tag vlan-id=1 wds-mode=disabled wds-default-bridge=none wds-default-cost=100 wds-cost-range=50-150 wds-ignore-ssid=no 
      update-stats-interval=disabled bridge-mode=enabled default-authentication=yes default-forwarding=yes default-ap-tx-limit=0 default-client-tx-limit=0 
      wmm-support=required hide-ssid=no security-profile=default wps-mode=disabled station-roaming=disabled disconnect-timeout=3s on-fail-retry-time=100ms 
      preamble-mode=both compression=no allow-sharedkey=no station-bridge-clone-mac=00:00:00:00:00:00 ampdu-priorities=0 guard-interval=any 
      ht-supported-mcs=mcs-0,mcs-1,mcs-2,mcs-3,mcs-4,mcs-5,mcs-6,mcs-7,mcs-8,mcs-9,mcs-10,mcs-11,mcs-12,mcs-13,mcs-14,mcs-15,mcs-16,mcs-17,mcs-18,mcs-19,mcs-20,mcs-
                 21,mcs-22,mcs-23 

I have the same problems when using either of the two networks. I have tried using just one network, with the other one turned off, same thing.

I've tried:
- automatic or manual channel selection on both networks,
- different frequency widths
- Setting only-n and only-ac
- disabling low data rates
- enabling/disabling WMM Support, Multicast Helper, Multicast Buffering, Hw. Retries, Hw. Protection Mode, Adaptive Noise Immunity
- setting Installation to Any
- vertical and horizontal orientation of router

I have not tried:
- setting manual Tx power
- any other advanced configuration on the router regarding network traffic.

Things I've modified:
- SNTP enabled
- changed DHCP address pool
- setup piHole running on raspberry to be used as DNS server

Before switching to the hAp, I have been using a TP-link TL-WR741ND running OpenWRT. I was using a 2.4GHz wifi network, with settings as can be seen in the attached file.
The TP-Link has an external antenna.
I had a lot less underruns when using the TP-link - less than 10 i several hours, compared to several per minute on the hAP.

Does anyone have any ideas what else can I try? I know that the tp-link has an advantage because of the external antenna, but the laptop is less than 2 meters away from the hAp, so I don't believe the problem is with the wireless network, but maybe in some other part of the mikrotik configuration.

I have been trying to fix this for almost two weeks now, so there is probably something I've forgotten to mention.
If this belongs in the WIreless subforum, I can remove this post and post again there.

Thanks for any ideas!
You do not have the required permissions to view the files attached to this post.
 
kirenida
just joined
Topic Author
Posts: 11
Joined: Sat Apr 24, 2021 10:41 pm

Re: Problems with streaming media over local network after moving to hAp ac2

Thu May 13, 2021 3:23 pm

Bumping this up in hope of getting any suggestions.

In reply to a recent similar question, I added a mangle rule:
/ip firewall mangle
add action=set-priority chain=forward \
new-priority=from-dscp-high-3-bits
But even with this, I get no improvement.
I think this rule has little effect, as the packet count is really low and doesn't increase even when playing music.

After looking a bit into this, I tried looking into the packets that are being sent through the network, and I found that the packets going to the port on the raspberry have this:
Differentiated Services Field: 0x10 (DSCP: Unknown, ECN: Not-ECT)
From that I gather that that mangle rule doesn't work because there is nothing for it to work on, since DSCP is not set.

My next step was to try and make a mangle rule to just count the packets going to the specific port on the raspberry, but I had no success.
Then I looked at the active connections in the Firewall section, but I could not see any active connection from my laptop to the raspberry, even while playing music.

This is all a bit outside my knowledge and experience, so I would welcome any suggestion what to try next.

Thanks!
 
erlinden
Forum Guru
Forum Guru
Posts: 1900
Joined: Wed Jun 12, 2013 1:59 pm
Location: Netherlands

Re: Problems with streaming media over local network after moving to hAp ac2

Thu May 13, 2021 3:57 pm

If your laptop also has an ethernet adapter, are the problems still there while using it?
Does things improve if the laptop is connected to the 5G radio?
Can you set all wireless settings to default and only choose:

2.4GHz
- TX Power 9 (at least a lot lower)
- fixed channel
- n only

5GHz
- TX Power 20 (at least, a bit lower)
- fixed channel
- extension channel Ceee (so you know which channels are used)
- n/ac

WPA2 AES only...always!
WMM enabled
802.11
country selected

With these settings, and when connected to the 5GHz band, you should be able to stream with no problems.
 
User avatar
bpwl
Forum Guru
Forum Guru
Posts: 2978
Joined: Mon Apr 08, 2019 1:16 am

Re: Problems with streaming media over local network after moving to hAp ac2

Thu May 13, 2021 4:43 pm

From that I gather that that mangle rule doesn't work because there is nothing for it to work on, since DSCP is not set.

DSCP must be set before, e.g. my streaming NAS does this, if not either set priority yourselves based on firewall rule selection, or set DSCP.
Maybe this helps: https://mum.mikrotik.com/presentations/ ... 103908.pdf
 
kirenida
just joined
Topic Author
Posts: 11
Joined: Sat Apr 24, 2021 10:41 pm

Re: Problems with streaming media over local network after moving to hAp ac2

Thu May 13, 2021 8:24 pm

If your laptop also has an ethernet adapter, are the problems still there while using it?
Does things improve if the laptop is connected to the 5G radio?
Can you set all wireless settings to default and only choose:

2.4GHz
- TX Power 9 (at least a lot lower)
- fixed channel
- n only

5GHz
- TX Power 20 (at least, a bit lower)
- fixed channel
- extension channel Ceee (so you know which channels are used)
- n/ac

WPA2 AES only...always!
WMM enabled
802.11
country selected

With these settings, and when connected to the 5GHz band, you should be able to stream with no problems.
Thanks for the answer, but I tried everything you mentioned except changing the TX power. I don't think it would make a difference, as the router is less than 2m away from the laptop, with nothing between them.
Everything works perfect over ethernet.
I get the same underruns on either 2.4GHz or 5GHz, even with the other radio disabled and no other devices connected.
I have 1 or 2 other networks on 5GHz around me, but they are on different frequencies and really weak.

I set TX power on 5GHz to all rates fixed and 20dBm, and will see how it works now, thanks.
 
kirenida
just joined
Topic Author
Posts: 11
Joined: Sat Apr 24, 2021 10:41 pm

Re: Problems with streaming media over local network after moving to hAp ac2

Thu May 13, 2021 8:33 pm

From that I gather that that mangle rule doesn't work because there is nothing for it to work on, since DSCP is not set.

DSCP must be set before, e.g. my streaming NAS does this, if not either set priority yourselves based on firewall rule selection, or set DSCP.
Maybe this helps: https://mum.mikrotik.com/presentations/ ... 103908.pdf
I just looked at this document today :D
As this is all still new to me, I gather that i need to do this:
/ip firewall mangle> addchain=prerouting comment=DSCP-TOS protocol=tcp new-dscp=4 action=change-dscp
And this will set DSCP for all TCP packets, I presume?
My logic was that I should just set a different DSCP for packets going to a specific port on a specific IP address, but I couldn't even figure out how to setup a mangle rule for counting packets going to that destination.
 
User avatar
bpwl
Forum Guru
Forum Guru
Posts: 2978
Joined: Mon Apr 08, 2019 1:16 am

Re: Problems with streaming media over local network after moving to hAp ac2

Thu May 13, 2021 9:58 pm

And this will set DSCP for all TCP packets, I presume?
This was only the first example ...
Klembord-2.jpg
The firewall rules have many filters (https://rickfreyconsulting.com/basic-tr ... s-rev-3-1/) (https://rickfreyconsulting.com/explanat ... -matchers/)

Like in this (different!) example: https://mum.mikrotik.com/presentations/ ... 536100.pdf (slide 35 for TCP, but there is still address and/or port that can be specified)

Counting is whenever the rule is used AFAIK.
You do not have the required permissions to view the files attached to this post.
 
kirenida
just joined
Topic Author
Posts: 11
Joined: Sat Apr 24, 2021 10:41 pm

Re: Problems with streaming media over local network after moving to hAp ac2

Mon May 17, 2021 1:47 pm

I've been playing around with the stuff mentioned in the links, but I've had no progress.

I tried resetting everything to defaults and changing a single option at a time, while running iperf3 to see any effects. I managed to lower the number of retransmissions when using the 5GHz band, but I still have a/v dropouts.

I noticed that i get less dropouts when I use the 2.4GHz band.

I disabled Fast Track so I could apply mangle rules, but the moment I set Any Port in a rule, it stops working - I don't see any change in number of packets.
At the same time, if I run the packet sniffer on the router, I can see the packets with the specified port number.

Should I just accept that for some reason, in my use case, the TP-link + OpenWRT solution is just better?

Edit: Yep, just now I setup the TP-link to act as a simple AP, connected it to the hAp and everything works perfectly. 0 retransmissions when testing with iperf3.
My conclusion: hAP ac2 has really bad builtin-wifi since it is unusable for my use case.

Who is online

Users browsing this forum: titinas and 48 guests