I'm looking into the CefAudioHandler and have a question regarding the channel count.
I see `CefAudioHandler` has this method that feeds audio data:
- Code: Select all
virtual void OnAudioStreamPacket(CefRefPtr<CefBrowser> browser,
const float** data,
int frames,
int64 pts) = 0;
The `data` parameter is an array of pointers to buffers. Presumably the length of this array is determined by the channel_layout passed to the `params` here:
- Code: Select all
virtual void OnAudioStreamStarted(CefRefPtr<CefBrowser> browser,
const CefAudioParameters& params,
int channels) = 0;
So I'd expect that if `params.channel_layout` is `CEF_CHANNEL_LAYOUT_STEREO` then we can treat the `data` array to have a length of 2.
Perhaps in practice `CEF_CHANNEL_LAYOUT_STEREO` will be sent most of the time, but is there a safe way to get the length of the `data` array without needing to write a function that understand how many channels are expected for each of the layout enum values? There are likely many cases where we just want the data and don't necessarily need to know the intention of each of the channels.
There is also, for example, this channel layout:
- Code: Select all
/// Channels are not explicitly mapped to speakers.
CEF_CHANNEL_LAYOUT_DISCRETE = 29,
for which it is not obvious how to get the length of the `data` array / number of channels.
Perhaps I'm missing something, or maybe this is really a feature request for an additional API that would provide the number of channels. Thanks for any info!
Best,
Rob