From patchwork Sun Jul 5 11:34:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongcheng Zhong X-Patchwork-Id: 20818 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 462D544BDAF for ; Sun, 5 Jul 2020 14:35:37 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2F53368B310; Sun, 5 Jul 2020 14:35:37 +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 12355687F9F for ; Sun, 5 Jul 2020 14:35:31 +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 C6EDE1008CBD0; Sun, 5 Jul 2020 19:35:26 +0800 (CST) Received: from localhost (localhost.localdomain [127.0.0.1]) by proxy02.sjtu.edu.cn (Postfix) with ESMTP id BE679200B4497; Sun, 5 Jul 2020 19:35:26 +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 iVj1ZDfCVsCR; Sun, 5 Jul 2020 19:35:26 +0800 (CST) Received: from localhost.localdomain (unknown [10.162.157.92]) (Authenticated sender: sj.hc_Zhong@sjtu.edu.cn) by proxy02.sjtu.edu.cn (Postfix) with ESMTPSA id EC083200B4496; Sun, 5 Jul 2020 19:35:25 +0800 (CST) From: Hongcheng Zhong To: ffmpeg-devel@ffmpeg.org Date: Sun, 5 Jul 2020 19:34:59 +0800 Message-Id: <20200705113459.77467-6-sj.hc_Zhong@sjtu.edu.cn> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200705113459.77467-1-sj.hc_Zhong@sjtu.edu.cn> References: <20200705113459.77467-1-sj.hc_Zhong@sjtu.edu.cn> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] [GSoC 6/6] ffplay: add av_packet_clean to remove AVPackets not needed 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: spartazhc Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: spartazhc hls_read_header will add all streams to s->internal->packet_buffer. Use av_packet_clean to remove the AVPackets from other streams that are not needed, otherwise abr will allow them to be added to ffplay's packet_queue. Signed-off-by: spartazhc --- fftools/ffplay.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fftools/ffplay.c b/fftools/ffplay.c index b17b75fa8f..019dc7f32e 100644 --- a/fftools/ffplay.c +++ b/fftools/ffplay.c @@ -3018,6 +3018,10 @@ static int read_thread(void *arg) /* clean packet list filled in hls_read_header if abr is enabled */ if (abr) { + ret = av_packet_clean(ic, st_index); + if (ret < 0) { + av_log(NULL, AV_LOG_WARNING, "Failed to clean av_packet\n"); + } is->abr_list = av_mallocz(sizeof(ABRList)); ret = abr_init_list(is); if (ret < 0) {