• Marton Balint's avatar
    avformat/mpegtsenc: fix flushing of audio packets · f4eb7d84
    Marton Balint authored
    7d097a0f had the same purpose as
    3700f655 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: 's avatarMarton Balint <cus@passwd.hu>
    f4eb7d84
mpegtsenc.c 71.4 KB