FL32 audio format callback problem

This forum is about all development around libVLC.
MikOfClassX
Blank Cone
Blank Cone
Posts: 48
Joined: 29 Dec 2018 10:23

FL32 audio format callback problem

Postby MikOfClassX » 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.

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);

Rémi Denis-Courmont
Developer
Developer
Posts: 15266
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: FL32 audio format callback problem

Postby Rémi Denis-Courmont » 17 Jan 2019 17:31

What you describe is "f32l" or "f32b", not "FL32".
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

MikOfClassX
Blank Cone
Blank Cone
Posts: 48
Joined: 29 Dec 2018 10:23

Re: FL32 audio format callback problem

Postby MikOfClassX » 18 Jan 2019 10:13

Yep, I was fooled from the docs: https://www.videolan.org/developers/vlc ... layer.html

libvlc_audio_set_format()
..
..
format a four-characters string identifying the sample format (e.g. "S16N" or "FL32")

it's better to use something like:

char audiofourcc[4];
vlc_fourcc_to_char(VLC_CODEC_FL32, audiofourcc);

Apart from this, now the correct fourcc is there. No longer crashes, but the memory layout of the samples is obscure.
They don't seem to be interleaved by channels modulo. So the audio output is incorrect.

realnc
Blank Cone
Blank Cone
Posts: 14
Joined: 28 Jul 2010 20:35
Operating System: Linux

Re: FL32 audio format callback problem

Postby realnc » 06 Apr 2019 07:29

char audiofourcc[4];
vlc_fourcc_to_char(VLC_CODEC_FL32, audiofourcc);

Apart from this, now the correct fourcc is there. No longer crashes, but the memory layout of the samples is obscure.
They don't seem to be interleaved by channels modulo. So the audio output is incorrect.

The output is always 16-bit signed integers interleaved. libVLC ignores the requested sample format in libvlc_audio_set_format(). You always get S16L samples. Probably a bug.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: FL32 audio format callback problem

Postby Jean-Baptiste Kempf » 07 Apr 2019 11:43

Report it on the bug tracker.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

oviano
Cone that earned his stripes
Cone that earned his stripes
Posts: 120
Joined: 12 Jan 2012 11:12

Re: FL32 audio format callback problem

Postby oviano » 09 Apr 2019 10:56


MikOfClassX
Blank Cone
Blank Cone
Posts: 48
Joined: 29 Dec 2018 10:23

Re: FL32 audio format callback problem

Postby MikOfClassX » 13 Apr 2019 17:41

Thanks oviano. I spent too much time in looking for an unexisting bug in my code.
Someone reported the bug to the gurus here ?


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 5 guests