From patchwork Fri Sep 29 15:54:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stebbins X-Patchwork-Id: 5342 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.61.197 with SMTP id n188csp928988jan; Fri, 29 Sep 2017 08:54:20 -0700 (PDT) X-Google-Smtp-Source: AOwi7QAZ6D1yWBJs05RrWbo1tVzOTyxNtAdfkUG7fr9ffoqMUM0d4MJffpwCgUenB8eQf5XgXJMA X-Received: by 10.28.153.206 with SMTP id b197mr5165460wme.60.1506700460755; Fri, 29 Sep 2017 08:54:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506700460; cv=none; d=google.com; s=arc-20160816; b=mU2SRJHUy99YAeThDeojV16b2IT3EfqkK1rTnUH9+/iIfnew2U5Mcz52nEj/eLloyU 05oDGLp0f97MZgm2eYqQ79WJWtS+vT7VpDIlsYS0pt2vDVAgzYoTYE885BpQM+WgPIVG s4omY7EcvPG0Jr3X3Hx7hIgcWaq2f74/m8RCiZczQaqtGQwFg1/jzImjVLBnOCAwfbmI T8mfUPr4D3Lv/azIgtpc8gCUbFyupvPsrBIeXMH2ogATcM8/0VXl0UWmcdf8+8Uzoxrq 3JzO/NWdW9GuMbsEVBl42e2YTYlvB5RnNU5imNl9LrSRFrq6jdsF5ITbQSD1p1aS91qb WPtg== 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=dEtHGZHOXfuS0LaxZaVqU1dMm6eyhE1ZewVqZFDOceE=; b=lNlULOhwXbDTiujvuUfMEt/Zw62hUN7E+q2UpzbsSot8nrkxwXdfifEFrfCHMEIRs1 XPxpws9C/FQFfwPgbeW6A5Gq6CHBL3hxyPSvSc6deS9n87kEsPzPNEF6R/GPeYYXyzxW NSpU+wtvgSkOLoy/aTXyyPzWHVGBWq2a10fl7Tsp+5l6PKyo5tHa5gsASC/WWg1LkQDQ 1ChPHFlHk1uICqrIwIO9gwC95Kb3JsTjQ0XUUXPwFqjZTDJS2m63pczQUAmkvTEo1xOa LMzLaqIUBPv2PwJe7ep25yrqknhOl9mESd2VO7V0JkabXhTmBlgnUhI7MRc0Sbv3tsgZ V7SQ== 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 21si1439954wmr.94.2017.09.29.08.54.20; Fri, 29 Sep 2017 08:54:20 -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 EB78C6898EB; Fri, 29 Sep 2017 18:54:05 +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 A1FA46882B3 for ; Fri, 29 Sep 2017 18:53:58 +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; Fri, 29 Sep 2017 08:54:10 -0700 Received: from dionysus.jetheaddev.com (localhost [127.0.0.1]) by dionysus.jetheaddev.com (8.15.2/8.14.7) with ESMTP id v8TFsAEU008046 for ; Fri, 29 Sep 2017 08:54:10 -0700 Received: (from jstebbins@localhost) by dionysus.jetheaddev.com (8.15.2/8.15.2/Submit) id v8TFs9Mi008045 for ffmpeg-devel@ffmpeg.org; Fri, 29 Sep 2017 08:54:09 -0700 From: John Stebbins To: Date: Fri, 29 Sep 2017 08:54:08 -0700 Message-ID: <20170929155409.8000-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 1/2] 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 899690d920..c7422cd9ed 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -4340,8 +4340,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 ?