mirror of https://git.ffmpeg.org/ffmpeg.git
e5e5be4c7f
The flac parser uses a fifo to buffer its data. Consequently, when searching for sync codes of flac packets, one needs to take care of the possibility of wraparound. This is done by using an optimized start code search that works on each of the continuous buffers separately and by explicitly checking whether the last pre-wrap byte and the first post-wrap byte constitute a valid sync code. Moreover, the last MAX_FRAME_HEADER_SIZE - 1 bytes ought not to be searched for (the start of) a sync code because a header that might be found in this region might not be completely available. These bytes ought to be searched lateron when more data is available or when flushing. Unfortunately there was an off-by-one error in the calculation of the length to search of the post-wrap buffer: It was too large, because the calculation was based on the amount of bytes available in the fifo from the last pre-wrap byte onwards. This meant that a header might be parsed twice (once prematurely and once regularly when more data is available); it could also mean that an invalid header will be treated as valid (namely if the length of said invalid header is MAX_FRAME_HEADER_SIZE and the invalid byte that will be treated as the last byte of this potential header happens to be the right CRC-8). Should a header be parsed twice, the second instance will be the best child of the first instance; the first instance's score will be FLAC_HEADER_BASE_SCORE - FLAC_HEADER_CHANGED_PENALTY ( = 3) higher than the second instance's score. So the frame belonging to the first instance will be output and it will be done as a zero length frame (the difference of the header's offset and the child's offset). This has serious consequences when flushing, as returning a zero length buffer signals to the caller that no more data will be output; consequently the last frames not yet output will be dropped. Furthermore, a "sample/frame number mismatch in adjacent frames" warning got output when returning the zero-length frame belonging to the first header, because the child's sample/frame number of course didn't match the expected sample frame/number given its parent. filter/hdcd-mix.flac from the FATE-suite was affected by this (the last frame was omitted) which is the reason why several FATE-tests needed to be updated. Fixes ticket #5937. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> |
||
---|---|---|
.. | ||
aac.mak | ||
ac3.mak | ||
acodec.mak | ||
adpcm.mak | ||
alac.mak | ||
als.mak | ||
amrnb.mak | ||
amrwb.mak | ||
api.mak | ||
apng.mak | ||
atrac.mak | ||
audio.mak | ||
bmp.mak | ||
build.mak | ||
canopus.mak | ||
cbs.mak | ||
cdxl.mak | ||
checkasm.mak | ||
concatdec.mak | ||
cover-art.mak | ||
dca.mak | ||
demux.mak | ||
dfa.mak | ||
dnn.mak | ||
dnxhd.mak | ||
dpcm.mak | ||
ea.mak | ||
exif.mak | ||
ffmpeg.mak | ||
ffprobe.mak | ||
fft.mak | ||
fifo-muxer.mak | ||
filter-audio.mak | ||
filter-video.mak | ||
fits.mak | ||
flac.mak | ||
flvenc.mak | ||
gapless.mak | ||
gif.mak | ||
h264.mak | ||
hap.mak | ||
hevc.mak | ||
hlsenc.mak | ||
hw.mak | ||
id3v2.mak | ||
image.mak | ||
indeo.mak | ||
lavf-audio.mak | ||
lavf-container.mak | ||
lavf-image.mak | ||
lavf-image2pipe.mak | ||
lavf-video.mak | ||
libavcodec.mak | ||
libavdevice.mak | ||
libavformat.mak | ||
libavresample.mak | ||
libavutil.mak | ||
libswresample.mak | ||
libswscale.mak | ||
lossless-audio.mak | ||
lossless-video.mak | ||
matroska.mak | ||
microsoft.mak | ||
monkeysaudio.mak | ||
mov.mak | ||
mp3.mak | ||
mpc.mak | ||
mpeg4.mak | ||
mpegps.mak | ||
mpegts.mak | ||
mxf.mak | ||
opus.mak | ||
pcm.mak | ||
pixfmt.mak | ||
pixlet.mak | ||
probe.mak | ||
prores.mak | ||
qt.mak | ||
qtrle.mak | ||
real.mak | ||
screen.mak | ||
seek.mak | ||
segment.mak | ||
source-check.sh | ||
source.mak | ||
speedhq.mak | ||
subtitles.mak | ||
utvideo.mak | ||
vcodec.mak | ||
video.mak | ||
voice.mak | ||
vorbis.mak | ||
vpx.mak | ||
vqf.mak | ||
wavpack.mak | ||
wma.mak | ||
xvid.mak |