Search code examples
macosffmpegchromiumaudiotoolbox

AudioFormatGetProperty with kAudioFormatProperty_FormatInfo returning kAudio_ParamError (-50) in FFmpeg


I have enabled audiotoolbox decoder of ffmpeg in Chromium project. But when I try to decode anything, it fails creating the decoder (ffat_create_decoder)[libavcodec/audiotoolboxdec.c].

status = AudioFormatGetProperty(kAudioFormatProperty_FormatInfo,
                                        cookie_size, cookie, &format_size, &in_format);

This line is returning kAudio_ParamError (-50). I have compiled a standalone instance of ffmpeg on the same machine. That code works without any issue for the same set of input values. I tried hardcoding the values in chromium code base to match the working set in standalone ffmpeg, still gives the same error.

Do we need any additional flags for working with AudioToolBox.framework?


Solution

  • Audio Decoder in Chromium mac runs in renderer process. Renderer processes are sandboxed. So these API's should be whitelisted in renderer.sb file.