From patchwork Mon Oct 16 21:22:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dale Curtis X-Patchwork-Id: 5591 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.90 with SMTP id m26csp4159193jah; Mon, 16 Oct 2017 14:23:16 -0700 (PDT) X-Received: by 10.223.134.212 with SMTP id 20mr1566092wry.81.1508188996735; Mon, 16 Oct 2017 14:23:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508188996; cv=none; d=google.com; s=arc-20160816; b=fSVh2yMP4rpo8UccXE++Hby0SOh8N/4eC6NdZRyGiLY0OE5R5YNR36uLDlODG7vzQ4 kDR18ei3eDAPiCwJg3dFJKJO2s6+MS2ZaODI8fPFar4Xs3U/IIyRPmFWy/hYWN+XBxas ZeZDoGvSvjFIRnjacUdAAFWjt3fqg/4lhTJzffD55KhzOXN7ozo4j0W0A8OBr4MN4h5M gz7B8eltJA2FihZWWYlv1jVok8gNek5xUm65CQoh260IIblS02JTVEs4rfm6KP4NDg0h NoP/L0AA/72i+yREew2efVmNyTpgXKL1HN1D//ZyfJ6t6EJTtosY+xytgWpzF63YAFJR npGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:to :message-id:date:from:mime-version:dkim-signature:dkim-signature :delivered-to:arc-authentication-results; bh=JHKHWZBqA3iM1iHKdHaVccEicR3yKJe610qjlp+KSD0=; b=FS5761hwh6H7kZHIAp2F2VUo+Xneh2qz5vbPnVYN17bapAHAhs5RJVIBaR/DzGvr9Z 87JvJaqL74IAkEWUe86PhLPa5emIZv7GqO9SvAE1AjHccbU4bsLVdDW46adBTfr6zc3u oyyNaOTGDTq11JXBrhXwIKyi0jIFaWm8T/URm+oOZpsedvOT31y2C98ds+94KwnsniF6 NSHnLATyS5HP3dYaEIVyijGetuxn3jgf3bRGEWYhUPt3iDW1kG2ImnHxaoBa1qSQPMCd LNc5J3OCuxR7bGPudp6gWuYX3mCdO4D7Y21/YqM63uBJ0m5RBw8qXmf8Jbie7TIlR1RL eL2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@google.com header.s=20161025 header.b=vu7LaokL; dkim=neutral (body hash did not verify) header.i=@chromium.org header.s=google header.b=naHsTrJ4; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id m134si5904411wmg.7.2017.10.16.14.23.15; Mon, 16 Oct 2017 14:23:16 -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; dkim=neutral (body hash did not verify) header.i=@google.com header.s=20161025 header.b=vu7LaokL; dkim=neutral (body hash did not verify) header.i=@chromium.org header.s=google header.b=naHsTrJ4; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1DB9B689F03; Tue, 17 Oct 2017 00:23:10 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr0-f172.google.com (mail-wr0-f172.google.com [209.85.128.172]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8F17F689D8E for ; Tue, 17 Oct 2017 00:23:03 +0300 (EEST) Received: by mail-wr0-f172.google.com with SMTP id y44so4275862wry.10 for ; Mon, 16 Oct 2017 14:23:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:sender:from:date:message-id:subject:to:cc; bh=U0o0yQXXUgUkcbpdTo37/cxDzJXPdbrHCwxAXywSRyc=; b=vu7LaokL/jIRttZqDDkAsfT2IYUOPONDO+KxTohsMNI1jdDtEkbYydQ9sJHLvomFj+ AWB4Sh3kyiqPWTK9cHMWxQEImII9tCxigO5eO0cRIwF1sNxHwjuiGSOKrRtAE3yur6DS kjk55tgv3WlAxyRi3EZRBDhcfIwN7On0aGT8FLxx0FoVjUXqElglL2TPuyf5r5XgQePb 7uSOqIgo/RbBGEIjI/wefv8Wf6Kcm+0w685dO6p6n0AFqQBRbbJxrIoPB3XIdaVXKYKN Vjy3ljH7WEcbrDnuAN03Vf/9ygqF6W8biGjgQ4YTHFWstmkKtY6EWsLMcHpNx4BpwOV5 BoSA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:sender:from:date:message-id:subject:to:cc; bh=U0o0yQXXUgUkcbpdTo37/cxDzJXPdbrHCwxAXywSRyc=; b=naHsTrJ45zLrd9kcN2nbYqok83KCSxn0KC5erxmbslbJiR3t1y4ptmkQ8pRTZfrlF5 hFZdY9LXZnrlXvtL8B3KeoO+h1TEfnr3U8m0LFta4Pq3JTrksWvTm2B6JQhI9l6Yn2rW 7QbkmOcHHyw3MDmOFktlHI5TuR0ATzwEmklwU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:from:date:message-id:subject :to:cc; bh=U0o0yQXXUgUkcbpdTo37/cxDzJXPdbrHCwxAXywSRyc=; b=tZ2bAEjCxrmaujm2NFNaXvGazIFfBW+QZWcrNyPS+XPj+ZsZ3DNOrdFUapgnOuS9Yn ScUVTlYqLlbk8LMmwj2clJ5l1QffGqj4bRQO5N/1PAT8g42z64BW7DfRiTSlC1cCEI9Q 7Q2DLw2Wun26n6vi9MCVvAHnKZwS3wS7ISRe792/MGa2EGScMO/qN+qS3PzAghGxH6Gi AJtJS6G4sLNwoYCiiy0PtGYYN1Ixt1qjTmDSoiR5Nx0RsrK30PCaSDlR0d69zZ3WuUdi usJLwzWa/G8vlfdVWIab4UDCxPsZdoM20Eq37LKS9Nb4vyq1RdC1HdkECWEERkm0Cy/O dYFw== X-Gm-Message-State: AMCzsaUbWAjNsdb3yHFtYO8JxcBAW05ZIi904Rpl86urZaMok5koT47J qxvJlwEYN19D9gIFnCIijcTlLqKSYjSB2tukmzUCFdJwtd4= X-Google-Smtp-Source: ABhQp+Q0wul4sazUtDEUFoSD+fmyisS/dbt7o8zdLn+CPU51vPKQnF78khwDQ9WInsJbmto2HfZIRgE9vG7gF4dchhw= X-Received: by 10.223.160.233 with SMTP id n38mr1866066wrn.177.1508188986993; Mon, 16 Oct 2017 14:23:06 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.51.80 with HTTP; Mon, 16 Oct 2017 14:22:45 -0700 (PDT) From: Dale Curtis Date: Mon, 16 Oct 2017 14:22:45 -0700 X-Google-Sender-Auth: OS2l592HXeY3xWCGM65OI0RO-cs Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.20 Subject: [FFmpeg-devel] [mov] When both edit list and start padding present, take maximum. 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: Sasi Inguva Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Previously the start padding was used to blindly overwrite any skip samples which may have come from an edit list. Instead take the maximum of the two. A new fate test is added, fate-mov-440hz-10ms, to ensure this is handled correctly. The sample can be downloaded and added to the fate-suite from https://cs.chromium.org/chromium/src/third_party/WebKit/LayoutTests/webaudio/resources/media/440hz-10ms.m4a - dale From 4d241904bc9f923f3c9cd93f19daae08bafbdae1 Mon Sep 17 00:00:00 2001 From: Dale Curtis Date: Mon, 16 Oct 2017 14:17:35 -0700 Subject: [PATCH] [mov] When both edit list and start padding present, take maximum. Previously the start padding was used to blindly overwrite any skip samples which may have come from an edit list. Instead take the maximum of the two. A new fate test is added, fate-mov-440hz-10ms, to ensure this is handled correctly. Signed-off-by: Dale Curtis --- libavformat/mov.c | 3 ++- tests/fate/mov.mak | 4 ++++ tests/ref/fate/mov-440hz-10ms | 11 +++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 tests/ref/fate/mov-440hz-10ms diff --git a/libavformat/mov.c b/libavformat/mov.c index 899690d920..097f6a20dc 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -6244,7 +6244,8 @@ static int mov_read_header(AVFormatContext *s) MOVStreamContext *sc = st->priv_data; fix_timescale(mov, sc); if(st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && st->codecpar->codec_id == AV_CODEC_ID_AAC) { - st->skip_samples = sc->start_pad; + /* skip samples may have already been injected by an edit list. */ + st->skip_samples = FFMAX(st->skip_samples, sc->start_pad); } if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && sc->nb_frames_for_fps > 0 && sc->duration_for_fps > 0) av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den, diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak index cfdada7a2e..5013e7d528 100644 --- a/tests/fate/mov.mak +++ b/tests/fate/mov.mak @@ -7,6 +7,7 @@ FATE_MOV = fate-mov-3elist \ fate-mov-2elist-elist1-ends-bframe \ fate-mov-3elist-encrypted \ fate-mov-gpmf-remux \ + fate-mov-440hz-10ms \ FATE_MOV_FFPROBE = fate-mov-aac-2048-priming \ fate-mov-zombie \ @@ -39,6 +40,9 @@ fate-mov-1elist-ends-last-bframe: CMD = framemd5 -i $(TARGET_SAMPLES)/mov/mov-1e # Makes sure that we handle timestamps of packets in case of multiple edit lists with one of them ending on a B-frame correctly. fate-mov-2elist-elist1-ends-bframe: CMD = framemd5 -i $(TARGET_SAMPLES)/mov/mov-2elist-elist1-ends-bframe.mov +# Makes sure that we handle edit lists and start padding correctly. +fate-mov-440hz-10ms: CMD = framemd5 -i $(TARGET_SAMPLES)/mov/440hz-10ms.m4a + fate-mov-aac-2048-priming: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_packets -print_format compact $(TARGET_SAMPLES)/mov/aac-2048-priming.mov fate-mov-zombie: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_streams -show_packets -show_frames -bitexact -print_format compact $(TARGET_SAMPLES)/mov/white_zombie_scrunch-part.mov diff --git a/tests/ref/fate/mov-440hz-10ms b/tests/ref/fate/mov-440hz-10ms new file mode 100644 index 0000000000..498879e52d --- /dev/null +++ b/tests/ref/fate/mov-440hz-10ms @@ -0,0 +1,11 @@ +#format: frame checksums +#version: 2 +#hash: MD5 +#tb 0: 1/44100 +#media_type 0: audio +#codec_id 0: pcm_s16le +#sample_rate 0: 44100 +#channel_layout 0: 4 +#channel_layout_name 0: mono +#stream#, dts, pts, duration, size, hash +0, 0, 0, 960, 1920, 44e7e48ff08835ce30e93c7971dae7df -- 2.15.0.rc0.271.g36b669edcc-goog