From: "Jan Ekström" <jeebjp@gmail.com> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH] mlp_parser: fetch a new timestamp when major sync is found Date: Mon, 7 Mar 2022 00:32:59 +0200 Message-ID: <20220306223259.9491-1-jeebjp@gmail.com> (raw) From: Hendrik Leppkes <h.leppkes@gmail.com> Decoding can only start on a major sync and the parser discards any data received until that point. Therefore, previously received timestamps are no longer relevant to the data being returned from the parser. Additionally, adds a test which remuxes an existing TrueHD sample with the first keyframe dropped using copyinkf, and then demuxes this remux with ffprobe. Previously this would have pushed the first random access point packet out as pts=1, even though it would have contained the data received from packet containing pts=13. With this fix, the first data received from the parser properly contains the pts of the packet in which it was contained. Fixes #9428 Co-authored-by: Jan Ekström <jeebjp@gmail.com> --- libavcodec/mlp_parser.c | 1 + tests/fate/truehd.mak | 12 ++++++++++++ tests/ref/fate/truehd-parser-timestamps | 26 +++++++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 tests/ref/fate/truehd-parser-timestamps diff --git a/libavcodec/mlp_parser.c b/libavcodec/mlp_parser.c index 9fea7db955..70d7b3f601 100644 --- a/libavcodec/mlp_parser.c +++ b/libavcodec/mlp_parser.c @@ -96,6 +96,7 @@ static int mlp_parse(AVCodecParserContext *s, return ret; } + s->fetch_timestamp = 1; return i - 7; } diff --git a/tests/fate/truehd.mak b/tests/fate/truehd.mak index 7da8c93cff..6f451cc327 100644 --- a/tests/fate/truehd.mak +++ b/tests/fate/truehd.mak @@ -13,5 +13,17 @@ fate-truehd-core-bsf: CMD = md5pipe -i $(TARGET_SAMPLES)/truehd/atmos.thd -c:a c fate-truehd-core-bsf: CMP = oneline fate-truehd-core-bsf: REF = 3aa5d0c7825051f3657b71fd6135183b +# Tests that the result from reading a copyinkf remux with the first random +# access point dropped will receive the correct timestamp for the first packet, +# which is not the packet of the first packet read. +FATE_TRUEHD-$(call ALLYES, FILE_PROTOCOL PIPE_PROTOCOL TRUEHD_DEMUXER \ + MLP_PARSER MATROSKA_MUXER NOISE_BSF) \ + += fate-truehd-parser-timestamps +fate-truehd-parser-timestamps: CMD = stream_remux "truehd" \ + "$(TARGET_SAMPLES)/lossless-audio/truehd_5.1.raw" "matroska" \ + "-map 0:a -copyinkf -bsf:a noise=drop=not\(n\)*key -t 0.030" \ + "-c copy -copyts" +fate-truehd-parser-timestamps: CMP = diff + FATE_SAMPLES_AUDIO += $(FATE_TRUEHD-yes) fate-truehd: $(FATE_TRUEHD-yes) diff --git a/tests/ref/fate/truehd-parser-timestamps b/tests/ref/fate/truehd-parser-timestamps new file mode 100644 index 0000000000..94d5a05640 --- /dev/null +++ b/tests/ref/fate/truehd-parser-timestamps @@ -0,0 +1,26 @@ +#tb 0: 1/1000 +#media_type 0: audio +#codec_id 0: truehd +#sample_rate 0: 48000 +#channel_layout 0: 60f +#channel_layout_name 0: 5.1(side) +0, 13, 13, 1, 368, 0x256aaaad +0, 14, 14, 1, 190, 0x7b975b90, F=0x0 +0, 15, 15, 1, 178, 0xfdc85dc0, F=0x0 +0, 16, 16, 1, 184, 0x3a605a1c, F=0x0 +0, 17, 17, 1, 184, 0xf00e5aef, F=0x0 +0, 18, 18, 1, 186, 0x95125c74, F=0x0 +0, 18, 18, 1, 184, 0xc6ae624e, F=0x0 +0, 19, 19, 1, 186, 0x5f9e5de9, F=0x0 +0, 20, 20, 1, 188, 0x80135cc7, F=0x0 +0, 21, 21, 1, 188, 0x10dc5a3d, F=0x0 +0, 22, 22, 1, 188, 0x63ff5980, F=0x0 +0, 23, 23, 1, 198, 0x42265ec5, F=0x0 +0, 23, 23, 1, 210, 0x4d2f6d78, F=0x0 +0, 24, 24, 1, 202, 0x44b6654f, F=0x0 +0, 25, 25, 1, 192, 0x098e6271, F=0x0 +0, 26, 26, 1, 194, 0x090f691d, F=0x0 +0, 27, 27, 1, 382, 0x88b0ac79 +0, 28, 28, 1, 196, 0xf0765d20, F=0x0 +0, 28, 28, 1, 188, 0x72c65e8d, F=0x0 +0, 29, 29, 1, 186, 0x913a5fcb, F=0x0 -- 2.35.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next reply other threads:[~2022-03-06 22:33 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-03-06 22:32 Jan Ekström [this message] 2022-03-07 17:10 ` Michael Niedermayer 2022-03-07 21:55 ` Hendrik Leppkes 2022-03-07 22:02 ` Jan Ekström
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220306223259.9491-1-jeebjp@gmail.com \ --to=jeebjp@gmail.com \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git