From patchwork Thu Aug 12 04:43:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hu Weiwen X-Patchwork-Id: 29474 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:8e8b:0:0:0:0:0 with SMTP id q133csp407204iod; Wed, 11 Aug 2021 21:44:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDsfA2JUrQZytk7sWcplOv244ZE6AOnA7scpg3wEHzO1Lq/sJzW09tbsLHMPL7PbHVW+kU X-Received: by 2002:a50:ef11:: with SMTP id m17mr3080860eds.233.1628743457601; Wed, 11 Aug 2021 21:44:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628743457; cv=none; d=google.com; s=arc-20160816; b=tiGocGbJN7usN0TkR/PDpkELPSl3N3dBiPDLLycpcsTZe7bfCqm/eQ5kx6KMLNg95T LpoFTyxR5TQkOd2w086jvby3KIu1Q5HLirUHwuMSrqH7wlOWXTcc4jJbjTKUT1KL4q3H EgCxyIcCxCZXPL230TnCUSu+gFbWKYRiCveI+LLQecQIhbR8rRnYw9F5/hS1FFQ0Qx3e JKUNSfEYlxhr0WuZIFhsG0uZBWYOunsGgP3Q9uKTsSa47wHgtr/je7WxdMcOvUhZ4V7K louTanpdDA6hCw7OF6FEbnqCE3WaKbYwIadZBiCcxEAHXW51grLpoMg3wwXCWeRd4jUL Xekg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=YxX+uIvQWjuvsnC2A5SMX5chNTxBnZvhu0chv5Qih6I=; b=RVRBdq+QEl24cb0AYYlACBEgSY3i/60vNGe5GJ34sgJDNIPoFKmIGn5oc7Y4kxgls1 JIVhYzf5T2v/sU6cCZBMy10EEUEMPge2ZTmd6hMLxkpBnqNrvXQN2Q+E0LdOOca0GjF7 fL5cSUXNsFZx/2tPyUSGQk08GemvjP1dU6qrXe5tXJBtirq6nqXvXEtJo7v2rcAIEvjM lIGDWJpehCy0lUHIBPJjbJSUrennYOz1abQC5R31sfFKD97RCOoaywMiOPZFLqG1K3vg g+uxNdc3KO7MICBDdU1GDSwtRMwhHfENxmdh0ryeBEUXcTA1D/Ikh75BwPqXNhOhzByP /wcw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=scut.edu.cn Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id l4si1477497eja.81.2021.08.11.21.44.17; Wed, 11 Aug 2021 21:44:17 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=scut.edu.cn Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 18DF168A35C; Thu, 12 Aug 2021 07:44:15 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.scut.edu.cn (unknown [202.38.213.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 091AE68A048 for ; Thu, 12 Aug 2021 07:44:06 +0300 (EEST) Received: from dorm.huww98.cn (unknown [125.216.246.30]) by main (Coremail) with SMTP id AQAAfwDXhwT+phRhBpwDAA--.3837S4; Thu, 12 Aug 2021 12:43:42 +0800 (CST) From: Hu Weiwen To: ffmpeg-devel@ffmpeg.org Date: Thu, 12 Aug 2021 12:43:54 +0800 Message-Id: <20210812044354.485278-1-sehuww@mail.scut.edu.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CM-TRANSID: AQAAfwDXhwT+phRhBpwDAA--.3837S4 X-Coremail-Antispam: 1UD129KBjvdXoWrZw1rWrWxAF1UXr4kurWfZrb_yoW3Xrc_KF 42vF4vvw4DGrnrCw4j9FZ8Gr4Fga48Cw4fGFnFyFWDWayDAr1qgF1kWrsrXa9xtr4UCFy3 Ar97JrnrJr4IgjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbcxFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_JFI_Gr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Jr0_ Gr1l84ACjcxK6I8E87Iv67AKxVWxJVW8Jr1l84ACjcxK6I8E87Iv6xkF7I0E14v26r4UJV WxJr1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_JrI_JrylYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lc2xSY4AK67AK6r45 MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr 0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUXVWUAwCIc40Y0x0E wIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWUJV W8JwCI42IY6xAIw20EY4v20xvaj40_Zr0_Wr1UMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF 0xvEx4A2jsIEc7CjxVAFwI0_Jr0_GrUvcSsGvfC2KfnxnUUI43ZEXa7VUjX4S5UUUUU== X-CM-SenderInfo: qsqrljqqwxllyrt6zt1loo2ulxwovvfxof0/1tbiAQAKBlepTBkBpwAzsz Subject: [FFmpeg-devel] [PATCH] movenc: Ensure no separate moof written for empty track X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: Hu Weiwen Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: HhoTvCGf8Ubi track->mdat_buf can be not NULL while the track is still empty if the last packet write failed. Signed-off-by: Hu Weiwen --- libavformat/movenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index bcc202300bb..a460cd9adae 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -5422,7 +5422,7 @@ static int mov_flush_fragment(AVFormatContext *s, int force) duration = track->start_dts + track->track_duration - track->cluster[0].dts; if (mov->flags & FF_MOV_FLAG_SEPARATE_MOOF) { - if (!track->mdat_buf) + if (!track->entry) continue; mdat_size = avio_tell(track->mdat_buf); moof_tracks = i;