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

Git pushed a commit to branch master
in repository ffmpeg.

The following commit(s) were added to refs/heads/master by this push:
     new d65fd5581d avdevice/avfoundation: keep format and frame rate range 
paired
d65fd5581d is described below

commit d65fd5581d7e28dc063a35ccb7ef88ee0b7417f5
Author:     iSold Leo <[email protected]>
AuthorDate: Mon Aug 3 19:43:47 2026 +0800
Commit:     Romain Beauxis <[email protected]>
CommitDate: Sun Aug 30 02:50:39 2026 +0000

    avdevice/avfoundation: keep format and frame rate range paired
    
    Formats with the same dimensions may expose different frame rates. The
    selection loop previously updated selected_format for every size match but
    kept selected_range from an earlier format. This could apply a range to a
    format that does not support it and make device configuration fail.
    
    Only update selected_format together with its matching range. Track a
    size-only match separately so the muxed-device fallback remains unchanged.
    
    Reported-by: MW-de <[email protected]>
    Suggested-by: MW-de <[email protected]>
    Fixes: https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/22694
    Signed-off-by: iSold Leo <[email protected]>
---
 libavdevice/avfoundation.m | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m
index 1ba1f83009..8b7e728279 100644
--- a/libavdevice/avfoundation.m
+++ b/libavdevice/avfoundation.m
@@ -394,6 +394,7 @@ static int configure_video_device(AVFormatContext *s, 
AVCaptureDevice *video_dev
     double framerate = av_q2d(ctx->framerate);
     NSObject *range = nil;
     NSObject *format = nil;
+    NSObject *matching_size_format = nil;
     NSObject *selected_range = nil;
     NSObject *selected_format = nil;
 
@@ -411,13 +412,14 @@ static int configure_video_device(AVFormatContext *s, 
AVCaptureDevice *video_dev
             if ((ctx->width == 0 && ctx->height == 0) ||
                 (dimensions.width == ctx->width && dimensions.height == 
ctx->height)) {
 
-                selected_format = format;
+                matching_size_format = format;
 
                 for (range in [format 
valueForKey:@"videoSupportedFrameRateRanges"]) {
                     double max_framerate;
 
                     [[range valueForKey:@"maxFrameRate"] 
getValue:&max_framerate];
                     if (fabs (framerate - max_framerate) < 0.01) {
+                        selected_format = format;
                         selected_range = range;
                         break;
                     }
@@ -425,7 +427,7 @@ static int configure_video_device(AVFormatContext *s, 
AVCaptureDevice *video_dev
             }
         }
 
-        if (!selected_format) {
+        if (!matching_size_format) {
             av_log(s, AV_LOG_ERROR, "Selected video size (%dx%d) is not 
supported by the device.\n",
                 ctx->width, ctx->height);
             goto unsupported_format;
@@ -435,6 +437,7 @@ static int configure_video_device(AVFormatContext *s, 
AVCaptureDevice *video_dev
             av_log(s, AV_LOG_ERROR, "Selected framerate (%f) is not supported 
by the device.\n",
                 framerate);
             if (ctx->video_is_muxed) {
+                selected_format = matching_size_format;
                 av_log(s, AV_LOG_ERROR, "Falling back to default.\n");
             } else {
                 goto unsupported_format;

-- 
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