diff mbox series

[FFmpeg-devel] lavd/avfoundation: Add an option to drop late frames.

Message ID 5427a5da-3bc6-5abb-ac9d-6b8bba5bb81a@mail.de
State New
Headers show
Series [FFmpeg-devel] lavd/avfoundation: Add an option to drop late frames.
Related show

Checks

Context Check Description
andriy/ffmpeg-patchwork pending
andriy/ffmpeg-patchwork success Applied patch
andriy/ffmpeg-patchwork success Configure finished
andriy/ffmpeg-patchwork success Make finished
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Thilo Borgmann Jan. 19, 2020, 4:41 p.m. UTC
$subject

If you record live sources like during screen capture, you want this enabled (current behavior).
For the case you're capturing from etc you want the most possible frames captured no matter a possible delay.
Was fixed behavior before, so make it an option with enabled to be default.

-Thilo
From 57782e804bf5026fc1991551090e8c52ed9027e6 Mon Sep 17 00:00:00 2001
From: Thilo Borgmann <thilo.borgmann@mail.de>
Date: Sun, 19 Jan 2020 17:36:21 +0100
Subject: [PATCH] lavd/avfoundation.m: Add an option to drop late frames.

Retains current behaviour by the default value.
---
 libavdevice/avfoundation.m | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Thilo Borgmann Feb. 3, 2020, 8:47 p.m. UTC | #1
Am 19.01.20 um 17:41 schrieb Thilo Borgmann:
> $subject
> 
> If you record live sources like during screen capture, you want this enabled (current behavior).
> For the case you're capturing from etc you want the most possible frames captured no matter a possible delay.
> Was fixed behavior before, so make it an option with enabled to be default.

Will push soon.

-Thilo
Thilo Borgmann Feb. 7, 2020, 10:10 a.m. UTC | #2
Am 03.02.20 um 21:47 schrieb Thilo Borgmann:
> Am 19.01.20 um 17:41 schrieb Thilo Borgmann:
>> $subject
>>
>> If you record live sources like during screen capture, you want this enabled (current behavior).
>> For the case you're capturing from etc you want the most possible frames captured no matter a possible delay.
>> Was fixed behavior before, so make it an option with enabled to be default.
> 
> Will push soon.

Pushed.

-Thilo
diff mbox series

Patch

diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m
index af8fe31367..0d854a18a3 100644
--- a/libavdevice/avfoundation.m
+++ b/libavdevice/avfoundation.m
@@ -98,6 +98,7 @@ 
     int             capture_cursor;
     int             capture_mouse_clicks;
     int             capture_raw_data;
+    int             drop_late_frames;
     int             video_is_muxed;
 
     int             list_devices;
@@ -496,7 +497,7 @@  static int add_video_device(AVFormatContext *s, AVCaptureDevice *video_device)
 
         [ctx->video_output setVideoSettings:capture_dict];
     }
-    [ctx->video_output setAlwaysDiscardsLateVideoFrames:YES];
+    [ctx->video_output setAlwaysDiscardsLateVideoFrames:ctx->drop_late_frames];
 
     ctx->avf_delegate = [[AVFFrameReceiver alloc] initWithContext:ctx];
 
@@ -1135,6 +1136,7 @@  static int avf_close(AVFormatContext *s)
     { "capture_cursor", "capture the screen cursor", offsetof(AVFContext, capture_cursor), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
     { "capture_mouse_clicks", "capture the screen mouse clicks", offsetof(AVFContext, capture_mouse_clicks), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
     { "capture_raw_data", "capture the raw data from device connection", offsetof(AVFContext, capture_raw_data), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
+    { "drop_late_frames", "drop frames that are available later than expected", offsetof(AVFContext, drop_late_frames), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
 
     { NULL },
 };