From patchwork Mon Sep 25 17:10:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stebbins X-Patchwork-Id: 5262 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.36.26 with SMTP id f26csp2853315jaa; Mon, 25 Sep 2017 10:11:10 -0700 (PDT) X-Google-Smtp-Source: AOwi7QBIQ6lqwZw2oHzb0JEeJF1P7D8XQ1KsAKtad4+zTJXJnSE5YeZsqTmehev5+/fdzEyRLhkN X-Received: by 10.28.73.134 with SMTP id w128mr833336wma.141.1506359470377; Mon, 25 Sep 2017 10:11:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506359470; cv=none; d=google.com; s=arc-20160816; b=y4tGLv+uLdZdpYy2XGpOgsUVBs7gLORvzQomUp+V8OBMSwrD9VZT0hyAcw98CtV70+ OSmQFU1/wM3Z6toIqH/ViXxfnVpqZPcsjL5hjFbjg0kl1f4wpMuUsxNXd4d8ijxpRS2e GJCTIrjTeAKlgtveSIIqw9geZyjvFpxWWdMjSZz5qY5rt/gBLtVWWkzbHtJrUxU38IRt kEjbT/wkE+KLu1F2LyU9c11YOMNaPOUFjhy40dktkIPZMoWs6y9SW35G4NwlbYiwNOfO 6cZVsqwuQGBCRGgMuURudkcWaZ1+E65L67dRdirVLbn2fEMC6tK+i39SlCQCWCg5FSJV /5Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding: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:arc-authentication-results; bh=llhQaHD8pIeoUTGcB8k6ORLKOAD7bVHjr7qyH9qhjBI=; b=X3cbNN0DalL7bXf2pJCSAV8XVE7ELJBPzTm8dv6NXXczT9jCkmoeGFrHvyPxwlpXnI eFKX6Z5Kr0sAu1e2B8UVBor0JZrHZlYdFehSQSI3A+u6alvFaZOSv7jutJwEryB5k4K8 2fviokVTrrrs1YFq1FHce3CU8OR/QpnHQbPfM2sSUiZqYvScnBdwnPxvtpVkSfCYOv/r Pt8z+Djif5Ydw3mUJbI65Wv0GPSblLOggq8RX/liW/NrLqt/SAIO2O8cx0X9m4ZyD7H1 vqoTUbkvv+uzhZTUWUlyD3BCdxaE7yQb6QPcu4tv1mqL8wtsnh2S3JRfUiUoPBWLvzJh w7gg== 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 71si5281124wrl.427.2017.09.25.10.11.09; Mon, 25 Sep 2017 10:11:10 -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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 65570689213; Mon, 25 Sep 2017 20:10:57 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.jetheaddev.com (mail.jetheaddev.com [70.164.99.34]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EABF268835F for ; Mon, 25 Sep 2017 20:10:50 +0300 (EEST) Received: from dionysus.jetheaddev.com (10.13.12.63) by cas.jetheaddev.com (192.168.13.27) with Microsoft SMTP Server (TLS) id 14.3.351.0; Mon, 25 Sep 2017 10:10:58 -0700 Received: from dionysus.jetheaddev.com (localhost [127.0.0.1]) by dionysus.jetheaddev.com (8.15.2/8.14.7) with ESMTP id v8PHAwBs001227 for ; Mon, 25 Sep 2017 10:10:58 -0700 Received: (from jstebbins@localhost) by dionysus.jetheaddev.com (8.15.2/8.15.2/Submit) id v8PHAwqT001226 for ffmpeg-devel@ffmpeg.org; Mon, 25 Sep 2017 10:10:58 -0700 From: John Stebbins To: Date: Mon, 25 Sep 2017 10:10:58 -0700 Message-ID: <20170925171058.1148-1-jstebbins@jetheaddev.com> X-Mailer: git-send-email 2.13.5 MIME-Version: 1.0 X-Originating-IP: [10.13.12.63] Subject: [FFmpeg-devel] [PATCH] mov: fix decode of fragments that overlap in time 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" When keyframe intervals of dash segments are not perfectly aligned, fragments in the stream can overlap in time. Append new "trun" index entries to the end of the index instead of sorting by timestamp. Sorting by timestamp causes packets to be read out of decode order and results in decode errors. --- libavformat/mov.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 2519707345..b2bc7c2c3d 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -4339,8 +4339,8 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom) MOV_FRAG_SAMPLE_FLAG_DEPENDS_YES)); if (keyframe) distance = 0; - ctts_index = av_add_index_entry(st, offset, dts, sample_size, distance, - keyframe ? AVINDEX_KEYFRAME : 0); + ctts_index = add_index_entry(st, offset, dts, sample_size, distance, + keyframe ? AVINDEX_KEYFRAME : 0); if (ctts_index >= 0 && old_nb_index_entries < st->nb_index_entries) { unsigned int size_needed = st->nb_index_entries * sizeof(*sc->ctts_data); unsigned int request_size = size_needed > sc->ctts_allocated_size ?