From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id F1DDC4767B for ; Tue, 25 Nov 2025 19:46:07 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'ElwmxlEOUmbMie1Coc/yjZQDF+r+oQr5dmWyURi6AiA=', expected b'+djrV5xQBZfCliejnRDpwESzHPh3IUqd6vRC63NMfZ8=')) header.d=ffmpeg.org header.i=@ffmpeg.org header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1764099954; h=mime-version : to : date : message-id : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-type : content-transfer-encoding : from; bh=ElwmxlEOUmbMie1Coc/yjZQDF+r+oQr5dmWyURi6AiA=; b=fm957lLvm9H2TgTpXnCEqzpQ+ZBbdif95/PGXHSw6dgNrbZTEzda+8d8kR6n+H7ZE+JH0 bCYL7lr84SYdYlmfNIxte4eUmXyyx6xWzCZbiAZTX4HOrI7tZSmvZgtyidlYJHtX7Xawjfo ew3yyLYdGjmBmFicBfEqDX+TRCWAxO0ZkYwwYRA0aXFmvRwtMVclLL8qZdy7Zk/lVh8ojf0 Hl7Lw+rgVS3plBKC9F9tgVPLmISrC4IX48OCPpKbCWWLNMvQRVBOgF3voDtwQHgwxArVSAl xpyRQQbm30YmKUbrMe9TLcwnVskhoGr0fs3IR271I3FpkIXTD1+Fn5odIGtA== Received: from [172.19.0.3] (unknown [172.19.0.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 2586069008A; Tue, 25 Nov 2025 21:45:54 +0200 (EET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1764099940; b=OSg2IxlEUC1FSPJdI8sGcdYdndWr3e5Kxg2/mFlejdtLVZ/q1pGQO763kLAakps7adzTf aBS0Ul+51LHsA1vGD4v/oSGi+5KY0yqGkdHnVZwoDiDkKXCTeTYas7ngJM9xAkQkcTsPhIH PgkOcrqWElToxtDh+3nvByMthpBRnumBkEn0eQpvkF5w0Fv65l/odTvNZMwvnEup6iZG8E0 BHULrnnxtYKwJZvYN9aZPcuRblWxtAn2U+HbdjagZL23mIyy+U7FOGTOXFW3mKy7zao7KsA 3b5cYrSxyJ/yRlXHZb9Ffy6ravi3YihkcETT3NmOzqqkw7TD15ogz1sQ9jiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1764099940; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=hdKwjDhc5jxCY/+xVGO5Bb4cdFKJF2ihxnUajoDmi/Y=; b=eGLvYbvBAgDCUBHcK6kCtFrTW2dMaF3d3XpwmG35pqXxVZFER48zBkdnV4bal4QncVEvS NRv8foX5zmGCqd5zSdHPEIEGqzam89eTVAoCfioINGpoM5aJ4Ovol5IoAFQwUzm1r+G5/qG tMIIE/TV8oDrTz81pTGeW6g80loFA4aTpZN60IBCr9TulWK/xkg70DJFfdFshaIGRcI+qJW zacB/2+jOOQ4QopVK0dnIjkCKh03RrJX9jcjE+ho/U7jf6oteivNyvCv5kZcS75/xDIURPu u/bWixRH8XtQFlmoBA09yc8F4mJ+3HJTPCpklY8lXmP9YUDmH+1rCouLyNmQ== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none; dmarc=pass header.from=ffmpeg.org policy.dmarc=quarantine Authentication-Results: ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none (Message is not ARC signed); dmarc=pass (Used From Domain Record) header.from=ffmpeg.org policy.dmarc=quarantine DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1764099933; h=content-type : mime-version : content-transfer-encoding : from : to : reply-to : subject : date : from; bh=+djrV5xQBZfCliejnRDpwESzHPh3IUqd6vRC63NMfZ8=; b=JLM1/ZgP1Yple2AfW9Izx740pWG0hRJ5LYvVpBLKcWkbMrjf5ewSPKrY8hRg8yVLXiJA7 E3KMxKXDcK//TNqIu0MVExFpVvbPOvts5f1s5+43Nm74xabuKX0qONqdNYGbAiLBNsfIN2y ZWwa//NSfy18oXjWiRC+QVxHOiLKDbu7wgIsQR9aKmMcmcJEnCBrEZYXY8C2+fEIWhd+5YI FESZfoyxkyb5xfmNwOk7zymPkDp7mhDdzc6vPd9kk6LC6T5tV3tG7VYMXIoi+KR5/ytXzmw XNQiRCf/eeTGntmU5R5ZgrJ3oB7xu/xGbsfU1PfuDIkzzEM9X6+mr238hvUg== Received: from 55ca25703178 (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 7618568E7FF for ; Tue, 25 Nov 2025 21:45:33 +0200 (EET) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Date: Tue, 25 Nov 2025 19:45:33 -0000 Message-ID: <176409993361.39.10850863896577290677@2cb04c0e5124> Message-ID-Hash: MKUX7LEBVPZ7ZQPJB373RYLMYLADELLO X-Message-ID-Hash: MKUX7LEBVPZ7ZQPJB373RYLMYLADELLO X-MailFrom: code@ffmpeg.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH] libavformat/spdifdec: Fix SPDIF detection score for EAC3 (PR #21019) List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Shulyaka via ffmpeg-devel Cc: Shulyaka Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: PR #21019 opened by Shulyaka URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21019 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21019.patch When EAC3 spdif decoding support was added in d3538dd293125e0a8d135ffe229c8b441345d833, the `SPDIF_MAX_OFFSET` was not increased. Also, the spdif is based on blocks with fixed length, each block starts with a sync word. It matters how many sync words we find during probe and whether we find them in expected place. The `SPDIF_MAX_OFFSET` constant is the maximum supported block size. When we find a sync word, we shift the upper boundary of the search area (`probe_end`) by `SPDIF_MAX_OFFSET`, however __this boundary is exclusive (the condition in the loop is "strictly less")__, and when the actual block size matches the max supported block size, then the second sync word appears to be outside of the search area by 1 byte. As a result, we find only one sync word and return an incorrect score (`AVPROBE_SCORE_EXTENSION / 4` instead of `AVPROBE_SCORE_MAX`). The fix increases the `SPDIF_MAX_OFFSET` and gives 1 more byte to the search area to allow finding the subsequent sync word. The existing `fate-spdif-eac3-remux` test passes successfully. >>From 9f2e5c7cf8e33f42a33dbaa6943beab3d2514e46 Mon Sep 17 00:00:00 2001 From: Denis Shulyaka Date: Tue, 25 Nov 2025 22:32:24 +0300 Subject: [PATCH] avformat/spdifdec: Increase max probe offset --- libavformat/spdifdec.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/libavformat/spdifdec.c b/libavformat/spdifdec.c index dcfe471f45..8287c19ad3 100644 --- a/libavformat/spdifdec.c +++ b/libavformat/spdifdec.c @@ -109,9 +109,8 @@ static int spdif_get_offset_and_codec(AVFormatContext *s, return 0; } -/* Largest offset between bursts we currently handle, i.e. AAC with - samples = 4096 */ -#define SPDIF_MAX_OFFSET 16384 +/* Largest offset between bursts we currently handle, i.e. E-AC-3 */ +#define SPDIF_MAX_OFFSET 24576 static int spdif_probe(const AVProbeData *p) { @@ -122,7 +121,7 @@ static int spdif_probe(const AVProbeData *p) int ff_spdif_probe(const uint8_t *p_buf, int buf_size, enum AVCodecID *codec) { const uint8_t *buf = p_buf; - const uint8_t *probe_end = p_buf + FFMIN(2 * SPDIF_MAX_OFFSET, buf_size - 1); + const uint8_t *probe_end = p_buf + FFMIN(2 * SPDIF_MAX_OFFSET + 1, buf_size - 1); const uint8_t *expected_code = buf + 7; uint32_t state = 0; int sync_codes = 0; @@ -146,7 +145,7 @@ int ff_spdif_probe(const uint8_t *p_buf, int buf_size, enum AVCodecID *codec) break; /* continue probing to find more sync codes */ - probe_end = FFMIN(buf + SPDIF_MAX_OFFSET, p_buf + buf_size - 1); + probe_end = FFMIN(buf + SPDIF_MAX_OFFSET + 1, p_buf + buf_size - 1); /* skip directly to the next sync code */ if (!spdif_get_offset_and_codec(NULL, (buf[2] << 8) | buf[1], @@ -234,10 +233,7 @@ int ff_spdif_read_packet(AVFormatContext *s, AVPacket *pkt) } st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->codec_id = codec_id; - if (codec_id == AV_CODEC_ID_EAC3) - ffstream(st)->need_parsing = AVSTREAM_PARSE_FULL; - else - ffstream(st)->need_parsing = AVSTREAM_PARSE_HEADERS; + ffstream(st)->need_parsing = AVSTREAM_PARSE_HEADERS; } else if (codec_id != s->streams[0]->codecpar->codec_id) { avpriv_report_missing_feature(s, "Codec change in IEC 61937"); return AVERROR_PATCHWELCOME; -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org