This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 6d5667ead85f7e8d9bd748f5e769bd64478a6284
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Tue Oct 13 06:02:51 2026 +0200
Commit:     michaelni <[email protected]>
CommitDate: Tue Oct 13 22:12:55 2026 +0000

    ffplay: wake up for input events instead of sleeping until the next refresh
    
    The event loop slept up to REFRESH_RATE between refreshes while input
    waited in the queue; waiting for an event with the same timeout handles
    input as soon as it arrives.
    
    Assisted-by: Claude
---
 fftools/ffplay.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index 9a4fb98a94..867fb532f7 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -452,6 +452,7 @@ static int exit_status = 0;
 
 static SDL_Window *window;
 static SDL_Renderer *renderer;
+static int wait_for_events;
 static SDL_RendererInfo renderer_info = {0};
 static SDL_AudioDeviceID audio_dev;
 
@@ -4407,8 +4408,12 @@ static void refresh_loop_wait_event(VideoState *is, 
SDL_Event *event) {
             SDL_ShowCursor(0);
             cursor_hidden = 1;
         }
-        if (remaining_time > 0.0)
-            av_usleep((int64_t)(remaining_time * 1000000.0));
+        if (remaining_time > 0.0) {
+            if (!wait_for_events)
+                av_usleep((int64_t)(remaining_time * 1000000.0));
+            else if (SDL_WaitEventTimeout(NULL, ceil(remaining_time * 1000)))
+                continue;
+        }
         remaining_time = REFRESH_RATE;
         if (is->chapter_render_pending || (chapter_list_visible(is) && 
current_chapter(is) != is->chapter_playing))
             chapter_list_render(is);
@@ -4979,6 +4984,10 @@ int main(int argc, char **argv)
             av_log(NULL, AV_LOG_FATAL, "Failed to create window: %s", 
SDL_GetError());
             do_exit(NULL);
         }
+        SDL_version version;
+        SDL_GetVersion(&version);
+        /* SDL before 2.0.16 waits for events by polling */
+        wait_for_events = SDL_VERSIONNUM(version.major, version.minor, 
version.patch) >= SDL_VERSIONNUM(2, 0, 16);
 
         if (vk_renderer) {
             AVDictionary *dict = NULL;

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to