Here's a reduced version of my client implementation:
- Code: Select all
//... Other code and includes here...
static cef_audio_handler_t* get_audio_handler(cef_client_t* self) {
custom_client_t* custom_client = (custom_client_t*)self;
return &custom_client->audio_handler->base;
}
custom_client_t *create_client() {
custom_client_t *custom_client = (custom_client_t *)calloc(1, sizeof(custom_client_t));
//... Assignments to other handlers here.
custom_audio_handler_t* audio_handler = create_custom_audio_handler();
custom_client->audio_handler = audio_handler;
client->get_audio_handler = get_audio_handler;
return custom_client;
}
And here is the custom audio handler code
- Code: Select all
void on_audio_stream_packet(struct _cef_audio_handler_t* self,
struct _cef_browser_t* browser,
const float** data,
int frames,
int64 pts) {
fprintf(stderr, "Mmm\n");
void on_audio_stream_started(struct _cef_audio_handler_t* self,
struct _cef_browser_t* browser,
const cef_audio_parameters_t* params,
int channels) {
fprintf(stderr, "Hi\n");
}
void on_audio_stream_stopped(struct _cef_audio_handler_t* self,
struct _cef_browser_t* browser) {
fprintf(stderr, "Bye\n");
}
void on_audio_stream_error(struct _cef_audio_handler_t* self,
struct _cef_browser_t* browser,
const cef_string_t* message) {
fprintf(stderr, "oops\n");
}
custom_audio_handler_t* create_custom_audio_handler() {
custom_audio_handler_t* handler =
(custom_audio_handler_t*)calloc(1, sizeof(custom_audio_handler_t));
// Set the size of the base struct and setup the method handlers
handler->base.base.size = sizeof(cef_audio_handler_t);
handler->base.on_audio_stream_packet = on_audio_stream_packet;
handler->base.on_audio_stream_started = on_audio_stream_started;
handler->base.on_audio_stream_stopped = on_audio_stream_stopped;
handler->base.on_audio_stream_error = on_audio_stream_error;
fprintf(stderr, "Audio Handler created...\n");
return handler;
}
I have ensured that the create_custom_audio_handler function is called and the custom_audio_handler_t is appropriately initialized. Despite this, when I play an audio source in the handled CEF browser, none of my callback functions (on_audio_stream_packet, on_audio_stream_started, on_audio_stream_stopped, or on_audio_stream_error) are being called.
Does anyone have any ideas why these callbacks are not being called, or how I can debug them effectively? Any help would be greatly appreciated.