]> git.sesse.net Git - ffmpeg/commit
avformat/mpegtsenc: fix flushing of audio packets
authorMarton Balint <cus@passwd.hu>
Sun, 25 Aug 2019 23:05:40 +0000 (01:05 +0200)
committerMarton Balint <cus@passwd.hu>
Mon, 2 Sep 2019 19:44:25 +0000 (21:44 +0200)
commitf4eb7d84a7c219eac130750417e4bc2cbbff7b3f
tree33a5b08a59bbecb865d287ed331c3b99bcccf8ca
parent73e0035812cc6e864a6c6b5de964b126bc0db5c3
avformat/mpegtsenc: fix flushing of audio packets

7d097a0fc57f0fa8385962a539c657c2f40b5ed0 had the same purpose as
3700f655c55e2001b57215210b957b169d66b50f but the former is much simpler, so
let's remove the latter.

Unfortunately both checks were wrong, because in order to make sure DTS > PCR
we have to give us some headroom, so instead of using a dts_difference <
max_delay check let's use a dts_difference < max_delay/2 check.

Fixes DTS < PCR errors with this command line:

./ffmpeg -loglevel verbose -y -f lavfi -i \
  "testsrc=s=64x64:d=20,split=2[out0][tmp1];[tmp1]vflip[out1];sine=d=20,asetnsamples=1000[out2]" \
  -flags +bitexact -fflags +bitexact -sws_flags +accurate_rnd+bitexact  \
  -codec:v libx264 -codec:a mp2 -b:a 32k -pix_fmt yuv420p \
  -map '0:v:0' \
  -map '0:v:1' \
  -map '0:a:0'  \
  -muxrate 800000 \
  -program st=0:st=2 -program st=1:st=2 -program st=2 -program st=0 -f mpegts out1.ts

Signed-off-by: Marton Balint <cus@passwd.hu>
libavformat/mpegtsenc.c