From 9562bd7ee2b8e3681851eb4a68e4f8a0a52c2b59 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Tue, 7 Oct 2025 20:16:06 +0200 Subject: [PATCH] fix --- app/src/audio_player.c | 9 ++++++++- app/src/display.c | 14 +++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/app/src/audio_player.c b/app/src/audio_player.c index b797cd25..3e88ea45 100644 --- a/app/src/audio_player.c +++ b/app/src/audio_player.c @@ -125,7 +125,14 @@ sc_audio_player_frame_sink_open(struct sc_frame_sink *sink, (void) ok; // We don't care if it worked, at least we tried } - SDL_ResumeAudioDevice(ap->device); + ok = SDL_ResumeAudioDevice(ap->device); + if (!ok) { + LOGE("Could not resume audio device: %s", SDL_GetError()); + SDL_DestroyAudioStream(ap->stream); + free(ap->aout_buffer); + sc_audio_regulator_destroy(&ap->audioreg); + return false; + } return true; } diff --git a/app/src/display.c b/app/src/display.c index f98b5eef..6b711324 100644 --- a/app/src/display.c +++ b/app/src/display.c @@ -56,8 +56,11 @@ sc_display_init(struct sc_display *display, SDL_Window *window, #ifdef SC_DISPLAY_FORCE_OPENGL_CORE_PROFILE // Persuade macOS to give us something better than OpenGL 2.1. // If we create a Core Profile context, we get the best OpenGL version. - SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, - SDL_GL_CONTEXT_PROFILE_CORE); + bool ok = SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, + SDL_GL_CONTEXT_PROFILE_CORE); + if (!ok) { + LOGW("Could not set a GL Core Profile Context"); + } LOGD("Creating OpenGL Core Profile context"); display->gl_context = SDL_GL_CreateContext(window); @@ -416,6 +419,11 @@ sc_display_render(struct sc_display *display, const SDL_Rect *geometry, } } - SDL_RenderPresent(display->renderer); + bool ok = SDL_RenderPresent(display->renderer); + if (!ok) { + LOGE("Could not render the content"); + return SC_DISPLAY_RESULT_ERROR; + } + return SC_DISPLAY_RESULT_OK; }