avformat/mpegtsenc: use total_size instead of avio_tell()
avio_tell() fails to get the amount of data written so far when the
underlying IO context is flushed to segments.
Please test with below command:
$ ./ffmpeg -f lavfi -i testsrc=duration=100:size=vga -c:v libx264 -x264opts \
nal-hrd=cbr:force-cfr=1 -b:v 500k -minrate 500k -maxrate 500k -bufsize 500k \
-f hls -hls_time 10 -hls_ts_options "muxrate=
2000000" test%d.ts
$ du -h test*.ts
Before:
2.4M test00.ts
4.8M test11.ts
7.2M test22.ts
9.6M test33.ts
12M test44.ts
...
After apply the patch:
2.4M test00.ts
2.4M test11.ts
2.4M test22.ts
2.4M test33.ts
2.4M test44.ts
...
Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>