fix pes overhead computation, patch by Niobos, niobos at dest-unreach dot be

Originally committed as revision 19902 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Niobos 2009-09-17 19:07:09 +00:00 committed by Baptiste Coudurier
parent bb8cd7b3cf
commit 9deba199fd
2 changed files with 14 additions and 6 deletions

View File

@ -428,10 +428,18 @@ static int mpegts_write_header(AVFormatContext *s)
total_bit_rate += st->codec->bit_rate;
/* PES header size */
if (st->codec->codec_type == CODEC_TYPE_VIDEO ||
st->codec->codec_type == CODEC_TYPE_SUBTITLE)
total_bit_rate += 25 * 8 / av_q2d(st->codec->time_base);
else
total_bit_rate += total_bit_rate * 25 / DEFAULT_PES_PAYLOAD_SIZE;
st->codec->codec_type == CODEC_TYPE_SUBTITLE) {
/* 1 PES per frame
* 19 bytes of PES header
* on average a half TS-packet (184/2) of padding-overhead every PES */
total_bit_rate += (19 + 184/2)*8 / av_q2d(st->codec->time_base);
} else {
/* 1 PES per DEFAULT_PES_PAYLOAD_SIZE bytes of audio data
* 14 bytes of PES header
* on average a half TS-packet (184/2) of padding-overhead every PES */
total_bit_rate += (14 + 184/2) *
st->codec->bit_rate / DEFAULT_PES_PAYLOAD_SIZE;
}
}
/* if no video stream, use the first stream as PCR */

View File

@ -15,8 +15,8 @@ e36a005ecca9add8bda6e0655d03716f *./tests/data/b-lavf.mpg
b3174e2db508564c1cce0b5e3c1bc1bd *./tests/data/b-lavf.mxf_d10
5330989 ./tests/data/b-lavf.mxf_d10
./tests/data/b-lavf.mxf_d10 CRC=0xc3f4f92e
34c47c149402e602c87455c4276ea0a5 *./tests/data/b-lavf.ts
438792 ./tests/data/b-lavf.ts
5db794c5f69f934bbcdbe32de1df9f3a *./tests/data/b-lavf.ts
436160 ./tests/data/b-lavf.ts
./tests/data/b-lavf.ts CRC=0x133216c1
62c5aeb636fc82cf6ba6277d36e42cb5 *./tests/data/b-lavf.swf
329479 ./tests/data/b-lavf.swf