#195: Buffers length

Support forum for minisatip
Post Reply
lars18th

Post by lars18th »

Hi @catalinii ,

I like to understand the influence of the buffers in the minisatip. Please can you explain the use of: -b --buffers X:Y. I like to improve the robustness in a slow system using more memory for buffers, but I dont show any difference changing these values. Also I like to know if its possible to change the buffer for HTTP client connections.

Thank you for your impressive effort!
catalinii
Posts: 0
Joined: Wed Nov 18, 2015 5:41 am

Post by catalinii »

Hi Lars,

generally those parameters sets how big is the kernel buffer and the application DVR buffer.
The data is read by the kernel from the dvb card and stored in its own buffer (second parameter -DVR_BUFFER), then it is read by the application and stored in the ADAPTER_BUFFER.

If you increase those values, minisatip will basically store more data in the buffer before sending it to the streams (over tcp).

If the tcp is sending slower than the data that is received from the DVB card (because of packet loss for example), the buffers will eventually get full and start dropping packets (E_OVERFLOW error), just that if they are bigger it will happen later than if they are smaller.

In this case there is not much we can do as minisatip does not buffer the data before being sent... it just tries to send it in a blocking write.

When I use minisatip over large distances I always go with udp as its better to loose a small part of the image than for tcp to start retrying lost packets, dropping the window increasing it again and so on...
TCP is unusable over links with high RTT.

lars18th

Post by lars18th »

Hi @catalinii ,

Thank you very much for your interesting response! I feel you have good experience with video streaming...

However, my concern is related to the use of vtuner-satip-driver. Remember that at time Im using this option as input for minisatip from a hardware SAT>IP server (in a local LAN). This driver reads (async) from the remote hardware SAT>IP server, and stores data in the kernel driver. Then, my question is: the kernel buffer size is the size of the output buffer in the driver? Then, what is the DVR buffer? Also, another question is when using Oscam. In this case, with a slow server, I can increase the buffer in the minisatip for storing more data pending to the decryt keys? My problem, at time are intermitent freezes when playing high bitrate encrypted channels. However, the CPU tools dont show that any of the process are consuming a lot of power, then I suspect the problem is a synch problem between buffers and blocking read/writes.

Please, can you explain more about the buffers you use?
Thank you!
catalinii
Posts: 0
Joined: Wed Nov 18, 2015 5:41 am

Post by catalinii »

the parameter is -b ADAPTER_BUFFER_SIZE:DVR_BUFFER_SIZE

DVR_BUFFER_SIZE is on the kernel side (where the driver stores the data in the kernel before getting to the application), ADAPTER_BUFFER is on minisatip side.

Basically minisatip reads from the dvr until adapter buffer is full, when it start processing it.

About the load, on my mips system at 450Mhz a 2MB/s stream takes around 10-20% of load (without dvbcsa).

Generally to test I would remove tcp out of the way unless you are 100% your network is in a very good shape (meaning just wires, no wireless, no packet loss).

Then you can see basically if the system is handling the load or no, top should show clearly that more specifically on the user %cpu load.

About dvbcsa, if a low bit rate stream is ok and a high bitstream rate is not OK, maybe your problem is the hardware....

what cpu are you using ?
lars18th

Post by lars18th »

Hi @catalinii ,

Im using a low power Atom CPU with regular x86_64 Debian 7. So the problem isnt the cpu load.

> Basically minisatip reads from the dvr until adapter buffer is full, when it start processing it.

This is the point that I dont understand. You read from the drv buffer in chunks until empty it or only some packets each time?

Please, help me also to understand this:

* If the vtuner driver has troubles writing to the dvr buffer then I need to increase this buffer, right? If the buffer is too small and minisatip reads slow (or has some blocking funtion that stops reads) then the vtuner will overflows the buffer and some packets be missing. This is correct?

* If the minisatip processing has some trouble, then the solution is increase the adapter buffer, right? For example, if the dvbcsa has large wait times for recovery the key then with a large adapter buffer, the wait time can be increased without lossing packets. This is correct?

Im only trying to understand how to tweak these values without doing stupid changes (for example, a very huge dvr buffer that only consume resources and increase the latency).

Thank you very much for clarifications!
lars18th

Post by lars18th »

Hi @catalinii ,

More comments (I hope you dont trouble for my several requests):

Using a slow remote Oscam server, I see some freezes in the image time to time. In the logs I see this:

> [17/11 06:48:33.685751 AD1]: Unable to decrypt blen = 0, parity = 1, key_ok 1 for key 0

The freeze is minial (less than a second), and I feel the problem is that the new key arrives quite later. I think if its possible to fix this behaviour increasing the buffer. I explain my idea with an algorithm:

1) read one TS packet from buffer.
2) if its a CA packet then send it to the dvbcsa
3) push all new packets in a second buffer
4) when the second buffer is full, pop messages from it for decrypt.

The idea is use a second buffer for decrypting while waiting for delayed keys.
What you think? The adapter buffer value has some influence on this?
Post Reply