From patchwork Fri Apr 19 23:40:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 12835 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 6C7374494CF for ; Sat, 20 Apr 2019 02:50:10 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4886F68AAA0; Sat, 20 Apr 2019 02:50:10 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AAB2668AA99 for ; Sat, 20 Apr 2019 02:50:03 +0300 (EEST) Received: by mail-wr1-f65.google.com with SMTP id o12so5189112wrn.2 for ; Fri, 19 Apr 2019 16:50:03 -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=2hm+kknn9HQHL/8jvQYlED1JyJfHMkE47mAaI/VB460=; b=F1AQN1Y0aIj//HQsaSi604fatQ5c/eU9P89M2PFLFyoE2vgWtVDV+XlauaAP/B99tE WSGIz65o6WnZmbNsHFR63s8voDm7oZf9pC+UwA6hef9IbKH07GY50XPvs9/apB3Y+nfk ee55idAQpG5uO3WkmGz2ORW6LKDOmqBIFkTyJGCCRqhYcQQo06RCG673ylRt34/+RLGJ zZTln3AuLSY+EvABNit0aKZvmrDku4DFAZe3AuslKVvTlpGwEjjs59uWni5Y1KWvf7mC 9YwLfk3WmDk0C7VTWhiFKi/sq5JJltKbvWpZ4xDlTQIROeVeMzrFFtuwjbTlf9EcZTU+ 5FNQ== 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=2hm+kknn9HQHL/8jvQYlED1JyJfHMkE47mAaI/VB460=; b=GXPKGHtviLA6Hzmk/v1Qei42WObudAlCUjOciYj8GaqB9dLVKjnYlJJnbtT8EQONjx q23sFKfIfmHuXmcoCBqe/5viZAE32L8gcTlLokT0IBwlHVurP9Ec8r8rZApj5Gn1mtx+ lGnWx2edpHOu2jrqRiMli62zxB1i8mzMHdUTlhfYJl1X1RZ4gkegcIxnABQ0FUdmwLzO JEpvH56od7vvWnC7Pgj/MAKnhpHJBHtk3AmnE2XlPjbQyjpWdfHFb1F7IBdXAowiyJGH vOd4XHtIQb8pSwCtw4AUp6Ggweb0MbkU5sGhfkuOSKXGoF28ag4ZwP+GHtAtDIj6JwLI xs2g== X-Gm-Message-State: APjAAAWtXe0CAKmEydn2EAHhEJUOaksaWyKEA3TUjzwcbV0iCo3hN8/x taIXneM+8+IAKHgoXwVvYWTLjgUfMQo= X-Google-Smtp-Source: APXvYqxW0T++4yhJDRL+61APKbsGgLRg8slmEesO3y6cKh/CZXd0Qi8aU3WtCFg/J04g4pmTA6eWIQ== X-Received: by 2002:adf:dec4:: with SMTP id i4mr4300736wrn.318.1555717803111; Fri, 19 Apr 2019 16:50:03 -0700 (PDT) Received: from localhost.localdomain (ipbcc08c44.dynamic.kabel-deutschland.de. [188.192.140.68]) by smtp.gmail.com with ESMTPSA id t14sm6002395wmi.16.2019.04.19.16.50.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Apr 2019 16:50:02 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 20 Apr 2019 01:40:57 +0200 Message-Id: <20190419234110.32980-2-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190419234110.32980-1-andreas.rheinhardt@gmail.com> References: <20190402133305.3328-1-andreas.rheinhardt@googlemail.com> <20190419234110.32980-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 02/15] avformat/matroskaenc: Fix BlockGroup size calculation 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" The earlier code included the size of the BlockGroup's length field and the EBML ID in the calculation of the size for the payload and ignored the size of the duration's length field. This meant that Blockgroups corresponding to packets with size 2^(7n) - 17 - n - i, i = 0,..., n - 1, n = 1,..., 8 (i.e. 110, 16364, 16365, 2097130..2097132, ...) were written with length fields that are unnecessarily long. Signed-off-by: Andreas Rheinhardt --- libavformat/matroskaenc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index c006cbf35c..1849ae3333 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -2059,9 +2059,7 @@ static int mkv_blockgroup_size(int pkt_size) int size = pkt_size + 4; size += ebml_num_size(size); size += 2; // EBML ID for block and block duration - size += 8; // max size of block duration - size += ebml_num_size(size); - size += 1; // blockgroup EBML ID + size += 9; // max size of block duration incl. length field return size; }