From patchwork Tue Mar 31 12:37:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 18534 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 43D0144B0FC for ; Tue, 31 Mar 2020 15:38:42 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3251668B2CA; Tue, 31 Mar 2020 15:38:42 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3F06E68B1DE for ; Tue, 31 Mar 2020 15:38:35 +0300 (EEST) Received: by mail-wr1-f67.google.com with SMTP id h9so25690689wrc.8 for ; Tue, 31 Mar 2020 05:38:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=W4BmtlxF+CP71EAJeSxGUL0QUSmodVGtxBFDBTcoBJ0=; b=hNOc6ueBZVD8Bitrk6srsxWMbyvLL+ebvuKMn+KlCVhmmT3GoX5q+EYi58hPieXOSw TdYkGThwP2DQ0FgPtug5ofMcjEYCMHMrSH1dS1Hx3WNjYLA9CIuQsRw5+FxmJB45NXG4 j3UbhJbwkhOcvLpF7wqvJnG32WnqyM+NMJyZonumOQjLilF95M+sw0IWmXjXbgWa/SLn JBvWyyD2clBLkMBNi16IqYpSNdus64pk6eGT1uW7FBPnHLlHpK7+HTS89h/YqrNWdI+O hni2BNQNuJx+5daTGx/ha26zuzJe6WPFNyG6+LX3uZskw2q/LPHetnJr/uo92g/scEXs 2uZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=W4BmtlxF+CP71EAJeSxGUL0QUSmodVGtxBFDBTcoBJ0=; b=JJNKGI+8ePd1vTIeSKwvVXF9/1IevfRYnRM/h6FVEPMsIxW/vx2WOikgAlVDx6GirD PraDNL0wCg8KlkU0FJCwiZCQoTSdHTgEH98+1WuWEHlKizQ1qcqsps5vuZsJ3Hlpc074 b2hlMcMgTZzUqaWwRTEXgSLitGUZSHmWO2EO2tR+RMpxd3V+mLgZG0zUBzJg+Md/LsoG ABxhHqS5jqpi73kAM7u3FDuQaNhzZO6vUMlm4r+3Vxt8y3GQNnbJmDjph/jzWIpqk3cG npUYFD9WMfq2hci3HFRevaGRXykIPfMEVnsukqRjCzJQaw5sPA/dU5J2+DJGToMYgZxd 26pg== X-Gm-Message-State: ANhLgQ1cBz0Hnj2ECH0vWZzDJkQY69F5UjlqAIPggxmU2RE+XZzS1OQC Rx7GhiFbgOsdCwAUgHu2E50SMCKT X-Google-Smtp-Source: ADFU+vvt+tzpfUoChF/bvh8TJachTlRajzsrs5PoKbLtpidpr82GvpuyZxQLzxcCM5E0JUJ3loK/og== X-Received: by 2002:adf:f48d:: with SMTP id l13mr20713457wro.96.1585658314411; Tue, 31 Mar 2020 05:38:34 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1ab57.dynamic.kabel-deutschland.de. [188.193.171.87]) by smtp.gmail.com with ESMTPSA id p13sm26301532wru.3.2020.03.31.05.38.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Mar 2020 05:38:33 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 31 Mar 2020 14:37:42 +0200 Message-Id: <20200331123745.6461-8-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200331123745.6461-1-andreas.rheinhardt@gmail.com> References: <20200331123745.6461-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 07/10] avformat/mux: Remove pointless timestamp backups 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" write_packet() currently saves the original timestamps of the packet it got and restores them in case writing fails. This is unnecessary as none of write_packet()'s callers make any use of these timestamps at all. So remove this and add a general comment to the function that timestamps may be modified; also remove a long outdated comment about side data. Signed-off-by: Andreas Rheinhardt --- Actually, doing the timestamp backups in write_packet() never made much sense: Timestamps may also be modified before the packet reaches write_packet(). Furthermore, backups for av_interleaved_write_frame() don't make sense at all, so these backups should have been performed in av_write_frame(). libavformat/mux.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/libavformat/mux.c b/libavformat/mux.c index be7652c97b..acb71b30c9 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -670,8 +670,7 @@ FF_ENABLE_DEPRECATION_WARNINGS #endif /** - * Make timestamps non negative, move side data from payload to internal struct, call muxer, and restore - * sidedata. + * Make timestamps non negative and call muxer; the original pts/dts are not kept. * * FIXME: this function should NEVER get undefined pts/dts beside when the * AVFMT_NOTIMESTAMPS is set. @@ -681,10 +680,6 @@ FF_ENABLE_DEPRECATION_WARNINGS static int write_packet(AVFormatContext *s, AVPacket *pkt) { int ret; - int64_t pts_backup, dts_backup; - - pts_backup = pkt->pts; - dts_backup = pkt->dts; // If the timestamp offsetting below is adjusted, adjust // ff_interleaved_peek similarly. @@ -760,10 +755,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) ret = s->pb->error; } - if (ret < 0) { - pkt->pts = pts_backup; - pkt->dts = dts_backup; - } else + if (ret >= 0) s->streams[pkt->stream_index]->nb_frames++; return ret;