FL32 audio format callback problem
Posted: 17 Jan 2019 10:36
Hello all,
I'm using the FL32 format.: libvlc_audio_set_format(vlcMediaPlayer, "FL32", AUDIO_SAMPLERATE, AUDIO_CHANNELS);
in the audio_play_cb callback I am supposing the audiodata to be a interleaved array of float samples. But it seems there's something wrong :
will crash in the memcpy() very often.
I'm using the FL32 format.: libvlc_audio_set_format(vlcMediaPlayer, "FL32", AUDIO_SAMPLERATE, AUDIO_CHANNELS);
in the audio_play_cb callback I am supposing the audiodata to be a interleaved array of float samples. But it seems there's something wrong :
will crash in the memcpy() very often.
Code: Select all
// here we play the audio
static void audio_play_cb(void *data, const void *samples, unsigned count, int64_t pts)
{
// data is the pointer to caller
MediaHandler *mh = (MediaHandler *)data;
mh->audiomutex.lock();
size_t sz = count * AUDIO_CHANNELS * sizeof(float);
float * audioData = (float *)malloc(sz);
memcpy(audioData, samples, sz);