Opened 2 years ago

Last modified 13 months ago

#9765 new defect

Regresion due to "avcodec/wmadec: fix WMA gapless playback"

Reported by: Mika Fischer Owned by:
Priority: important Component: avcodec
Version: git-master Keywords: wma regression
Cc: Mika Fischer Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

I think the commit 19802d170a304f5853d92e01d0513b9e06897d61, which was applied on 2021-09-12 in and is included in n5.0 and n5.0.1 causes a regression.

This is the (shortened) diff for the test decoding in the patch:

  • tests/ref/fate/flcl1905

    diff --git a/tests/ref/fate/flcl1905 b/tests/ref/fate/flcl1905
    index 5f5245ebcf..d702139db8 100644
    a b  
    11packet|[...]|pts=0|pts_time=0.000000|[...]
    2 frame|[...]|pts=0|pts_time=0.000000|[...]
    3 frame|[...]|pts=N/A|pts_time=N/A|[...]
    42frame|[...]|pts=N/A|pts_time=N/A|[...]

As can be seen, the patch causes the first two frames to be dropped, which might be OK to better conform to the MS decoder.

The problem is that only the first frame had the timestamp info from the packet. Since that got dropped, now the first frame decoded from the packet has no timestamp info.

This causes us issues since we assumed that the first audio frame decoded after seeking always has timestamp info.

See also http://ffmpeg.org/pipermail/ffmpeg-devel/2022-April/295763.html

Change History (3)

comment:1 by Carl Eugen Hoyos, 2 years ago

Component: undeterminedavcodec
Keywords: wma regression added
Priority: normalimportant
Version: unspecifiedgit-master

comment:2 by Balling, 13 months ago

For reference Presentation time of first packet is 3000, but 3000 is preroll. The spec says to substract to get 0.

https://web.archive.org/web/20131203084402/http://msdn.microsoft.com/en-us/library/bb643323.aspx

Preroll

Specifies the amount of time to buffer data before starting to play the file, in millisecond units. If this value is nonzero, the Play Duration field and all of the payload Presentation Time fields have been offset by this amount. Therefore, player software must subtract the value in the preroll field from the play duration and presentation times to calculate their actual values.

Also see the https://github.com/mpv-player/mpv/pull/12304#pullrequestreview-1608354046

comment:3 by Balling, 13 months ago

Interesting https://github.com/FFmpeg/FFmpeg/commit/18cd65998bfe9651b1bd9496bba9f641c77920cd#diff-f1f26e789e8648e2975ba7f26adf5eef5bf908c73d5a7fb571a2ef95115055dbR191

packet|codec_type=audio|stream_index=0|pts=360448|pts_time=8.173424|dts=360448|dts_time=8.173424|duration=44|duration_time=0.000998|size=8|pos=65528|flags=K_C

flags=K_C (C means corrupt).

Note: See TracTickets for help on using tickets.