From patchwork Thu Oct 25 06:59:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Fu, Linjie" X-Patchwork-Id: 10776 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 61C3E44BB58 for ; Thu, 25 Oct 2018 09:59:30 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CB64468A580; Thu, 25 Oct 2018 09:59:01 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 367BD68A580 for ; Thu, 25 Oct 2018 09:58:54 +0300 (EEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Oct 2018 23:59:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,423,1534834800"; d="scan'208";a="268630029" Received: from kubernetes-master.sh.intel.com ([10.239.159.155]) by orsmga005.jf.intel.com with ESMTP; 24 Oct 2018 23:59:19 -0700 From: Linjie Fu To: ffmpeg-devel@ffmpeg.org Date: Thu, 25 Oct 2018 14:59:16 +0800 Message-Id: <20181025065916.18008-1-linjie.fu@intel.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avcodec/h264_parser: Skip Redundant Slice Info Attached Behind Frames. 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: Linjie Fu Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Skip redundant slice info attached behind frames (PPS for eaxmple) to parse timestamp correctly and produce the segment format successfully. When PPS info is attached behind frame data whin one PES packet, h264_find_frame_end for PPS slice returns END_NOT_FOUND,and causes the following IDR frame to returning END_NOT_FOUND too. And this leads to the failure of parsing pts and operation of segment. Skip redundant slice info to ensure the h264_parser to find the correct frame_end of following frame, and make sure parse_packet could parse the pts and dts. Fix the pts issue for single segment.ts and the segment format failure issue for http live stream in ticket #7207. Signed-off-by: Linjie Fu --- libavcodec/h264_parser.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c index 5f9a9c46ef..bcc97d6260 100644 --- a/libavcodec/h264_parser.c +++ b/libavcodec/h264_parser.c @@ -577,6 +577,7 @@ static int h264_parse(AVCodecParserContext *s, H264ParseContext *p = s->priv_data; ParseContext *pc = &p->pc; int next; + int input_bufsize = buf_size; if (!p->got_first) { p->got_first = 1; @@ -644,7 +645,10 @@ static int h264_parse(AVCodecParserContext *s, *poutbuf = buf; *poutbuf_size = buf_size; - return next; + if (next > 0 && next