From patchwork Fri Feb 19 08:43:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: HouLei X-Patchwork-Id: 25803 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 8B90B4494D6 for ; Fri, 19 Feb 2021 10:46:09 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 66D3368A1E4; Fri, 19 Feb 2021 10:46:09 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from lucky1.263xmail.com (lucky1.263xmail.com [211.157.147.135]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B9C1568064D for ; Fri, 19 Feb 2021 10:46:03 +0200 (EET) Received: from localhost (unknown [192.168.167.130]) by lucky1.263xmail.com (Postfix) with ESMTP id 451E7A70BA for ; Fri, 19 Feb 2021 16:43:31 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-ANTISPAM-LEVEL: 2 X-ABS-CHECKED: 0 Received: from localhost.localdomain (unknown [119.4.240.125]) by smtp.263.net (postfix) whith ESMTP id P21321T140438363166464S1613724200550362_; Fri, 19 Feb 2021 16:43:32 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <3a0695b0c9855d5a0915ec61b59b4c99> X-RL-SENDER: houlei@uniontech.com X-SENDER: houlei@uniontech.com X-LOGIN-NAME: houlei@uniontech.com X-FST-TO: ffmpeg-devel@ffmpeg.org X-SENDER-IP: 119.4.240.125 X-ATTACHMENT-NUM: 0 X-System-Flag: 0 From: houlei@uniontech.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 19 Feb 2021 16:43:09 +0800 Message-Id: <20210219084309.31037-1-houlei@uniontech.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] When using ffmpeg to record screen, set the operating system time and set the system time backward. Stop screen recording, unable to save video. X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: houlei@uniontech.com Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Hou Lei Signed-off-by: Hou Lei --- libavdevice/xcbgrab.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libavdevice/xcbgrab.c b/libavdevice/xcbgrab.c index be5d5ea2cf..7e886064fe 100644 --- a/libavdevice/xcbgrab.c +++ b/libavdevice/xcbgrab.c @@ -208,7 +208,16 @@ static int64_t wait_frame(AVFormatContext *s, AVPacket *pkt) for (;;) { curtime = av_gettime(); delay = c->time_frame - curtime; - if (delay <= 0) + + //When the user changes the operating system time, can synchronization be forced here? + /* + if (delay > 10) { + c->time_frame = curtime + c->frame_duration; + break; + } + */ + //When the user changes the operating system time, add timeout judgment. + if (delay <= 0 || delay > 10) break; av_usleep(delay); }