From patchwork Thu Sep 5 20:16:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 14935 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 15D7744879C for ; Thu, 5 Sep 2019 23:24:18 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 053FE687F2A; Thu, 5 Sep 2019 23:24:18 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 26C98680468 for ; Thu, 5 Sep 2019 23:24:11 +0300 (EEST) Received: by mail-wm1-f66.google.com with SMTP id o184so4555854wme.3 for ; Thu, 05 Sep 2019 13:24:11 -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=O6J956DU5q/+gH8EPlwpgFzzgGr/R0PId/8I4wMU/qU=; b=p9YdniJERVwfluIHRozLjV6oOnSlF3p+WWpkfG1oPR9kmZs6ZGyPYg0SQvUKasZPSc 355tgSPrCcPEuHWhd4vaiXd9kJVxihHMHwC6Jla+afXRkRylvdHqtzvnX/jnOO8lCJ9H F9lAbovIxlUvx80wBcp93CHO0n+K81MKdD1bqFBBy7m7/onqmPlMT1/wwyAXkZiDoeS8 kBI4oqQTzjxmFafdxtYvcxsPSKVT38GBRL/8BmMgZOChtL70qnwTAYvIyZIN+U8oLs7s 0fJeSozkIjM2AEh+HnHibLZgX49KDgLeqA6rWU0L6r47kaaZdxLm5qoicWTd/kZ6edWl EdLg== 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=O6J956DU5q/+gH8EPlwpgFzzgGr/R0PId/8I4wMU/qU=; b=l77xowbTWXO7klMMI9jQ3bjV8o+4mqLgrLa8qvGr4f9L8nyMRwSsxSEhwaL+/jG86v czzYS2cvAzcJHA1GBXX0qivNocBTlDlVx4PHgWmKHnlit4XjAVQC+8c+ZLZllHrQp4Ne 4s65ktRcJ2UzYdByELLnqGxm/bH/1in5Ev8AovEZh5PTASEdG0t3uox1RLo4VRoFvY7d orTC5f12ttu+YeV0FYxvIlHp7peZo6CO4QCC/thwrRWaizBkadVWWDwHV0LGNLGdl066 P2ecYEoLhnKaQLEs1erhovyHChJfmXJakcL3/n9CtxKpEzD1spZ2yVHItfJC8kbQs7+r pHkA== X-Gm-Message-State: APjAAAXqh2vz3yXXcOxQgHyqOcYf+cpwa0MwexEXLW/TKOti51W9sbHX fUTzVWYnbTMo36Q8xEY+rEsOJuEF/1s= X-Google-Smtp-Source: APXvYqzJLHm8nEp8HRxREGl1N3H2Ywg2evl6+sKMX2SN/t+dyM3795/PRfBDDDA1u05ps+kMwNIZDA== X-Received: by 2002:a1c:a713:: with SMTP id q19mr4624787wme.127.1567715050389; Thu, 05 Sep 2019 13:24:10 -0700 (PDT) Received: from localhost.localdomain (ipbcc0f857.dynamic.kabel-deutschland.de. [188.192.248.87]) by smtp.gmail.com with ESMTPSA id g201sm5889769wmg.34.2019.09.05.13.24.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Sep 2019 13:24:09 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 5 Sep 2019 22:16:08 +0200 Message-Id: <20190905201609.998-7-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190905201609.998-1-andreas.rheinhardt@gmail.com> References: <20190905201609.998-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 7/8] avformat/matroskadec: Use already parsed cues if available 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 WebM Dash specification [1] contains a requirement that a SeekHead that references the Cues is mandatory if the Cues are after the Clusters. There is no such requirement in case the Cues appear before the Clusters. Yet webm_dash_manifest_cues contained such an implicit requirement: If it couldn't find an entry for Cues in the SeekHead, it concluded that there were no Cues at all and returned an error. This has been fixed: Now the list of all level 1 elements is searched for Cues and said list contains already encountered Cues regardless of whether they are referenced by a SeekHead. [1]: http://wiki.webmproject.org/adaptive-streaming/webm-dash-specification Signed-off-by: Andreas Rheinhardt --- libavformat/matroskadec.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 075ed63f00..10df4cce45 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -4106,22 +4106,21 @@ static int64_t webm_dash_manifest_compute_bandwidth(AVFormatContext *s, int64_t static int webm_dash_manifest_cues(AVFormatContext *s, int64_t init_range) { MatroskaDemuxContext *matroska = s->priv_data; - EbmlList *seekhead_list = &matroska->seekhead; - MatroskaSeekhead *seekhead = seekhead_list->elem; + MatroskaLevel1Element *elem = matroska->level1_elems; char *buf; int64_t cues_start = -1, cues_end = -1, before_pos, bandwidth; int i; int end = 0; // determine cues start and end positions - for (i = 0; i < seekhead_list->nb_elem; i++) - if (seekhead[i].id == MATROSKA_ID_CUES) + for (i = 0; i < matroska->num_level1_elems; i++) + if (elem[i].id == MATROSKA_ID_CUES) break; - if (i >= seekhead_list->nb_elem) return -1; + if (i >= matroska->num_level1_elems) return -1; before_pos = avio_tell(matroska->ctx->pb); - cues_start = seekhead[i].pos + matroska->segment_start; + cues_start = elem[i].pos; if (avio_seek(matroska->ctx->pb, cues_start, SEEK_SET) == cues_start) { // cues_end is computed as cues_start + cues_length + length of the // Cues element ID (i.e. 4) + EBML length of the Cues element.