Hi, I just saw a recent version of bassopus allows to use opus without the ogg container. I tried a simple experiment: record from line/mic input, encode it with opus, on the ENCODEPROC send it thru a UDP socket and then receive it and push it thru BASS_OPUS_StreamCreate on the receiving socket. In theory everything should be working but I'm getting stuttering sound, so looks like something gets recorded and arrives on the receiving side but not in good shape, maybe small fragments or without the full frame.
Maybe it's something related with flags, or I did not understood some parts on the documentation. The goal was to try to do it with less latency as possible allowing for some package loss.
What I did on the sender:
BASS_RecordInit
rec = BASS_RecordStart with MAKELONG(BASS_SAMPLE_FLOAT, 10)
opus = BASS_Encode_OPUS_Start with framesize 10 and no-ogg
on the ENCODEPROC send buffer and size over UDP
On the receiver:
BASS_Init
play = BASS_OPUS_StreamCreate (with BASS_STREAMPROC_OPUS_LOSS flag and STREAMPROC_PUSH)
While receiving UPD data, push it using BASS_OPUS_StreamPutData(play, buffer, length)
I tried in the same computer and over two computers on the same network, the stuttering it's the same. What I'm missing? Also will BASS_STREAMPROC_OPUS_LOSS needs to be used on the BASS_Encode_OPUS_Start too?
I tried to debug a bit and on RECORDPROC I get 960 bytes on each call, and on the ENCODEPROC this gets reduced to 320 bytes. The first packet is 19 bytes, if I understood properly the documentation this information is part of the BASS_OPUS_HEAD struct, I tried on the receiver to wait to get that first packet, copy it to the BASS_OPUS_HEAD struct and then initialize the BASS_OPUS_StreamCreate, but looks like it doesn't contain proper information like version, channels, sample rate. So maybe I misunderstood the documentation. Also I have the return true on RECORDPROC I think no more logic is required there.
Looks like everything should work and is very close to do it, but I need a bit of help or some pointers on how to debug or what settings to do. Thanks!
PS: I attached the audio that was playing on the tx side and the audio recorded on rx side (recorded outside the program, is what it's heard on each side)