Rpi buffer settings on WiFi

hello, Ive posted this on kodi forums too for more eyeballs. hope you like and can help me. thanks.

I am trying to improve performance of my rpi3 on wifi. it has full bars
or almost full bars with an adapter stuck right into its usb-hole. i
have a 2.5 amp power supply on its way to replace the current 2.0 amp
one. idk if there are power issues, the rainbow never appears. Yes i
have the mpeg2 license.

i have edited my advancedsettings.xml like so:

<?xml version="1.0" encoding="utf-8"?> <advancedsettings> <network> <buffermode>0</buffermode> <cachemembuffersize>157584000</cachemembuffersize> <readbufferfactor>8</readbufferfactor> </network> </advancedsettings>
i am trying to smooth out my wifi that looks like this:

Imgur

the drop you see is coincident with a stutter in the video, then it
peaks to recover… similar peak doesn’t happen when i load a video, no
matter how high i set readbufferfactor … though i havent gone past 8.
Also, i figured, top reports 500 free mbs, why not use 450 of them? …
maybe too much??

perhaps… perhaps those curl commands for advancedsettings.xml will
help, i see a lot of curl failures… idk how to use the curl commands.
ill look into it tomorrow.

Lastly i’d like to mention, rpi3 is butter smooth bringing up menus
while playing video in the background but … changing channels fills my
body with fear and the rpi3 becomes unresponsive for a while, sometimes
it does switch ok, but surely won’t switch 3-4 times… it will freeze.
seeking usually causes freezing behavior.

Here are my logs from last 2 sessions… many sorries, idk what to cut out that is important, so there’s all of it…

it’s so close! it almost works perfectly! surely it will get there with
some advancedsettings.xml tweaks?? what all else can i try?

Thanks tons for your interest and help.

If you’re using OSMC, where exactly do you see those bars indicating wireless reception?
In Kodi, there is a line bar in the wireless network section and that’s the only indication I can find.

So you are using an external wireless adapter with your RPi3 and not the built-in one. May I ask why?

I have a 2Amp power supply and once I increased the cache size and the buffer factor, I get the rainbow square indicating not enough power.

Can you please share how you got this graph? What program/method did you use?

The RPi3 has 1GB RAM, 256MB of it is dedicated to GPU. Also, the cache size set in the advancedsettings xml file uses triple it’s value from the RAM. Since you have set ~150MB as cache size, then it will use ~450MB of RAM. That’s ~700MB of the 1GB RAM used, so that should leave you with ~300MB for processing.

Edit to Add:
While playing media, you can press “o” on a keyboard to display the codec info (Link). You can monitor realtime bitrate reported by the player, the size of the cached data, and the % of the cache used.
It might help with diagnoses of the problem.

Hello,

thanks for getting back to me.

  1. bars = white dots in “my osmc”… they seem full.

  2. i was getting less white dots and more stuttering with the built in wifi. i think it’s too far away for the flat inside-the-box antenna to work well.

  3. wifi graph comes from the router software on its admin page. it draws that in 5s intervals (horizontal axis lines are 5s apart). ubiquiti air-router hp if you’re wondering. i include graph because the cache should be able to smooth those kinds of ups and downs, no? the occasional dip to 0 is normal for folks operating on wifi?

  4. ok that sounds bad. i’ll back off the cache size. 300mb? … also it should overflow to the sd card. I see all that free ram, seems like that’s preferable to the people who are using cachesize 0.

i have pressing o on yatse custom command. what should i look for?

the video line, P shows vq: 99% , dc-mmal-mpeg2, 10.5 to 8Mbps, drop53, skip 75, pc:1
When skipping, vq dropped low around 10%, then quickly recovered back to 99%, so did the mbps… CPU is showing about 20-30% on one core and occasionally 20% on another. under PVR stream info, it’s all blank. probably reporting the built-in adapter instead of my plugged in one.

it’s showing 1080p60 mpeg2 signal, perhaps i can transcode down (my tv is 720) at the pc for more wifi-friendly performance? perhaps there’s a setting in the ffdshow? pc is only pentium g3220, i’m told transcode to mp4 would be slow, maybe it can just step the mpeg2 down to 720p mpeg2 nice and fast… i didn’t see options in the decoder section of nextpvr to do this. just deinterlace on or off, and idk how that would help.

just remembered hdhrPrime lives in dhcp instead of static. perhaps that will help channel switch. haven’t tried channel switching inside nextpvr on pc to compare. pc rpi are both static addresses.

is it worth it for debug logs? i can make some soon. the overlay was annoying to the ‘others’ in the house to keep it on during viewing.

thanks again!

my router… i just caught my router doing something untoward.

Jul 21 11:32:14 wireless: ath0 Sending deauth to 18:a6:f7:11:13:8d. Reason: Poor channel conditions (34). <<this is the rpi

now the rpi3 is unresponsive buffering …1% but the buttons don’t do anything. right click won’t back out. mouse frozen. guess i must powercycle now. aaah. maybe this was power related… made the wifi suck, it gets kicked off, then freezes also due to power issue. maybe. but i never see a rainbow square.

it’s not just the router…
it’s so not just the router.

so here i was enjoying the comedy central (it was 90% smooth!) and i thought, wonder if i can do a truly pvr thing on the pie … wonder if i can record this channel and switch to another. … this is just client software, all the heavy lifting is done on pc, so it should be just a matter of giving it some commands!

boy was i wrong. it got a little sluggish when i pressed record, but otherwise worked ok. i wasn’t sure if the record command went through, so i pressed it again! … and what happened? did i get a friendly message telling me that it’s already recording? NO! i got a second recording task! my computer upstairs was recording the same channel, at the same time, twice, even assigining it a duplicate filename like com072116 and com070216-0 … i couldnt believe it! i checked resource monitor to see 48mbps getting written! 2 streams of the exact same thing!

idk, is this a bug in kodi that it doesn’t know how to behave like a proper pvr or is this the nextpvr plugin?

i eventually was able to resume watching the show as it was double recording upstairs and … well … when it got to the end of the recording, instead of becomming live tv like normal tv box might behave, it stopped! it stopped and showed me the menu!

idk. idk anymore. this time router has some issues … but now it also looks like maybe kodi has some issues too.

is this a bug? do you all want logs? i’ll go scp them from kodi maybe in the am but … aaargh. just when i thought i was seeing improvement! no! none!

not just the router!

please help. idk where to turn. maybe cable co huh? beg them to give me their 15$/mo box…

picture attached in case you don’t believe me.

I would like to suggest doing all diagnostics using the RPi’s onboard wireless. The ‘white dots’ are not really a good technical indication of performance, and right now you’re just adding another piece of hardware to the troubleshooting process.

You might as well check this thread at the Raspberry Pi forums:
https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=44044

There is a workaround over there that involves disabling the power management of the wireless chip. May be you could try that. Also, are your having any problems with SSH? There’s a workaround for that too, although it appears to be related to certain incompatibilities with some router firmwares.