From patchwork Sun May 16 08:59:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongcheng Zhong X-Patchwork-Id: 27790 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:b214:0:0:0:0:0 with SMTP id b20csp1892615iof; Sun, 16 May 2021 02:00:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLBl12FYyFQvmhoJKyPHDcB3cHIq5f2YM/fN5xXCOzd10dAmm9JSAF8/oPTY5ekKU6XgWG X-Received: by 2002:a17:906:b794:: with SMTP id dt20mr22849677ejb.59.1621155601130; Sun, 16 May 2021 02:00:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621155601; cv=none; d=google.com; s=arc-20160816; b=NeSj4dJIyelqEvC4KducWACIo2JDviCIZCnK1SlWUpEV0gapXh8Auyqhq8nTsCAKfA lWIfs4IT3lK0P9VmAV6VSvK6r8sHHzKWo+4hGK8WZtn+me1Hl2WxjGfNxDqkGUcQWpnK qk6F76KvHw32tk2AWfw/Y8sD/KCvci3TyRhoQLjQxRaK43XvHTMnQb7Dvdo7yGLIzN65 yZzw6IgFG7FD92CO2/YANq0M/sZbGbDJ2vEqYeV1zYoK+1fH0r07IY/5u6OyYHfFXWIB 2tFTB623OGR8AhS899qIxI+CKQ3g144tBNDYjAmPrDivS0+3suNCIjADMAPYogf/28YR h9AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc: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; bh=WrF50wjgZfLfWJWbHGMgmY8FhMtl/P6MIEnL/R8FMNY=; b=qlggmwrXScD0UkKue+hEOYhTNRUAc7bk002O1P8RZIMKTfbb4ZzKqrQh8EAXSGtLnb bOlW8pivm6nixhWRqIIfwf8rsYhyihat/szVE3EpB/NWJuLFRqQtsjQRq0vVLfJHboD4 Ca4uerb1sw80MLI+xd5pwHc4MaxR7Lf2eaHf6fWgGtopi6g/XCHr9Fc/+S44sM0ghpzw cmyLpOqfHiUVRTzap1+Zm/7hJdjBwd1W5dntq6xEPbdVwCGhWTon/8ZuULe81LI9d4Sd ROKx/dgG5KPUfpjhncSJ49lvv30OpHW5c46+R1K4hPC1DbNT/IPvDjM0Qe06AmTOY8oN MeWg== 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 do16si10579687ejc.105.2021.05.16.02.00.00; Sun, 16 May 2021 02:00:01 -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 4FAF0689248; Sun, 16 May 2021 11:59:56 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtp181.sjtu.edu.cn (smtp181.sjtu.edu.cn [202.120.2.181]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EFF5D6804AE for ; Sun, 16 May 2021 11:59:48 +0300 (EEST) Received: from proxy02.sjtu.edu.cn (smtp188.sjtu.edu.cn [202.120.2.188]) by smtp181.sjtu.edu.cn (Postfix) with ESMTPS id 75E141008CBC1; Sun, 16 May 2021 16:59:44 +0800 (CST) Received: from localhost (localhost.localdomain [127.0.0.1]) by proxy02.sjtu.edu.cn (Postfix) with ESMTP id 7D93C200BE6F3; Sun, 16 May 2021 16:59:44 +0800 (CST) X-Virus-Scanned: amavisd-new at Received: from proxy02.sjtu.edu.cn ([127.0.0.1]) by localhost (proxy02.sjtu.edu.cn [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id TpX3P_rNilsw; Sun, 16 May 2021 16:59:44 +0800 (CST) Received: from localhost.localdomain (unknown [202.120.39.204]) (Authenticated sender: sj.hc_Zhong@sjtu.edu.cn) by proxy02.sjtu.edu.cn (Postfix) with ESMTPSA id B004A200BE6E5; Sun, 16 May 2021 16:59:42 +0800 (CST) From: Hongcheng Zhong To: ffmpeg-devel@ffmpeg.org Date: Sun, 16 May 2021 16:59:39 +0800 Message-Id: <20210516085939.605268-1-sj.hc_Zhong@sjtu.edu.cn> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/1] avformat/hlsenc: Fix bug on start_pts X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: spartazhc Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: a6ieXtg0ukwm From: spartazhc This patch fixes Bug #9237 In some bitstream, pts of some video packet can be N/A, which will set start_pts to AV_NOPTS_VALUE. Adding an if condition can fix it. Signed-off-by: spartazhc --- libavformat/hlsenc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 5db7a744b4..fd265d0ffd 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -2446,7 +2446,8 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt) if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) vs->start_pts_from_audio = 1; } - if (vs->start_pts_from_audio && st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && vs->start_pts > pkt->pts) { + if (vs->start_pts_from_audio && st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO + && vs->start_pts > pkt->pts && pkt->pts != AV_NOPTS_VALUE) { vs->start_pts = pkt->pts; vs->start_pts_from_audio = 0; }