From patchwork Tue Oct 15 11:17:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 15762 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 594374468B3 for ; Tue, 15 Oct 2019 14:25:49 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4290F68A1EB; Tue, 15 Oct 2019 14:25:49 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E66CD68A14B for ; Tue, 15 Oct 2019 14:25:43 +0300 (EEST) Received: by mail-wr1-f66.google.com with SMTP id r5so23336977wrm.12 for ; Tue, 15 Oct 2019 04:25:43 -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=gzh4v8EZRYZgjSpx3FussRmpJn1oguopJeQ/9j4RsYY=; b=h78NH5uukCXwjsNwhotRp0570hyn5o1uo2kdK+Zy6HP2HhisCln2xJZbZZnBc7Z7FI EHw+v4cLCGbuqDkDvAEwnwdc598zqG/ahyMV8BNeO5buBzSqCX3+QkD99wH21v02y/Qa cHhT2h9k+GZ/ZqHoy+fVvqP1wdkjCLLjpSt/rZwq/SVjn9UmsbvHY5YcgaNW4JjmxQKt iBWFYkSaqffJDrBf8jkGsjveLKrJ7vcpV7Ux8G+/OEtVCp0gIQWkeyDR2S9v+mw/yGGx GHe7lFr7pCyfEz0aKS270MjzHYJU5LssmlIMmUoECH6uumx533lE55iDb3HCZx/mAYgb 8KVw== 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=gzh4v8EZRYZgjSpx3FussRmpJn1oguopJeQ/9j4RsYY=; b=SawOkXxveSqpc7Ijb2hiNJdeKwaDTaiNmgxSM8vabl8INBWZsHN41WzwsY+LPRu2AB 7crj/yt8L+t8DBF8XycMFMOwQ6RcGxNaMLGSHPeUr6YRXo+8vKoYFb7QCXdDOxOLH09F DSYFwY31uSUvvIQw2cr2WtV4EdXLeVj6v34PrvZo118CvYFeecBcfO1XOTp4or2Pfbb1 7W8UD/fSmGf3rfN6sX54d1VVRPNoi20iGImBwAdHmicgwRgzfyV8euxr0G26rCxIz+Eq 8k6j3KwRhmGmTb0Bk22pFKmQOmdInjvyXQglhuu0AIdWKXJ7HLN3VgFSl/toXh6hp48z eHrQ== X-Gm-Message-State: APjAAAX69jIcaFp5w10hMMWKxtjs4SniSpzxm9/bmUDsh/DwDiVaus3r 6PlAU1Ih83vL9WICvv/lD3yQ7nO+ X-Google-Smtp-Source: APXvYqyu9+1vYZIeemj1oTQCnM8ARiNbaXvCH1yWbkFkiv8HYEnREXZH/SbR2TX8q5veI2ANT3DAQg== X-Received: by 2002:adf:fad1:: with SMTP id a17mr31953684wrs.148.1571138742858; Tue, 15 Oct 2019 04:25:42 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc08937.dynamic.kabel-deutschland.de. [188.192.137.55]) by smtp.gmail.com with ESMTPSA id y3sm4364637wmg.2.2019.10.15.04.25.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2019 04:25:42 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 15 Oct 2019 13:17:37 +0200 Message-Id: <20191015111737.14246-9-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191015111737.14246-1-andreas.rheinhardt@gmail.com> References: <20191015111737.14246-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 9/9] avformat/matroskaenc: Fix ReferenceBlock timestamp 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" In order to indicate that the frames in a BlockGroup are not keyframes, one has to add a ReferenceBlock element containing the timestamp of a reference block that has already been written. The timestamp ought to be relative to the timestamp of the block it is attached to. Yet the Matroska muxer used the relative timestamp of the preceding block of the track, i.e. the timestamp of the preceding block relative to the timestamp of the cluster containing said block (that need not be the cluster containing the current block). This has been fixed. Signed-off-by: Andreas Rheinhardt --- libavformat/matroskaenc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 1a3d337e5b..cb608f3297 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -2182,9 +2182,9 @@ static void mkv_write_block(AVFormatContext *s, AVIOContext *pb, av_free(data); if (blockid == MATROSKA_ID_BLOCK && !keyframe) { - put_ebml_sint(pb, MATROSKA_ID_BLOCKREFERENCE, track->last_timestamp); + put_ebml_sint(pb, MATROSKA_ID_BLOCKREFERENCE, track->last_timestamp - ts); } - track->last_timestamp = ts - mkv->cluster_pts; + track->last_timestamp = ts; if (discard_padding) { put_ebml_sint(pb, MATROSKA_ID_DISCARDPADDING, discard_padding);