From patchwork Mon Mar 4 17:32:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Gaullier X-Patchwork-Id: 46783 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:d808:b0:19e:cdac:8cce with SMTP id iv8csp139312pzb; Mon, 4 Mar 2024 09:32:45 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV1gKBlocoJ5DZO3Tn6synV9HQKZl41OsI1uTXyaZJxj9T2SugDG2eXEhMBHl1UZDrIw0tXM/gRM8DPk6GZCRY5xncJ//1afyjmfA== X-Google-Smtp-Source: AGHT+IGrK6D2F4EPdLmxJABnLBk5pkTSFTAIVnCn2heHycUg45asDBrnUtU9hXvh8v2/rE6NC9ip X-Received: by 2002:a17:906:4818:b0:a45:2fc4:f25d with SMTP id w24-20020a170906481800b00a452fc4f25dmr2573154ejq.12.1709573565409; Mon, 04 Mar 2024 09:32:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709573565; cv=none; d=google.com; s=arc-20160816; b=motugRdjmteI8XMU8n6B58MSw8fDTMZPgfpyB/rRSWCbqDW239LZoVcNS55SvcH16b jk3sEEI3FxyHGTQFbgeum/ia3mXDHYX6QypYEgr/ynCGl5FjIvGWanXZzJOYM+k0eb92 xEA8K1jRNzpQFlfwAKUGIffzAUv9SSjvPqti6QSwUxS/eDMaoOdIXHZNgRcMcDid3LUM EdjZWOpVLwgan3C1akTiiUNj2mWp7muqxugwPAEiCVQNd9Wb2Fkp+G7JI+J2Lk5bj0JK X9HMS4qhn3sCVxgI1TCJdRhmfnGgcOQfVja7BjxLFewV3L2NGNWkSQ7vxTYAICgC4EUj T3nA== 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:references:in-reply-to :message-id:date:to:from:delivered-to; bh=y0U4RzHmT1U0POGvR0/mOSWwvRz7S7Y/J3bd42+sieA=; fh=zgMS+X4RExv2k7fU8QdWClnqVJdqO/9UbUuBS5xxJDs=; b=O5DZfaZYxfpEzDrQYEJSV5ypJ+jILLIH0hgqgJUpPv2JmGdKSAZE8Juvn1Ea6jwv5j MKUa3PO/gBQUna0ec2iHOpaZ1T8xeZfkpMQrLNr+SbQPz5UNRFDrY2iR0Wfaa+ZLkLww mJ+l7DHQ4ONxnRDpOSo/+Us046AHo67vcNVtKmyksWUbprELSVgEsy4QJVylp/oOVB2j SPIfArbitkbC7Nb4ikigUdH5shXhZun6QhD9S8yeLe69sT3pT/VKRAzwLuBJE8P2E2f/ rxOhrT8skni/pDvocDkXqri7eZ11ldI6ofqjEIdN3TRLYuZc5Pn6rQ2ExDPbRFRm99mL yRyw==; dara=google.com 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 h4-20020a1709063b4400b00a4432e5bd60si4102415ejf.848.2024.03.04.09.32.44; Mon, 04 Mar 2024 09:32:45 -0800 (PST) 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 CDCCB68D113; Mon, 4 Mar 2024 19:32:31 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from srv-infra-2.infra.inf.glb.tvvideoms.com (www.inf.tvvideoms.com [213.205.126.156]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4F4FA68D44E for ; Mon, 4 Mar 2024 19:32:24 +0200 (EET) Received: from cji.paris (unknown [172.16.3.159]) by srv-infra-2.infra.inf.glb.tvvideoms.com (Postfix) with ESMTP id 3389B40526; Mon, 4 Mar 2024 17:32:23 +0000 (UTC) From: Nicolas Gaullier To: ffmpeg-devel@ffmpeg.org Date: Mon, 4 Mar 2024 18:32:15 +0100 Message-Id: <20240304173219.1877658-2-nicolas.gaullier@cji.paris> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240304173219.1877658-1-nicolas.gaullier@cji.paris> References: <20240304173219.1877658-1-nicolas.gaullier@cji.paris> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 1/5] avcodec/parser: merge packets from the same frame 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: Nicolas Gaullier Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: +ke8IV3dUCJP The mpegts demuxer splits packets according to its max_packet_size. This currently fills the AVCodecParserContext s->cur_frame_* arrays with kind of 'empty' entries: no pts/dts. This patch merges these entries, so the parser behaviour is independent from the demuxer settings. This patch is required for the following patch which will fetch 'past' timestamps from past cur_frames. Signed-off-by: Nicolas Gaullier --- libavcodec/parser.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/parser.c b/libavcodec/parser.c index efc28b8918..90461075fd 100644 --- a/libavcodec/parser.c +++ b/libavcodec/parser.c @@ -142,6 +142,8 @@ int av_parser_parse2(AVCodecParserContext *s, AVCodecContext *avctx, memset(dummy_buf, 0, sizeof(dummy_buf)); buf = dummy_buf; } else if (s->cur_offset + buf_size != s->cur_frame_end[s->cur_frame_start_index]) { /* skip remainder packets */ + if (pos != s->cur_frame_pos[s->cur_frame_start_index] || pos <= 0 || + pts != AV_NOPTS_VALUE || dts != AV_NOPTS_VALUE ) { /* add a new packet descriptor */ i = (s->cur_frame_start_index + 1) & (AV_PARSER_PTS_NB - 1); s->cur_frame_start_index = i; @@ -150,6 +152,9 @@ int av_parser_parse2(AVCodecParserContext *s, AVCodecContext *avctx, s->cur_frame_pts[i] = pts; s->cur_frame_dts[i] = dts; s->cur_frame_pos[i] = pos; + } else { + s->cur_frame_end[s->cur_frame_start_index] = s->cur_offset + buf_size; + } } if (s->fetch_timestamp) { From patchwork Mon Mar 4 17:32:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Gaullier X-Patchwork-Id: 46785 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:d808:b0:19e:cdac:8cce with SMTP id iv8csp139559pzb; Mon, 4 Mar 2024 09:33:10 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCW9wvSw3vlfLeQD1YuAtaRPmiA1YXA4VGNjD6P2Zn3AwCBsRGALx6gkA64CIA1xfJg7RgzC9X6KYhGzauV8ZRfPKHdP1gwH+J/B1g== X-Google-Smtp-Source: AGHT+IHda4lRDlviAyfLB+rsmoWV6vi0/Z4lHIL2FzuXg8EQUY5LSS9bAyZAVp0uzqCBxKNUxGBr X-Received: by 2002:a17:906:f35b:b0:a43:fd9e:2d69 with SMTP id hg27-20020a170906f35b00b00a43fd9e2d69mr7349906ejb.6.1709573590528; Mon, 04 Mar 2024 09:33:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709573590; cv=none; d=google.com; s=arc-20160816; b=qfNec4hMHNugZ2AJqpQQBAA4nLNoTKLiBNPeQI1HYR7Dne/zav8+dXZRTCYLmMxshy hvOTWpadJ6RPouCx69C+/gHEsdoS/5P8NVbreNoZNgE3MV9+S84H9tt+vQU3fP2qHfD6 rm8tAQpq03WLEtia0ebli4ule1l5CoTbkCFYvZoPETJUZy2QeAX4K6UBbZ7Gec0r//k2 GnXKe+KIy6lj4BGDxo0yoBFejP3Nn2ZwIpcLCP91AeNDHwEEG6JhT8hk9mY4FIeMX6eZ fJVpXSUW0EOtnrhKVCmwqSOS7mK4HapM8qZXCumFTZUHhqDNVEBUy2FLHCQUKa8TJzj0 iHdQ== 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:references:in-reply-to :message-id:date:to:from:delivered-to; bh=oa5+Bu5B7GcxNGZAt5/jRx8iBi6vByniws+Bn1YwdYU=; fh=zgMS+X4RExv2k7fU8QdWClnqVJdqO/9UbUuBS5xxJDs=; b=hMc83nAJtqjCcxTIOUDHk9XQiwjuvQ7t6cM3S7ooo48rWYt6mASSdgKoj4QgBv1HJx GL589cldccdkyA2LDDr0mxjUfEhOHeeGZ2HNw0i1d2T5v2Vlr233Pj7FrgBjQHPSFz9N CxgDS6/4ieFJPmdh2TGWZImUFChSzhpjkpHuA0hHj5n4vrx54nYKXb+iyia1i9s/pPM9 wktuDv2d/yJ8cV11RPQlO3uUG7RkTZDEsuioozv24NZ84JYRQu7jEbBWUJlHTbUlk2wj +Metno4qcHoyDp9K21EfeOq+tj8nPysLLTeSZ7FkX9DNrwqtlMczTjVLeyuvrWw5tLiG Kl6w==; dara=google.com 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 gs30-20020a1709072d1e00b00a4480a01fc9si3496808ejc.130.2024.03.04.09.33.10; Mon, 04 Mar 2024 09:33:10 -0800 (PST) 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 A720368D492; Mon, 4 Mar 2024 19:32:34 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from srv-infra-2.infra.inf.glb.tvvideoms.com (www.inf.tvvideoms.com [213.205.126.156]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4C40B68D448 for ; Mon, 4 Mar 2024 19:32:24 +0200 (EET) Received: from cji.paris (unknown [172.16.3.159]) by srv-infra-2.infra.inf.glb.tvvideoms.com (Postfix) with ESMTP id 522FF4135E; Mon, 4 Mar 2024 17:32:23 +0000 (UTC) From: Nicolas Gaullier To: ffmpeg-devel@ffmpeg.org Date: Mon, 4 Mar 2024 18:32:16 +0100 Message-Id: <20240304173219.1877658-3-nicolas.gaullier@cji.paris> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240304173219.1877658-1-nicolas.gaullier@cji.paris> References: <20240304173219.1877658-1-nicolas.gaullier@cji.paris> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 2/5] avcodec/parser: reindent after previous commit 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: Nicolas Gaullier Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: SfB0VImnOEPt Signed-off-by: Nicolas Gaullier --- libavcodec/parser.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libavcodec/parser.c b/libavcodec/parser.c index 90461075fd..496ebbc231 100644 --- a/libavcodec/parser.c +++ b/libavcodec/parser.c @@ -144,14 +144,14 @@ int av_parser_parse2(AVCodecParserContext *s, AVCodecContext *avctx, } else if (s->cur_offset + buf_size != s->cur_frame_end[s->cur_frame_start_index]) { /* skip remainder packets */ if (pos != s->cur_frame_pos[s->cur_frame_start_index] || pos <= 0 || pts != AV_NOPTS_VALUE || dts != AV_NOPTS_VALUE ) { - /* add a new packet descriptor */ - i = (s->cur_frame_start_index + 1) & (AV_PARSER_PTS_NB - 1); - s->cur_frame_start_index = i; - s->cur_frame_offset[i] = s->cur_offset; - s->cur_frame_end[i] = s->cur_offset + buf_size; - s->cur_frame_pts[i] = pts; - s->cur_frame_dts[i] = dts; - s->cur_frame_pos[i] = pos; + /* add a new packet descriptor */ + i = (s->cur_frame_start_index + 1) & (AV_PARSER_PTS_NB - 1); + s->cur_frame_start_index = i; + s->cur_frame_offset[i] = s->cur_offset; + s->cur_frame_end[i] = s->cur_offset + buf_size; + s->cur_frame_pts[i] = pts; + s->cur_frame_dts[i] = dts; + s->cur_frame_pos[i] = pos; } else { s->cur_frame_end[s->cur_frame_start_index] = s->cur_offset + buf_size; } From patchwork Mon Mar 4 17:32:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Gaullier X-Patchwork-Id: 46784 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:d808:b0:19e:cdac:8cce with SMTP id iv8csp139376pzb; Mon, 4 Mar 2024 09:32:54 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVcP2GpampKFHgibeP7gj57DMM44ssAVGBiK9QQk8lv/thi4ZIQMysB4yma4FS7mJ3JmEJe9RKkcN6ts35hlqh/1shYRAgs6/dOUg== X-Google-Smtp-Source: AGHT+IFTzepl+0PslDtiUPLhi0WikO70Ru2t8qa792IcthI5ryCvFto949pJkjyHo3SdEYQKHFOm X-Received: by 2002:a05:6402:40c8:b0:567:3841:9b6b with SMTP id z8-20020a05640240c800b0056738419b6bmr3468705edb.0.1709573573737; Mon, 04 Mar 2024 09:32:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709573573; cv=none; d=google.com; s=arc-20160816; b=RXpOfI1fbUuHUJXDJFRlMZe0ryHGv2TsPmTGrDrnwDWhkwQN/yA895YOADNQwOHofI IPvdOTCjJ2FQ2mOJuAvl6n3tSL4ZKI8RmfUSsBg2ViKUxZ0B8bhGA/KAJLhn5nSudaP9 /yrYvPKIpW7EO6a28Wp0RwGMkHchuexHeqKVCk/vNpqMri+adh70rdo1T7n/w7+IlXhd EizW8FTqDCSfIH+xBnum2Naxj3K0+oJe6RwF+8CEONj1//GfTasVGDkVxP+jXjbbNMnj JgC1KpeJKUUuJe+52Xh0O/gUAA4M9FPosabOsj+pfbr2tclnKiA2VrzhF8WngTzHgLyz F7AQ== 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:references:in-reply-to :message-id:date:to:from:delivered-to; bh=W7jK7P0aUs75eDDy3xbTfsF1FD4YmKWd7I/IqnUNQog=; fh=zgMS+X4RExv2k7fU8QdWClnqVJdqO/9UbUuBS5xxJDs=; b=NOK42D1UMuKuJoxWP0Scduko5+fmFd1/CH0kuem8mWTzdJkzKQsH6x8xOnsjrP6btV d+Vft8Gbe3PxLp3xvMl4tdKG1Hul/TwTo8qt/AVSPM2VIFTqoCUnl3HybmSn7RD63sAu e9i9j87Yxr+lpXkthSDIfFyWDdgrT5OYSMfARXKQTnAo4r9ZABaPp4hMFvC6Yh+qYKqr 0MMCKr8GaV4kHpYIMG8EMpnDOXMN3+3VOynGuxZt4pVtDc7jIVkKrKUiVjLzh+uzyowO 2ZZ7t++CClHkgBrwd66/N+/OyMm3NFDiXo6hAEAGwXMquLmYQSWuiAiW0+8v7/Gz0uxp Zn1Q==; dara=google.com 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 k27-20020a508adb000000b0056572227a40si4110322edk.656.2024.03.04.09.32.53; Mon, 04 Mar 2024 09:32:53 -0800 (PST) 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 B1BF668D485; Mon, 4 Mar 2024 19:32:32 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from srv-infra-2.infra.inf.glb.tvvideoms.com (www.inf.tvvideoms.com [213.205.126.156]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4993268D444 for ; Mon, 4 Mar 2024 19:32:24 +0200 (EET) Received: from cji.paris (unknown [172.16.3.159]) by srv-infra-2.infra.inf.glb.tvvideoms.com (Postfix) with ESMTP id 6CB074135F; Mon, 4 Mar 2024 17:32:23 +0000 (UTC) From: Nicolas Gaullier To: ffmpeg-devel@ffmpeg.org Date: Mon, 4 Mar 2024 18:32:17 +0100 Message-Id: <20240304173219.1877658-4-nicolas.gaullier@cji.paris> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240304173219.1877658-1-nicolas.gaullier@cji.paris> References: <20240304173219.1877658-1-nicolas.gaullier@cji.paris> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 3/5] avcodec/parser: fix fetch_timestamp in a scenario with unaligned packets 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: Nicolas Gaullier Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: UJBerdVYgWWw Fix fetch_timestamp when the frame start is in a previous packet. Signed-off-by: Nicolas Gaullier --- libavcodec/parser.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libavcodec/parser.c b/libavcodec/parser.c index 496ebbc231..3c22fdcc2f 100644 --- a/libavcodec/parser.c +++ b/libavcodec/parser.c @@ -102,7 +102,7 @@ void ff_fetch_timestamp(AVCodecParserContext *s, int off, int remove, int fuzzy) s->dts = s->cur_frame_dts[i]; s->pts = s->cur_frame_pts[i]; s->pos = s->cur_frame_pos[i]; - s->offset = s->next_frame_offset - s->cur_frame_offset[i]; + s->offset = FFMAX( 0, s->next_frame_offset - s->cur_frame_offset[i]); } if (remove) s->cur_frame_offset[i] = INT64_MAX; @@ -158,11 +158,11 @@ int av_parser_parse2(AVCodecParserContext *s, AVCodecContext *avctx, } if (s->fetch_timestamp) { - s->fetch_timestamp = 0; s->last_pts = s->pts; s->last_dts = s->dts; s->last_pos = s->pos; - ff_fetch_timestamp(s, 0, 0, 0); + ff_fetch_timestamp(s, FFMIN(s->fetch_timestamp, 0), 0, 0); + s->fetch_timestamp = 0; } /* WARNING: the returned index can be negative */ index = s->parser->parser_parse(s, avctx, (const uint8_t **) poutbuf, @@ -179,12 +179,13 @@ int av_parser_parse2(AVCodecParserContext *s, AVCodecContext *avctx, /* update the file pointer */ if (*poutbuf_size) { + s->fetch_timestamp = index >= 0 || !s->frame_offset ? 1 : index; + /* fill the data for the current frame */ s->frame_offset = s->next_frame_offset; /* offset of the next frame */ s->next_frame_offset = s->cur_offset + index; - s->fetch_timestamp = 1; } else { /* Don't return a pointer to dummy_buf. */ *poutbuf = NULL; From patchwork Mon Mar 4 17:32:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Gaullier X-Patchwork-Id: 46782 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:d808:b0:19e:cdac:8cce with SMTP id iv8csp139283pzb; Mon, 4 Mar 2024 09:32:42 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUZ3Q3kKpkYmFF79el1MfKBe5ltuHiN9tIMiPsGk5vP14J9fgf79vL4BAA8ibGQutLAnWJQk6nr0n+KqzFArlApZms7w850wzWs+Q== X-Google-Smtp-Source: AGHT+IHKhtGXFcWYDM2pmggdt6vYH6baApykqyRl/0460Nv5/fy25OKlV4JUhYydnmqVcpAjyBbh X-Received: by 2002:a2e:9d86:0:b0:2d2:4b57:1c03 with SMTP id c6-20020a2e9d86000000b002d24b571c03mr5510556ljj.5.1709573562265; Mon, 04 Mar 2024 09:32:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709573562; cv=none; d=google.com; s=arc-20160816; b=L0JmzxcQDGfC1q4opwwyLvQNUf4d5TAc4ZhyhC4DL8FpTfTFTiMhb6mbcHXJPkPYzK fVY78i0PTYaW05eOYX7iUW6+hzL6M5AtBqnRDawrwSCuv/EUAsNK4XJA/Krb1ROlo8us xBlbPP3zKySwSFUVniuq4Lksm5dpC/lj28b9YwB2IAKtW35AbML6YZnxWz5dZeqlpn5/ JESKO5vKQY0cjRpjU8uChq5/5zN49/OgbO6SYUFDuhmQv/7M7+6H9p0yyvhrf30XcgKu U9VUZNBzyQexAzi07/X30SGOXMqloSWECfGjSk9Cikdr2JaHwJDhC2AtcBTaZwJjAagg OkJg== 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:references:in-reply-to :message-id:date:to:from:delivered-to; bh=+G/mQyyB40ki36C1AhlUcb88yZZPFN1yhXkJym7ryQY=; fh=zgMS+X4RExv2k7fU8QdWClnqVJdqO/9UbUuBS5xxJDs=; b=fE67B413pGjiDpjsskeSRbOn4tg7buWZMRSzAI0iCQKeGRXlgrmBkpeyzPqZ0z6L9Q 06+ltc64QPfrWMIfKx539d7N7j/TpU2dUOE23oV2VU8tL5cIoBorjGwtITkCXyRNPdZ0 r92PxYCrRP4yxDrvejx6jgOpBxy2E9QMGIIZ9YpiQ8NU+76ySzR6xEPCJ8qB8GliUuRN wvDy3nyag05bBXIjfYO5Tj6ZHJineZU800muiVcbvoxIdZo2jr+GSdvnANg8MypbAcRS OumNOUDcoHn7uSvdcsLKHgNbUeupgY8q3+8VCkmvaqzYQmwBnA8wMzmCxei98Cs/QlvU 3Hcw==; dara=google.com 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 x9-20020a05640226c900b00565dcc278fasi4036700edd.540.2024.03.04.09.32.35; Mon, 04 Mar 2024 09:32:42 -0800 (PST) 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 ED7A868D480; Mon, 4 Mar 2024 19:32:30 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from srv-infra-2.infra.inf.glb.tvvideoms.com (www.inf.tvvideoms.com [213.205.126.156]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4790368D417 for ; Mon, 4 Mar 2024 19:32:24 +0200 (EET) Received: from cji.paris (unknown [172.16.3.159]) by srv-infra-2.infra.inf.glb.tvvideoms.com (Postfix) with ESMTP id 8998041361; Mon, 4 Mar 2024 17:32:23 +0000 (UTC) From: Nicolas Gaullier To: ffmpeg-devel@ffmpeg.org Date: Mon, 4 Mar 2024 18:32:18 +0100 Message-Id: <20240304173219.1877658-5-nicolas.gaullier@cji.paris> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240304173219.1877658-1-nicolas.gaullier@cji.paris> References: <20240304173219.1877658-1-nicolas.gaullier@cji.paris> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 4/5] avcodec/h264_parser: fix start of packet for some broken streams 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: Nicolas Gaullier Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: rg/oRZdTTax2 Signed-off-by: Nicolas Gaullier --- libavcodec/h264_parser.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c index 94cfbc481e..6b721ec253 100644 --- a/libavcodec/h264_parser.c +++ b/libavcodec/h264_parser.c @@ -124,7 +124,16 @@ static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf, if (nalu_type == H264_NAL_SEI || nalu_type == H264_NAL_SPS || nalu_type == H264_NAL_PPS || nalu_type == H264_NAL_AUD) { if (pc->frame_start_found) { - i++; + /* Some streams in the wild are missing the zero_byte at the NAL_AUD: + * it is following just afterwards. + * To avoid any accidental borrowing of a byte in the previous frame + * (which would return a negative index and indicate that fetch_timestamps + * has to get the pts from the previous frame), + * better have the start of packet strictly aligned. + * To make it a more general rule, just test the following three bytes are null. + */ + i += 1 + (!p->is_avc && state == 5 && i == 3 && nalu_type == H264_NAL_AUD && + buf_size >= 9 && !AV_RB24(buf + 5)); goto found; } } else if (nalu_type == H264_NAL_SLICE || nalu_type == H264_NAL_DPA || From patchwork Mon Mar 4 17:32:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Gaullier X-Patchwork-Id: 46786 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:d808:b0:19e:cdac:8cce with SMTP id iv8csp139655pzb; Mon, 4 Mar 2024 09:33:19 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCW2W3cPtAxpm9Iht63Wq6twYa2JzMQM5UiF7csX6Rsg8BV1RgR7o6R/9uquilMQk3ZjNZ9r6xz9PSaW+Izl1OTDhkJ3HM6m1uPELQ== X-Google-Smtp-Source: AGHT+IFND1cDDIBl9bO6FcFP7qTSTyJ1Wf4d4XkC7QXTmhZYrjCDajz2I9zlW2Mmvrsp3DavKfY+ X-Received: by 2002:a17:906:b210:b0:a45:1d20:ef58 with SMTP id p16-20020a170906b21000b00a451d20ef58mr2934606ejz.12.1709573599639; Mon, 04 Mar 2024 09:33:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709573599; cv=none; d=google.com; s=arc-20160816; b=o+FuZ2I73ZBZcUQjPge/AaDszQNP/tZLg6KZdvwDeWW6Te2ycJV/xDoPyQKp8aWXgP XdkfXSLDNo4/rnQ3UnQmBKuNPyQXwJmaitX9jJp8y9OYoXKav2KrM5C+gDIrUpbyVfqS 7wiCaA/aqRdlzKOsTRWaUaQ6f1hVMUjltwMz9gTNI3XxEGfkQzcjRSuX9B0wMPc17bNS 7vxFXItAgRlg15NkB+gndI+vQhMS888M+lxAsw8T+Yq6a05r3HY9sPfYJf8NBEK7aJly Lgygutpv1aQ8/l7WtsXdTHzC7f/1mZ+Vg2ORMUai1+O7SguxKGnb49VVpXgGtxE+2+m0 ZfMw== 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:references:in-reply-to :message-id:date:to:from:delivered-to; bh=3jEvxzgN6D9MmYPWqZ4jCQOOvvcHmpFr38OrjAg0ZiI=; fh=zgMS+X4RExv2k7fU8QdWClnqVJdqO/9UbUuBS5xxJDs=; b=p6kkwEtzueQvN/J379i+iFQnsaaWTUX3L1nyCEL4PKGSdHiWJUrKnstV5Ndq9L+Yza b1qpQSgnewD7rLaMC+bLaR5lRza1n+s/8W84RlbQBkx2+5Iu1Ksuqve1bHN1Ru9PXyfY jWdeP7o7KgM08GtLx6yKO90ZgXo4nBAwl4JZr6TXPJH8zwarlAgHltUWfECjnZokJvuo 2kf36xsYX7CFdmvhbpXTAsvSd6GDC/dpfMqDJVJmrpg/kcB45DQgBH0RfRZ+F+H5amtp O+kV8sZbI2EfKzIVhTpb+7FRnzh3CuYCgztqA8O2T5e/74EM0EDThwtm6Kj497iH+H2F D3DA==; dara=google.com 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 hq26-20020a1709073f1a00b00a3efc658f3bsi4120427ejc.731.2024.03.04.09.33.19; Mon, 04 Mar 2024 09:33:19 -0800 (PST) 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 893E868D498; Mon, 4 Mar 2024 19:32:35 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from srv-infra-2.infra.inf.glb.tvvideoms.com (www.inf.tvvideoms.com [213.205.126.156]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E563568D444 for ; Mon, 4 Mar 2024 19:32:29 +0200 (EET) Received: from cji.paris (unknown [172.16.3.159]) by srv-infra-2.infra.inf.glb.tvvideoms.com (Postfix) with ESMTP id A9E5541362; Mon, 4 Mar 2024 17:32:23 +0000 (UTC) From: Nicolas Gaullier To: ffmpeg-devel@ffmpeg.org Date: Mon, 4 Mar 2024 18:32:19 +0100 Message-Id: <20240304173219.1877658-6-nicolas.gaullier@cji.paris> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240304173219.1877658-1-nicolas.gaullier@cji.paris> References: <20240304173219.1877658-1-nicolas.gaullier@cji.paris> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 5/5] lavf/demux: duplicate side_data in parse_packet() 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: Nicolas Gaullier Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: d38r/9sdSg5o Signed-off-by: Nicolas Gaullier --- libavformat/demux.c | 25 ++- tests/ref/fate/concat-demuxer-simple2-lavf-ts | 164 +++++++++--------- tests/ref/fate/ts-demux | 8 +- 3 files changed, 106 insertions(+), 91 deletions(-) diff --git a/libavformat/demux.c b/libavformat/demux.c index 2e1d0ed66d..299e693606 100644 --- a/libavformat/demux.c +++ b/libavformat/demux.c @@ -1186,7 +1186,7 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt, FFStream *const sti = ffstream(st); const uint8_t *data = pkt->data; int size = pkt->size; - int ret = 0, got_output = flush; + int ret = 0, got_output = flush, pkt_side_data_consumed = 0; if (!size && !flush && sti->parser->flags & PARSER_FLAG_COMPLETE_FRAMES) { // preserve 0-size sync packets @@ -1231,10 +1231,21 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt, } if (pkt->side_data) { - out_pkt->side_data = pkt->side_data; - out_pkt->side_data_elems = pkt->side_data_elems; - pkt->side_data = NULL; - pkt->side_data_elems = 0; + /* for the first iteration, side_data are simply moved to output. + * in case of additional iterations, they are duplicated each time. */ + if (!pkt_side_data_consumed) { + pkt_side_data_consumed = 1; + out_pkt->side_data = pkt->side_data; + out_pkt->side_data_elems = pkt->side_data_elems; + } else for (int i = 0; i < pkt->side_data_elems; i++) { + const AVPacketSideData *const src_sd = &pkt->side_data[i]; + uint8_t *dst_data = av_packet_new_side_data(out_pkt, src_sd->type, src_sd->size); + if (!dst_data) { + ret = AVERROR(ENOMEM); + goto fail; + } + memcpy(dst_data, src_sd->data, src_sd->size); + } } /* set the duration */ @@ -1286,6 +1297,10 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt, } fail: + if (pkt_side_data_consumed) { + pkt->side_data = NULL; + pkt->side_data_elems = 0; + } if (ret < 0) av_packet_unref(out_pkt); av_packet_unref(pkt); diff --git a/tests/ref/fate/concat-demuxer-simple2-lavf-ts b/tests/ref/fate/concat-demuxer-simple2-lavf-ts index 548cab01c6..ee49e331f3 100644 --- a/tests/ref/fate/concat-demuxer-simple2-lavf-ts +++ b/tests/ref/fate/concat-demuxer-simple2-lavf-ts @@ -7,19 +7,19 @@ video|1|18982|0.210911|15382|0.170911|3600|0.040000|13092|84788|___|MPEGTS Strea video|1|22582|0.250911|18982|0.210911|3600|0.040000|12755|98700|___|MPEGTS Stream ID|224 video|1|26182|0.290911|22582|0.250911|3600|0.040000|12023|111860|___|MPEGTS Stream ID|224 audio|0|0|0.000000|0|0.000000|2351|0.026122|208|152844|K__|MPEGTS Stream ID|192 -audio|0|2351|0.026122|2351|0.026122|2351|0.026122|209|N/A|K__ -audio|0|4702|0.052244|4702|0.052244|2351|0.026122|209|N/A|K__ -audio|0|7053|0.078367|7053|0.078367|2351|0.026122|209|N/A|K__ -audio|0|9404|0.104489|9404|0.104489|2351|0.026122|209|N/A|K__ -audio|0|11755|0.130611|11755|0.130611|2351|0.026122|209|N/A|K__ -audio|0|14106|0.156733|14106|0.156733|2351|0.026122|209|N/A|K__ -audio|0|16457|0.182856|16457|0.182856|2351|0.026122|209|N/A|K__ -audio|0|18808|0.208978|18808|0.208978|2351|0.026122|209|N/A|K__ -audio|0|21159|0.235100|21159|0.235100|2351|0.026122|209|N/A|K__ -audio|0|23510|0.261222|23510|0.261222|2351|0.026122|209|N/A|K__ -audio|0|25861|0.287344|25861|0.287344|2351|0.026122|209|N/A|K__ -audio|0|28212|0.313467|28212|0.313467|2351|0.026122|209|N/A|K__ -audio|0|30563|0.339589|30563|0.339589|2351|0.026122|209|N/A|K__ +audio|0|2351|0.026122|2351|0.026122|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|4702|0.052244|4702|0.052244|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|7053|0.078367|7053|0.078367|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|9404|0.104489|9404|0.104489|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|11755|0.130611|11755|0.130611|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|14106|0.156733|14106|0.156733|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|16457|0.182856|16457|0.182856|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|18808|0.208978|18808|0.208978|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|21159|0.235100|21159|0.235100|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|23510|0.261222|23510|0.261222|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|25861|0.287344|25861|0.287344|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|28212|0.313467|28212|0.313467|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|30563|0.339589|30563|0.339589|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 video|1|29782|0.330911|26182|0.290911|3600|0.040000|14098|124268|___|MPEGTS Stream ID|224 video|1|33382|0.370911|29782|0.330911|3600|0.040000|13329|139120|___|MPEGTS Stream ID|224 video|1|36982|0.410911|33382|0.370911|3600|0.040000|12135|155852|___|MPEGTS Stream ID|224 @@ -31,35 +31,35 @@ video|1|54982|0.610911|51382|0.570911|3600|0.040000|13449|240640|___|MPEGTS Stre video|1|58582|0.650911|54982|0.610911|3600|0.040000|12398|254552|___|MPEGTS Stream ID|224 video|1|62182|0.690911|58582|0.650911|3600|0.040000|13455|267336|___|MPEGTS Stream ID|224 audio|0|32915|0.365722|32915|0.365722|2351|0.026122|209|308508|K__|MPEGTS Stream ID|192 -audio|0|35266|0.391844|35266|0.391844|2351|0.026122|209|N/A|K__ -audio|0|37617|0.417967|37617|0.417967|2351|0.026122|209|N/A|K__ -audio|0|39968|0.444089|39968|0.444089|2351|0.026122|209|N/A|K__ -audio|0|42319|0.470211|42319|0.470211|2351|0.026122|209|N/A|K__ -audio|0|44670|0.496333|44670|0.496333|2351|0.026122|209|N/A|K__ -audio|0|47021|0.522456|47021|0.522456|2351|0.026122|209|N/A|K__ -audio|0|49372|0.548578|49372|0.548578|2351|0.026122|209|N/A|K__ -audio|0|51723|0.574700|51723|0.574700|2351|0.026122|209|N/A|K__ -audio|0|54074|0.600822|54074|0.600822|2351|0.026122|209|N/A|K__ -audio|0|56425|0.626944|56425|0.626944|2351|0.026122|209|N/A|K__ -audio|0|58776|0.653067|58776|0.653067|2351|0.026122|209|N/A|K__ -audio|0|61127|0.679189|61127|0.679189|2351|0.026122|209|N/A|K__ -audio|0|63478|0.705311|63478|0.705311|2351|0.026122|209|N/A|K__ +audio|0|35266|0.391844|35266|0.391844|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|37617|0.417967|37617|0.417967|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|39968|0.444089|39968|0.444089|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|42319|0.470211|42319|0.470211|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|44670|0.496333|44670|0.496333|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|47021|0.522456|47021|0.522456|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|49372|0.548578|49372|0.548578|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|51723|0.574700|51723|0.574700|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|54074|0.600822|54074|0.600822|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|56425|0.626944|56425|0.626944|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|58776|0.653067|58776|0.653067|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|61127|0.679189|61127|0.679189|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|63478|0.705311|63478|0.705311|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 video|1|65782|0.730911|62182|0.690911|3600|0.040000|13836|281624|___|MPEGTS Stream ID|224 video|1|69382|0.770911|65782|0.730911|3600|0.040000|12163|295912|___|MPEGTS Stream ID|224 video|1|72982|0.810911|69382|0.770911|3600|0.040000|12692|311516|___|MPEGTS Stream ID|224 video|1|76582|0.850911|72982|0.810911|3600|0.040000|10824|325052|___|MPEGTS Stream ID|224 video|1|80182|0.890911|76582|0.850911|3600|0.040000|11286|336144|___|MPEGTS Stream ID|224 audio|0|65829|0.731433|65829|0.731433|2351|0.026122|209|386716|K__|MPEGTS Stream ID|192 -audio|0|68180|0.757556|68180|0.757556|2351|0.026122|209|N/A|K__ -audio|0|70531|0.783678|70531|0.783678|2351|0.026122|209|N/A|K__ -audio|0|72882|0.809800|72882|0.809800|2351|0.026122|209|N/A|K__ -audio|0|75233|0.835922|75233|0.835922|2351|0.026122|209|N/A|K__ -audio|0|77584|0.862044|77584|0.862044|2351|0.026122|209|N/A|K__ -audio|0|79935|0.888167|79935|0.888167|2351|0.026122|209|N/A|K__ -audio|0|82286|0.914289|82286|0.914289|2351|0.026122|209|N/A|K__ -audio|0|84637|0.940411|84637|0.940411|2351|0.026122|209|N/A|K__ -audio|0|86988|0.966533|86988|0.966533|2351|0.026122|209|N/A|K__ -audio|0|89339|0.992656|89339|0.992656|2351|0.026122|209|N/A|K__ +audio|0|68180|0.757556|68180|0.757556|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|70531|0.783678|70531|0.783678|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|72882|0.809800|72882|0.809800|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|75233|0.835922|75233|0.835922|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|77584|0.862044|77584|0.862044|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|79935|0.888167|79935|0.888167|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|82286|0.914289|82286|0.914289|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|84637|0.940411|84637|0.940411|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|86988|0.966533|86988|0.966533|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|89339|0.992656|89339|0.992656|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 video|1|83782|0.930911|80182|0.890911|3600|0.040000|12678|347800|___|MPEGTS Stream ID|224 video|1|87382|0.970911|83782|0.930911|3600|0.040000|24711|361336|K__ video|1|91964|1.021822|88364|0.981822|3600|0.040000|24801|564|K__|MPEGTS Stream ID|224 @@ -71,19 +71,19 @@ video|1|109964|1.221822|106364|1.181822|3600|0.040000|13092|84788|___|MPEGTS Str video|1|113564|1.261822|109964|1.221822|3600|0.040000|12755|98700|___|MPEGTS Stream ID|224 video|1|117164|1.301822|113564|1.261822|3600|0.040000|12023|111860|___|MPEGTS Stream ID|224 audio|0|90982|1.010911|90982|1.010911|2351|0.026122|208|152844|K__|MPEGTS Stream ID|192 -audio|0|93333|1.037033|93333|1.037033|2351|0.026122|209|N/A|K__ -audio|0|95684|1.063156|95684|1.063156|2351|0.026122|209|N/A|K__ -audio|0|98035|1.089278|98035|1.089278|2351|0.026122|209|N/A|K__ -audio|0|100386|1.115400|100386|1.115400|2351|0.026122|209|N/A|K__ -audio|0|102737|1.141522|102737|1.141522|2351|0.026122|209|N/A|K__ -audio|0|105088|1.167644|105088|1.167644|2351|0.026122|209|N/A|K__ -audio|0|107439|1.193767|107439|1.193767|2351|0.026122|209|N/A|K__ -audio|0|109790|1.219889|109790|1.219889|2351|0.026122|209|N/A|K__ -audio|0|112141|1.246011|112141|1.246011|2351|0.026122|209|N/A|K__ -audio|0|114492|1.272133|114492|1.272133|2351|0.026122|209|N/A|K__ -audio|0|116843|1.298256|116843|1.298256|2351|0.026122|209|N/A|K__ -audio|0|119194|1.324378|119194|1.324378|2351|0.026122|209|N/A|K__ -audio|0|121545|1.350500|121545|1.350500|2351|0.026122|209|N/A|K__ +audio|0|93333|1.037033|93333|1.037033|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|95684|1.063156|95684|1.063156|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|98035|1.089278|98035|1.089278|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|100386|1.115400|100386|1.115400|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|102737|1.141522|102737|1.141522|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|105088|1.167644|105088|1.167644|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|107439|1.193767|107439|1.193767|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|109790|1.219889|109790|1.219889|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|112141|1.246011|112141|1.246011|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|114492|1.272133|114492|1.272133|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|116843|1.298256|116843|1.298256|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|119194|1.324378|119194|1.324378|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|121545|1.350500|121545|1.350500|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 video|1|120764|1.341822|117164|1.301822|3600|0.040000|14098|124268|___|MPEGTS Stream ID|224 video|1|124364|1.381822|120764|1.341822|3600|0.040000|13329|139120|___|MPEGTS Stream ID|224 video|1|127964|1.421822|124364|1.381822|3600|0.040000|12135|155852|___|MPEGTS Stream ID|224 @@ -95,51 +95,51 @@ video|1|145964|1.621822|142364|1.581822|3600|0.040000|13449|240640|___|MPEGTS St video|1|149564|1.661822|145964|1.621822|3600|0.040000|12398|254552|___|MPEGTS Stream ID|224 video|1|153164|1.701822|149564|1.661822|3600|0.040000|13455|267336|___|MPEGTS Stream ID|224 audio|0|123897|1.376633|123897|1.376633|2351|0.026122|209|308508|K__|MPEGTS Stream ID|192 -audio|0|126248|1.402756|126248|1.402756|2351|0.026122|209|N/A|K__ -audio|0|128599|1.428878|128599|1.428878|2351|0.026122|209|N/A|K__ -audio|0|130950|1.455000|130950|1.455000|2351|0.026122|209|N/A|K__ -audio|0|133301|1.481122|133301|1.481122|2351|0.026122|209|N/A|K__ -audio|0|135652|1.507244|135652|1.507244|2351|0.026122|209|N/A|K__ -audio|0|138003|1.533367|138003|1.533367|2351|0.026122|209|N/A|K__ -audio|0|140354|1.559489|140354|1.559489|2351|0.026122|209|N/A|K__ -audio|0|142705|1.585611|142705|1.585611|2351|0.026122|209|N/A|K__ -audio|0|145056|1.611733|145056|1.611733|2351|0.026122|209|N/A|K__ -audio|0|147407|1.637856|147407|1.637856|2351|0.026122|209|N/A|K__ -audio|0|149758|1.663978|149758|1.663978|2351|0.026122|209|N/A|K__ -audio|0|152109|1.690100|152109|1.690100|2351|0.026122|209|N/A|K__ -audio|0|154460|1.716222|154460|1.716222|2351|0.026122|209|N/A|K__ +audio|0|126248|1.402756|126248|1.402756|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|128599|1.428878|128599|1.428878|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|130950|1.455000|130950|1.455000|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|133301|1.481122|133301|1.481122|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|135652|1.507244|135652|1.507244|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|138003|1.533367|138003|1.533367|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|140354|1.559489|140354|1.559489|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|142705|1.585611|142705|1.585611|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|145056|1.611733|145056|1.611733|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|147407|1.637856|147407|1.637856|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|149758|1.663978|149758|1.663978|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|152109|1.690100|152109|1.690100|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|154460|1.716222|154460|1.716222|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 video|1|156764|1.741822|153164|1.701822|3600|0.040000|13836|281624|___|MPEGTS Stream ID|224 video|1|160364|1.781822|156764|1.741822|3600|0.040000|12163|295912|___|MPEGTS Stream ID|224 video|1|163964|1.821822|160364|1.781822|3600|0.040000|12692|311516|___|MPEGTS Stream ID|224 video|1|167564|1.861822|163964|1.821822|3600|0.040000|10824|325052|___|MPEGTS Stream ID|224 video|1|171164|1.901822|167564|1.861822|3600|0.040000|11286|336144|___|MPEGTS Stream ID|224 audio|0|156811|1.742344|156811|1.742344|2351|0.026122|209|386716|K__|MPEGTS Stream ID|192 -audio|0|159162|1.768467|159162|1.768467|2351|0.026122|209|N/A|K__ -audio|0|161513|1.794589|161513|1.794589|2351|0.026122|209|N/A|K__ -audio|0|163864|1.820711|163864|1.820711|2351|0.026122|209|N/A|K__ -audio|0|166215|1.846833|166215|1.846833|2351|0.026122|209|N/A|K__ -audio|0|168566|1.872956|168566|1.872956|2351|0.026122|209|N/A|K__ -audio|0|170917|1.899078|170917|1.899078|2351|0.026122|209|N/A|K__ -audio|0|173268|1.925200|173268|1.925200|2351|0.026122|209|N/A|K__ -audio|0|175619|1.951322|175619|1.951322|2351|0.026122|209|N/A|K__ -audio|0|177970|1.977444|177970|1.977444|2351|0.026122|209|N/A|K__ -audio|0|180321|2.003567|180321|2.003567|2351|0.026122|209|N/A|K__ +audio|0|159162|1.768467|159162|1.768467|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|161513|1.794589|161513|1.794589|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|163864|1.820711|163864|1.820711|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|166215|1.846833|166215|1.846833|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|168566|1.872956|168566|1.872956|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|170917|1.899078|170917|1.899078|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|173268|1.925200|173268|1.925200|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|175619|1.951322|175619|1.951322|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|177970|1.977444|177970|1.977444|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|180321|2.003567|180321|2.003567|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 video|1|174764|1.941822|171164|1.901822|3600|0.040000|12678|347800|___|MPEGTS Stream ID|224 video|1|178364|1.981822|174764|1.941822|3600|0.040000|24711|361336|K__ video|1|139582|1.550911|135982|1.510911|3600|0.040000|12692|311516|___|MPEGTS Stream ID|224 video|1|143182|1.590911|139582|1.550911|3600|0.040000|10824|325052|___|MPEGTS Stream ID|224 video|1|146782|1.630911|143182|1.590911|3600|0.040000|11286|336144|___|MPEGTS Stream ID|224 audio|0|132429|1.471433|132429|1.471433|2351|0.026122|209|386716|K__|MPEGTS Stream ID|192 -audio|0|134780|1.497556|134780|1.497556|2351|0.026122|209|N/A|K__ -audio|0|137131|1.523678|137131|1.523678|2351|0.026122|209|N/A|K__ -audio|0|139482|1.549800|139482|1.549800|2351|0.026122|209|N/A|K__ -audio|0|141833|1.575922|141833|1.575922|2351|0.026122|209|N/A|K__ -audio|0|144184|1.602044|144184|1.602044|2351|0.026122|209|N/A|K__ -audio|0|146535|1.628167|146535|1.628167|2351|0.026122|209|N/A|K__ -audio|0|148886|1.654289|148886|1.654289|2351|0.026122|209|N/A|K__ -audio|0|151237|1.680411|151237|1.680411|2351|0.026122|209|N/A|K__ -audio|0|153588|1.706533|153588|1.706533|2351|0.026122|209|N/A|K__ -audio|0|155939|1.732656|155939|1.732656|2351|0.026122|209|N/A|K__ +audio|0|134780|1.497556|134780|1.497556|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|137131|1.523678|137131|1.523678|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|139482|1.549800|139482|1.549800|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|141833|1.575922|141833|1.575922|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|144184|1.602044|144184|1.602044|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|146535|1.628167|146535|1.628167|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|148886|1.654289|148886|1.654289|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|151237|1.680411|151237|1.680411|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|153588|1.706533|153588|1.706533|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 +audio|0|155939|1.732656|155939|1.732656|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192 video|1|150382|1.670911|146782|1.630911|3600|0.040000|12678|347800|___|MPEGTS Stream ID|224 video|1|153982|1.710911|150382|1.670911|3600|0.040000|24711|361336|K__ video|1|161182|1.790911|157582|1.750911|3600|0.040000|12135|155852|___|MPEGTS Stream ID|224 diff --git a/tests/ref/fate/ts-demux b/tests/ref/fate/ts-demux index b01f525c38..4274a0e145 100644 --- a/tests/ref/fate/ts-demux +++ b/tests/ref/fate/ts-demux @@ -10,11 +10,11 @@ packet|codec_type=video|stream_index=0|pts=3912677354|pts_time=43474.192822|dts= packet|codec_type=video|stream_index=0|pts=3912683360|pts_time=43474.259556|dts=3912678855|dts_time=43474.209500|duration=1501|duration_time=0.016678|size=61720|pos=325240|flags=___|data_hash=CRC32:7e6594e5|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=224 packet|codec_type=video|stream_index=0|pts=3912680357|pts_time=43474.226189|dts=3912680357|dts_time=43474.226189|duration=1501|duration_time=0.016678|size=17416|pos=390852|flags=___|data_hash=CRC32:31c8b89d|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=224 packet|codec_type=audio|stream_index=1|pts=3912633305|pts_time=43473.703389|dts=3912633305|dts_time=43473.703389|duration=2880|duration_time=0.032000|size=1536|pos=218080|flags=K__|data_hash=CRC32:25b60d38|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=189 -packet|codec_type=audio|stream_index=1|pts=3912636185|pts_time=43473.735389|dts=3912636185|dts_time=43473.735389|duration=2880|duration_time=0.032000|size=1536|pos=N/A|flags=K__|data_hash=CRC32:d4e30aaf -packet|codec_type=audio|stream_index=1|pts=3912639065|pts_time=43473.767389|dts=3912639065|dts_time=43473.767389|duration=2880|duration_time=0.032000|size=1536|pos=N/A|flags=K__|data_hash=CRC32:32d6d14d +packet|codec_type=audio|stream_index=1|pts=3912636185|pts_time=43473.735389|dts=3912636185|dts_time=43473.735389|duration=2880|duration_time=0.032000|size=1536|pos=N/A|flags=K__|data_hash=CRC32:d4e30aaf|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=189 +packet|codec_type=audio|stream_index=1|pts=3912639065|pts_time=43473.767389|dts=3912639065|dts_time=43473.767389|duration=2880|duration_time=0.032000|size=1536|pos=N/A|flags=K__|data_hash=CRC32:32d6d14d|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=189 packet|codec_type=audio|stream_index=2|pts=3912634060|pts_time=43473.711778|dts=3912634060|dts_time=43473.711778|duration=2880|duration_time=0.032000|size=768|pos=235564|flags=K__|data_hash=CRC32:34b350c9|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=189 -packet|codec_type=audio|stream_index=2|pts=3912636940|pts_time=43473.743778|dts=3912636940|dts_time=43473.743778|duration=2880|duration_time=0.032000|size=768|pos=N/A|flags=K__|data_hash=CRC32:457881f8 -packet|codec_type=audio|stream_index=2|pts=3912639820|pts_time=43473.775778|dts=3912639820|dts_time=43473.775778|duration=2880|duration_time=0.032000|size=768|pos=N/A|flags=K__|data_hash=CRC32:1abb0d9a +packet|codec_type=audio|stream_index=2|pts=3912636940|pts_time=43473.743778|dts=3912636940|dts_time=43473.743778|duration=2880|duration_time=0.032000|size=768|pos=N/A|flags=K__|data_hash=CRC32:457881f8|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=189 +packet|codec_type=audio|stream_index=2|pts=3912639820|pts_time=43473.775778|dts=3912639820|dts_time=43473.775778|duration=2880|duration_time=0.032000|size=768|pos=N/A|flags=K__|data_hash=CRC32:1abb0d9a|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=189 packet|codec_type=video|stream_index=0|pts=3912681858|pts_time=43474.242867|dts=3912681858|dts_time=43474.242867|duration=1501|duration_time=0.016678|size=18144|pos=409464|flags=___|data_hash=CRC32:826f8e8e|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=224 packet|codec_type=video|stream_index=0|pts=3912687864|pts_time=43474.309600|dts=3912683360|dts_time=43474.259556|duration=1501|duration_time=0.016678|size=56848|pos=428640|flags=___|data_hash=CRC32:6b15be8c|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=224 packet|codec_type=video|stream_index=0|pts=3912684861|pts_time=43474.276233|dts=3912684861|dts_time=43474.276233|duration=1501|duration_time=0.016678|size=16296|pos=489176|flags=___|data_hash=CRC32:911b1649|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=224