quiniouben/vban

Sample per packet too low[solved]

Closed this issue · 5 comments

I'm having some issue with vban_emitter
Using wireshark i found that i send only 63 samples per packet .... with this amount of data the received audio stream is choppy....
I made some test and using different router i obtain different samples per packet
Higher is the sample per packet higher is audio "quality"
Is there a way to tell vban_emitter to put 256 samples in every packet? #

Hi, the number of sample per packet depends on sampling frequency, resolution (16bits / 24bits ...), and the number of channels in the stream. This is calculated to fit the best possible in the fixed maximum packet size, defined by the specifications.
One Question:

I made some test and using different router i obtain different samples per packet

What do you mean by router ?

What do you mean by router ?

I am obviously on a local network , specifically my home network, which is pretty simple a modem a router and all the devices are attached to this router.
I noticed that changing the router, SOMETHING (no clue what cause this) changes and also the samples per packets changes. All the routers have the same network configuration (also the routing tables and the MTU parameters where "cloned" from a router to another)

This is calculated to fit the best possible in the fixed maximum packet size, defined by the
specifications.

I was sending 16 bit 2 channel 44100kHz signal i made the calculation and i should be able to send 314 samples per packet ,due to VBAN specification this should be 256 samples per packet, but instead i was sending 63 samples ....

i edited the code slightly and i think that the error was in the calculation of the maximum paylod size

max_size = packet_get_max_payload_size(main_s.buffer);
int max_buffer_size = max_size * (config.stream.nb_channels * single_sample_size);
size = audio_read(main_s.audio, PACKET_PAYLOAD_PTR(main_s.buffer), max_buffer_size);
packet_set_new_content(main_s.buffer, size);

You are right, thank you for taking a look at it.
I just commited a fix for this, with not much testing, don't hesitate to report any error here.
If you confirm the fix is ok, I would close the issue.
Thanks again,

Hi sorry for replying so lately , i've done a bunch of test and it seems like that is working correctly now

Thank you again for your help and report.