The microchip stack … the tcp buffer size is the same as the window size
That is probably where your confusion comes from. In +TCP, these parameters are separated.
Richard Damon is right: it is more advantageous to have a reasonable sized TCP window, and keep audio data buffered.
It is up to you how much data must be in the buffer before you start the player.
The FreeRTOS+TCP stack can buffer TCP data for you. You can poll how much data is available in the buffer with this function:
t xSocket );
My advice for your streaming client would be the following:
xWinProperties.lRxBufSize = 1024 * 1024; /* 1 MB, or more /
xWinProperties.lRxWinSize = 12; /
12 packets /
xWinProperties.lTxBufSize = 6 * 1024; /
6 KB /
xWinProperties.lTxWinSize = 2; /
2 packets */
You may want to wait until the RX buffer is filled 80% and start playing the sound.
If your Internet connection is not so good, the IP stack may decide to decrease the size of the advertised TCP window. Using a large TCP window may lead to a chaotic conversation with many retransmissions and Selective Acknowledgements ( SACK’s ). If there are many dropped packets, a window size of 4 x MSS or less would be better.