From patchwork Thu Nov 1 09:32:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Nagels X-Patchwork-Id: 10875 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id A0D3E44D2F4 for ; Thu, 1 Nov 2018 11:33:01 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1042D68A892; Thu, 1 Nov 2018 11:32:33 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtp.leaseweb.com (smtp.leaseweb.com [85.17.150.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C5DCE68A67E for ; Thu, 1 Nov 2018 11:32:26 +0200 (EET) Received: from [172.16.0.13] (ip-213-127-181-180.ip.prioritytelecom.net [213.127.181.180]) (Authenticated sender: develop@focusware.nl) by smtp.leaseweb.com (Postfix) with ESMTPSA id 4391260184C for ; Thu, 1 Nov 2018 09:32:58 +0000 (UTC) From: Boris Nagels Mime-Version: 1.0 (Mac OS X Mail 12.1 \(3445.101.1\)) Message-Id: <54CFAA4E-478B-41A4-96EC-C937B4C1CF97@focusware.nl> Date: Thu, 1 Nov 2018 10:32:57 +0100 To: ffmpeg-devel@ffmpeg.org X-Mailer: Apple Mail (2.3445.101.1) Authentication-Results: smtp.leaseweb.com; auth=pass smtp.auth=develop@focusware.nl smtp.mailfrom=develop@focusware.nl X-Spamd-Bar: / Subject: [FFmpeg-devel] [PATCH] libavformat/hlsenc: only initialize the "start_pts" value if the incoming packet is a video packet. 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" The packet type should be checked before the start value is assigned. For example, if the first packet to arrive is an audio packet, the value of start-pts is in the timebase units of the audio stream. This will cause the stream to be split on every I-frame of the video stream since the pts value of the audio stream is typically much smaller than the pts value of the video stream. --- libavformat/hlsenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 902896ef81..85167761b9 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -2201,7 +2201,7 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt) end_pts = init_list_dur + after_init_list_dur ; } - if (vs->start_pts == AV_NOPTS_VALUE) { + if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && vs->start_pts == AV_NOPTS_VALUE) { vs->start_pts = pkt->pts; vs->end_frame = st->nb_frames; }