Microcontroller › Raspberry Pi › how to stream video and audio › Try this for audio 1. Make
February 27, 2019 at 2:57 pm
#15028
Participant
Try this for audio
1. Make sure you compile against this implementation / version of ortp
ortp-0.22.0.tar.gz
Get it from here : http://download.savannah.nongnu.org/rel … p/sources/
2. I changed the opus encoder / decoder to int16 from float – due to my audio devices was simple
16 bit cheep stuf.
changes to tx.c rx.c and device.c
jakobsen@w520:~/work/trx/trx-0.3$ diff rx.c /home/jakobsen/work/friaudio/pi_node/src/trx/rx.c
73c73,74
< float *pcm;
—
> //float *pcm;
> opus_int16 *pcm;
79c80,81
< r = opus_decode_float(decoder, NULL, 0, pcm, samples, 1);
—
> r = opus_decode(decoder, NULL, 0, pcm, samples, 1);
> // r = opus_decode_float(decoder, NULL, 0, pcm, samples, 1);
81c83,84
< r = opus_decode_float(decoder, packet, len, pcm, samples, 0);
—
> r = opus_decode(decoder, packet, len, pcm, samples, 0);
> // r = opus_decode_float(decoder, packet, len, pcm, samples, 0);
241c244,245
<
—
>
>
268a273
>
jakobsen@w520:~/work/trx/trx-0.3$ diff tx.c /home/jakobsen/work/friaudio/pi_node/src/trx/tx.c
63c63,64
< float *pcm;
—
> //float *pcm;
> opus_int16 *pcm;
91c92,93
< z = opus_encode_float(encoder, pcm, samples, packet, bytes_per_frame);
—
> z = opus_encode(encoder, pcm, samples, packet, bytes_per_frame);
> //z = opus_encode_float(encoder, pcm, samples, packet, bytes_per_frame);
245,246c247,248
jakobsen@w520:~/work/trx/trx-0.3$ diff device.c /home/jakobsen/work/friaudio/pi_node/src/trx/device.c
56c56
< r = snd_pcm_hw_params_set_format(pcm, hw, SND_PCM_FORMAT_FLOAT);
—
> r = snd_pcm_hw_params_set_format(pcm, hw, SND_PCM_FORMAT_S16_LE); //SND_PCM_FORMAT_FLOAT);