From patchwork Thu May 11 14:33:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Bouron X-Patchwork-Id: 3649 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.3.129 with SMTP id 123csp676596vsd; Thu, 11 May 2017 05:33:57 -0700 (PDT) X-Received: by 10.28.51.19 with SMTP id z19mr4364383wmz.1.1494506037771; Thu, 11 May 2017 05:33:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1494506037; cv=none; d=google.com; s=arc-20160816; b=tXQFjEyeBI31tpRXDTEMaLle05UJ2DQOzVI/ZX/w4P7zhqtbNyoKbI2yZFxVdJ4pJ4 bR4okRPsv6fDC18VjOxutiKZPWMpyp9uzr28u71QJ5QOxpvoY7bE/19yG9Pzp9h8+dOe TcbIhbC/TFEbS+lb7jR6LxunHs2l8P49cX2MK8FKZizq3f8zO+HD+MfARPA3Qcil3b7H 7wDKmGEtIOLSMKmFsvPMvYe7QYck0vz+SZwMpqgfgHZWNMJAxm4Yoddlm6WK1E6l9Duv yy8zQLcCe1NbtVxaVIPjaQ0pEAxBkhRG0C/1O7JoFbn0kjL/WMm0P+6McD//iFBh7Tj6 rMGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=PGuuF2KtZDLd48fyeyLfoAt3zF12uys4vOAMN6LtAu4=; b=0wVGlt+VIt54ZHNdq64fCgmcBQu/g/gjjqSUw8EC/pX+b8GPhc8UmnJs/bmZJGr4LS rW41mKJaWOACCLU2zjo9znh8J58CSkFTV3H98mAp71kXGZ4CM0n8SMKafx9TB9wfBJyt Z5mj+ARHt0o8e0QlmxBjKG+lL0oGNh6uIg/ve+kZ8VP09G4+0GQ830pNs8R+ec8RwBiK l6Dhe8MmmqxRB+yz3mOQ7klcD0K1qTt0PdCDwDcOQSwQBREaGVbrbjehmUjGlJNTXGFP WS7J707tdIJJHly2GKPbXPUtas4WXMRaETMY2wTwyP5I9taMv6sHckAdnCAapV2Fafjj 92cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id y20si39965wrd.81.2017.05.11.05.33.57; Thu, 11 May 2017 05:33:57 -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=@gmail.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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 981466898A8; Thu, 11 May 2017 15:33:47 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 179356883D2 for ; Thu, 11 May 2017 15:33:41 +0300 (EEST) Received: by mail-wm0-f65.google.com with SMTP id y10so6702500wmh.0 for ; Thu, 11 May 2017 05:33:48 -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; bh=miZE9mlOhJso/tGa6BKegFIH0h8KK2K1jnZ2oWXxPzQ=; b=gweB16I36DCfzwaB+T8BYIhrpL3AvO65j2RW1F2uIu3Fnyoum1zTP+57CQAQmkQ7Ee o72UTkvuI/9BljehEo2C8K7rQR9VSglo73Y7Ii8IHF0tkOfGFWZdEB+KCP77cpCVeVhw Z6v1GvUMtvm0qC7LM60iyLhJgOB/xoL8dCmjXqn6IUflEHbnJ0yjM5opPQUYer9l4fO5 DFx1FMsMrWJ5kTG1fkkwlVpaLiem4BPmIMirOvB7VvDX3r6WPzvaeh7tLn9GxXGczTAR niktiBXulri8u8DIuYpEDMcUTVY9ojNCN4bF1lUiYsLq1+2wn8ccALDnbByqY2gqkHRz qikQ== 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; bh=miZE9mlOhJso/tGa6BKegFIH0h8KK2K1jnZ2oWXxPzQ=; b=SdENXceXIDHaXkcC81BMgBWu80UjnADJA+QlxIyxAL2yAXZOyIvk9yamfIYTJaGTVM W3BrJigfU6yowgx8VCef3gR2NtIJbfNTI7crLWkYcRSa2d/rEfMusw2cnvFBCh/9GVye RmGBcNGUSvFcnsf0C1b4e7fp3J6gCe2CgjddlJukk/PCyapcYOjDuZ2wnLVCaOxyXYJN NijKfwZ7pKRpI1ZZUMsY0M4uHwtSuXPr0XbSOcUJ3FZVMsgKF9keu4MqxT91F4mBt+Yo 1kPNBp1kuSF1Qd9GofuZZqJ1Q/+sEE2NBInrpwW8tA4Ar6Zg1F0ugHUWqGsyx98VdaE5 woWQ== X-Gm-Message-State: AODbwcBNTzmIweOEb9KlUUfXyP/HMyZh0LNNeGRm4z0Ov/TpNSNSe2Jm yNQK67IETh+SdA== X-Received: by 10.28.199.10 with SMTP id x10mr5012203wmf.83.1494506028052; Thu, 11 May 2017 05:33:48 -0700 (PDT) Received: from boken.gopro.lcl (LPuteaux-656-1-74-135.w80-12.abo.wanadoo.fr. [80.12.80.135]) by smtp.gmail.com with ESMTPSA id m127sm1050412wmb.10.2017.05.11.05.33.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 May 2017 05:33:47 -0700 (PDT) From: Matthieu Bouron To: ffmpeg-devel@ffmpeg.org Date: Thu, 11 May 2017 16:33:50 +0200 Message-Id: <20170511143350.2782-1-matthieu.bouron@gmail.com> X-Mailer: git-send-email 2.12.2 Subject: [FFmpeg-devel] [PATCH] lavf/mov: make invalid mdhd time_scale default to 1 instead of erroring out 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: Matthieu Bouron MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Some samples have their metadata track time_scale incorrectly set to 0 and the check introduced by a398f054fdb9b0f0b5a91c231fba6ce014143f71 prevents playback of those samples. Setting the time_scale to 1 fixes playback. --- libavformat/mov.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index afef53b79a..3c8b75ddb3 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1236,8 +1236,8 @@ static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) sc->time_scale = avio_rb32(pb); if (sc->time_scale <= 0) { - av_log(c->fc, AV_LOG_ERROR, "Invalid mdhd time scale %d\n", sc->time_scale); - return AVERROR_INVALIDDATA; + av_log(c->fc, AV_LOG_ERROR, "Invalid mdhd time scale %d, defaulting to 1\n", sc->time_scale); + sc->time_scale = 1; } st->duration = (version == 1) ? avio_rb64(pb) : avio_rb32(pb); /* duration */