From patchwork Tue Oct 10 17:36:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasi Inguva X-Patchwork-Id: 5517 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.90 with SMTP id m26csp4099865jah; Tue, 10 Oct 2017 10:37:42 -0700 (PDT) X-Received: by 10.28.69.91 with SMTP id s88mr11235560wma.19.1507657062304; Tue, 10 Oct 2017 10:37:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507657062; cv=none; d=google.com; s=arc-20160816; b=oSPCzKdB0pIbUM1zGM4/6ZvrNeI+BjLNueLf7G4UYSFE0zUlDoaAcLXEVblnDcZutq t62F85FT930ZvkrLdcIpnMkRtd8/BqXqcXSBdIHOebLrLx2Vj/7uxwH/PR6eAnR9rpb/ M5fLwiQGFPFy3KN7hI2h1oD8hWwTqhM/0pu7QbPNb+yqfjJc4o1IiVSSBLH+Svut5SOg ndDvS0Vcc3SrRpeik5icVmfAkRxf4hGvIbon1UJfDc/jNSjfsviThGAAT1mUfhSI7F9F 0wP0sWeuwDxBv5cLi9MgbJv+Vi3sKmrb+AFHlF+tQzB1yoqRkccE7anVLakT0rSxSER+ z/JA== 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:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=LeATjhBtVu4cM5IKGMuGJXRVU4a5JMNzVRmghYdWyg8=; b=JUzVISe9IkFD/ZHzgGPLomKtso6evaAbd7A4N46UBQlv1nc+LDtxXzIaLLG9CmV78d 1VzH9pr+w5x/hkx7EErlrlFewltGu2gSGTkTByvKR5loYqptBnMVnR877WgUW04YHdsC ER80fshqvdjJTO/CqcFCcMjCrASv1d4hxs60+PQdJwyP+3+U5oDlBM3M4ojB3OqzeDBn 2E+rn6ER+Kyb1LCLq0m+Oy9kQv2sRItRWJcuGapj9vl5x+1ox3TnjFmbgI477+D+qk6b gfMKY+Vc+oTliXG3FDon/Kiff3PLVetgvvJjCcJQ5hS1c9ufY3HOv2yu0P62x7zNdYWS rwEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@google.com header.s=20161025 header.b=pyZ6trCx; 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 f2si9675942wrg.341.2017.10.10.10.37.41; Tue, 10 Oct 2017 10:37:42 -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=pyZ6trCx; 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 5FCB46897C1; Tue, 10 Oct 2017 20:37:36 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf0-f178.google.com (mail-pf0-f178.google.com [209.85.192.178]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EFECF689753 for ; Tue, 10 Oct 2017 20:37:29 +0300 (EEST) Received: by mail-pf0-f178.google.com with SMTP id a1so14724229pfj.9 for ; Tue, 10 Oct 2017 10:37:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OPlvFf7w11h4DYvK2OxuRGAzPGAk0alSYTj+eV1ePWs=; b=pyZ6trCx/6JLVJasAMSWXy6LjS2E3F2o8PxFali6/se9GgeVVSg8/T3XoOxBLnStEY VZ0QZsIzhD6ZnDqrSRcYtWIUmCNRIhSgWc6pbpa8CcxKOXoYF1szv29TfwhxqS3Qa/rN +gw7hNPSBvypT19u9rdKIRG5ih5A1Rw7y6eCs1y9N0nBDFtkvrRz4oXfsu8ukguoZHLC xkHgceJ80IfNn0mFOJjeQxsfehbMN3FbdJKPrzQi/xXEq+Ni15NP9bfYvwdzv1jm1AHb XYDsxFiLQeQRGKY6xN1oFS5lxqEhM5W7xFh7Y4bBzN8S37RUlecxz/WaMIeIbqA+Iacc XJRw== 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; bh=OPlvFf7w11h4DYvK2OxuRGAzPGAk0alSYTj+eV1ePWs=; b=DWtmRPIE4j8HbQtaPEIkPhqCOh6L/wmp9UGg1krh0u08W0r6fwGXF1V7wziBILYtTE jjyaN47X5oXQFz2Wre81NmFbOmduRkbqhQcFsIs0pO44mVGkCbWGye2QJGxxZiXLdzOM R/Ds38Ozdg4ZLpV6aGnXOeqm7lKszXjl5PGRj/u1rnCKn8zTyu83lY8veOfgPj/0+HgB 4xqftM9M+oLV2hK4WWo+yU/0H8KQMcGxBppm7NO0i24JjdjJ+0K1KW7jPZRlfWKIsMph ajOh/sof1y3qe+02Ok97YvUdiHX7kBRLlfdebuXwZTayoOJLS+44mwuryg6XA6mXOghy QmKA== X-Gm-Message-State: AMCzsaUkFZvzpfGz2tQABmRQwFQdu6MVHT9CwSlSpoFUd7pRwpb1CWjd cnfmVj1GjGEgcsHpquSdHTEErYVgpgg= X-Google-Smtp-Source: AOwi7QDALT41xRsQ+3qh1At//DyHs+XZwTPsPC/Vf8KLebAKFykhvFq6DKPK6M0tpt4fBUYabqZ48g== X-Received: by 10.99.95.207 with SMTP id t198mr13051399pgb.145.1507657050067; Tue, 10 Oct 2017 10:37:30 -0700 (PDT) Received: from isasi.mtv.corp.google.com ([172.27.82.28]) by smtp.gmail.com with ESMTPSA id n19sm20817900pfj.52.2017.10.10.10.37.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Oct 2017 10:37:29 -0700 (PDT) From: Sasi Inguva To: ffmpeg-devel@ffmpeg.org Date: Tue, 10 Oct 2017 10:36:58 -0700 Message-Id: <20171010173658.13922-1-isasi@google.com> X-Mailer: git-send-email 2.14.2.920.gcf0c67979c-goog In-Reply-To: References: Subject: [FFmpeg-devel] [PATCH] ffmpeg.c: Fallback to duration_dts, when duration_pts can't be determined. 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This is required for FLV files, for which duration_pts comes out to be zero. Signed-off-by: Sasi Inguva --- fftools/ffmpeg.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 6d64bc1043..3ee31473dc 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -2665,8 +2665,13 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo ist->next_dts = AV_NOPTS_VALUE; } - if (got_output) - ist->next_pts += av_rescale_q(duration_pts, ist->st->time_base, AV_TIME_BASE_Q); + if (got_output) { + if (duration_pts > 0) { + ist->next_pts += av_rescale_q(duration_pts, ist->st->time_base, AV_TIME_BASE_Q); + } else { + ist->next_pts += duration_dts; + } + } break; case AVMEDIA_TYPE_SUBTITLE: if (repeating)