Commit 31df40a1 authored by Baptiste Coudurier's avatar Baptiste Coudurier

fix total bitrate computation, based on patch by corp186, chasedouglas at gmail dot com

Originally committed as revision 18778 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 7574dc4c
...@@ -456,11 +456,11 @@ static int mpegts_write_header(AVFormatContext *s) ...@@ -456,11 +456,11 @@ static int mpegts_write_header(AVFormatContext *s)
pat_pmt_size = url_ftell(s->pb) - pos; pat_pmt_size = url_ftell(s->pb) - pos;
total_bit_rate += total_bit_rate +=
total_bit_rate * 25 / (8 * DEFAULT_PES_PAYLOAD_SIZE) + /* PES header size */ total_bit_rate * 25 / DEFAULT_PES_PAYLOAD_SIZE + /* PES header size */
total_bit_rate * 4 / (8 * TS_PACKET_SIZE) + /* TS header size */ total_bit_rate * 4 / TS_PACKET_SIZE + /* TS header size */
SDT_RETRANS_TIME * sdt_size + /* SDT size */ SDT_RETRANS_TIME * 8 * sdt_size / 1000 + /* SDT size */
PAT_RETRANS_TIME * pat_pmt_size + /* PAT+PMT size */ PAT_RETRANS_TIME * 8 * pat_pmt_size / 1000 + /* PAT+PMT size */
PCR_RETRANS_TIME * 8; /* PCR size */ PCR_RETRANS_TIME * 8 * 8 / 1000; /* PCR size */
av_log(s, AV_LOG_DEBUG, "muxrate %d freq sdt %d pat %d\n", av_log(s, AV_LOG_DEBUG, "muxrate %d freq sdt %d pat %d\n",
total_bit_rate, ts->sdt_packet_freq, ts->pat_packet_freq); total_bit_rate, ts->sdt_packet_freq, ts->pat_packet_freq);
......
...@@ -15,7 +15,7 @@ bdb7484c68db722f66ba1630cf79844c *./tests/data/b-lavf.mpg ...@@ -15,7 +15,7 @@ bdb7484c68db722f66ba1630cf79844c *./tests/data/b-lavf.mpg
0a7cc51de3da754ce36dffeeda290c45 *./tests/data/b-lavf.mxf_d10 0a7cc51de3da754ce36dffeeda290c45 *./tests/data/b-lavf.mxf_d10
5330989 ./tests/data/b-lavf.mxf_d10 5330989 ./tests/data/b-lavf.mxf_d10
./tests/data/b-lavf.mxf_d10 CRC=0xd241c8b6 ./tests/data/b-lavf.mxf_d10 CRC=0xd241c8b6
c0cc2ae4df6a8b3df84986929a393116 *./tests/data/b-lavf.ts 368950c12c4ba186725b757ec5625085 *./tests/data/b-lavf.ts
471316 ./tests/data/b-lavf.ts 471316 ./tests/data/b-lavf.ts
./tests/data/b-lavf.ts CRC=0xcc4948e1 ./tests/data/b-lavf.ts CRC=0xcc4948e1
1b28a16652bb8ac528b33f7478ca18b6 *./tests/data/b-lavf.swf 1b28a16652bb8ac528b33f7478ca18b6 *./tests/data/b-lavf.swf
......
...@@ -3605,57 +3605,57 @@ ret:-1 st:-1 ts:-0.645825 flags:1 ...@@ -3605,57 +3605,57 @@ ret:-1 st:-1 ts:-0.645825 flags:1
tests/data/b-lavf.ts tests/data/b-lavf.ts
ret: 0 st: 0 dts:0.660000 pts:0.700000 pos:564 size:24921 flags:1 ret: 0 st: 0 dts:0.660000 pts:0.700000 pos:564 size:24921 flags:1
ret: 0 st:-1 ts:-1.000000 flags:0 ret: 0 st:-1 ts:-1.000000 flags:0
ret: 0 st: 0 dts:0.030522 pts:-102481911520608.625000 pos:29328 size:22036 flags:1 ret: 0 st: 0 dts:0.044344 pts:-102481911520608.625000 pos:29328 size:22036 flags:1
ret: 0 st:-1 ts:1.894167 flags:1 ret: 0 st:-1 ts:1.894167 flags:1
ret: 0 st: 0 dts:1.887078 pts:-102481911520608.625000 pos:29328 size:7907 flags:1 ret: 0 st: 0 dts:1.881344 pts:-102481911520608.625000 pos:29328 size:3142 flags:1
ret: 0 st: 0 ts:0.788333 flags:0 ret: 0 st: 0 ts:0.788333 flags:0
ret: 0 st: 0 dts:0.795878 pts:-102481911520608.625000 pos:101520 size:9043 flags:1 ret: 0 st: 0 dts:0.803344 pts:-102481911520608.625000 pos:68996 size:1524 flags:1
ret: 0 st: 0 ts:-0.317500 flags:1 ret: 0 st: 0 ts:-0.317500 flags:1
ret: 0 st: 0 dts:0.019156 pts:-102481911520608.625000 pos:50948 size:22036 flags:1 ret: 0 st: 0 dts:0.027844 pts:-102481911520608.625000 pos:29328 size:22036 flags:1
ret: 0 st: 1 ts:2.576667 flags:0 ret: 0 st: 1 ts:2.576667 flags:0
ret: 0 st: 0 dts:2.580444 pts:-102481911520608.625000 pos:29328 size:5727 flags:1 ret: 0 st: 0 dts:2.590844 pts:-102481911520608.625000 pos:29328 size:10829 flags:1
ret: 0 st: 1 ts:1.470833 flags:1 ret: 0 st: 1 ts:1.470833 flags:1
ret: 0 st: 0 dts:1.466511 pts:-102481911520608.625000 pos:134044 size:10244 flags:1 ret: 0 st: 0 dts:1.468844 pts:-102481911520608.625000 pos:50948 size:14870 flags:0
ret: 0 st:-1 ts:0.365002 flags:0 ret: 0 st:-1 ts:0.365002 flags:0
ret: 0 st: 0 dts:0.379100 pts:-102481911520608.625000 pos:83472 size:7376 flags:1 ret: 0 st: 0 dts:0.374344 pts:-102481911520608.625000 pos:68996 size:13236 flags:1
ret: 0 st:-1 ts:-0.740831 flags:1 ret: 0 st:-1 ts:-0.740831 flags:1
ret: 0 st: 0 dts:0.019156 pts:-102481911520608.625000 pos:29328 size:22036 flags:1 ret: 0 st: 0 dts:0.027844 pts:-102481911520608.625000 pos:29328 size:22036 flags:1
ret: 0 st: 0 ts:2.153333 flags:0 ret: 0 st: 0 ts:2.153333 flags:0
ret: 0 st: 0 dts:2.156089 pts:-102481911520608.625000 pos:29328 size:8674 flags:1 ret: 0 st: 0 dts:2.167344 pts:-102481911520608.625000 pos:29328 size:8612 flags:1
ret: 0 st: 0 ts:1.047500 flags:1 ret: 0 st: 0 ts:1.047500 flags:1
ret: 0 st: 0 dts:1.042156 pts:-102481911520608.625000 pos:115996 size:11942 flags:1 ret: 0 st: 0 dts:1.039844 pts:-102481911520608.625000 pos:83472 size:11965 flags:1
ret: 0 st: 1 ts:-0.058333 flags:0 ret: 0 st: 1 ts:-0.058333 flags:0
ret: 0 st: 0 dts:0.030522 pts:-102481911520608.625000 pos:68996 size:22036 flags:1 ret: 0 st: 0 dts:0.044344 pts:-102481911520608.625000 pos:50948 size:22036 flags:1
ret: 0 st: 1 ts:2.835833 flags:1 ret: 0 st: 1 ts:2.835833 flags:1
ret: 0 st: 0 dts:2.822933 pts:-102481911520608.625000 pos:29328 size:10429 flags:1 ret: 0 st: 0 dts:2.832844 pts:-102481911520608.625000 pos:29328 size:4969 flags:1
ret: 0 st:-1 ts:1.730004 flags:0 ret: 0 st:-1 ts:1.730004 flags:0
ret: 0 st: 0 dts:1.731733 pts:-102481911520608.625000 pos:152092 size:13769 flags:1 ret: 0 st: 0 dts:1.738344 pts:-102481911520608.625000 pos:101520 size:6080 flags:1
ret: 0 st:-1 ts:0.624171 flags:1 ret: 0 st:-1 ts:0.624171 flags:1
ret: 0 st: 0 dts:0.617800 pts:-102481911520608.625000 pos:101520 size:14905 flags:1 ret: 0 st: 0 dts:0.616344 pts:-102481911520608.625000 pos:68996 size:7376 flags:1
ret: 0 st: 0 ts:-0.481667 flags:0 ret: 0 st: 0 ts:-0.481667 flags:0
ret: 0 st: 0 dts:0.030522 pts:-102481911520608.625000 pos:50948 size:22036 flags:1 ret: 0 st: 0 dts:0.044344 pts:-102481911520608.625000 pos:29328 size:22036 flags:1
ret: 0 st: 0 ts:2.412500 flags:1 ret: 0 st: 0 ts:2.412500 flags:1
ret: 0 st: 0 dts:2.406156 pts:-102481911520608.625000 pos:119568 size:13938 flags:1 ret: 0 st: 0 dts:2.403844 pts:-102481911520608.625000 pos:29328 size:2760 flags:1
ret: 0 st: 1 ts:1.306667 flags:0 ret: 0 st: 1 ts:1.306667 flags:0
ret: 0 st: 0 dts:1.314956 pts:-102481911520608.625000 pos:65424 size:3107 flags:1 ret: 0 st: 0 dts:1.309344 pts:-102481911520608.625000 pos:83472 size:3175 flags:1
ret: 0 st: 1 ts:0.200844 flags:1 ret: 0 st: 1 ts:0.200844 flags:1
ret: 0 st: 0 dts:0.193444 pts:-102481911520608.625000 pos:68996 size:16166 flags:1 ret: 0 st: 0 dts:0.187344 pts:-102481911520608.625000 pos:50948 size:19104 flags:1
ret: 0 st:-1 ts:-0.904994 flags:0 ret: 0 st:-1 ts:-0.904994 flags:0
ret: 0 st: 0 dts:0.030522 pts:-102481911520608.625000 pos:29328 size:22036 flags:1 ret: 0 st: 0 dts:0.044344 pts:-102481911520608.625000 pos:29328 size:22036 flags:1
ret: 0 st:-1 ts:1.989173 flags:1 ret: 0 st:-1 ts:1.989173 flags:1
ret: 0 st: 0 dts:1.981800 pts:-102481911520608.625000 pos:29328 size:2039 flags:1 ret: 0 st: 0 dts:1.974844 pts:-102481911520608.625000 pos:68996 size:14472 flags:0
ret: 0 st: 0 ts:0.883344 flags:0 ret: 0 st: 0 ts:0.883344 flags:0
ret: 0 st: 0 dts:0.890600 pts:-102481911520608.625000 pos:101520 size:3175 flags:1 ret: 0 st: 0 dts:0.896844 pts:-102481911520608.625000 pos:83472 size:14905 flags:1
ret: 0 st: 0 ts:-0.222489 flags:1 ret: 0 st: 0 ts:-0.222489 flags:1
ret: 0 st: 0 dts:0.019156 pts:-102481911520608.625000 pos:50948 size:22036 flags:1 ret: 0 st: 0 dts:0.027844 pts:-102481911520608.625000 pos:50948 size:22036 flags:1
ret: 0 st: 1 ts:2.671678 flags:0 ret: 0 st: 1 ts:2.671678 flags:0
ret: 0 st: 0 dts:2.682744 pts:-102481911520608.625000 pos:29328 size:2253 flags:1 ret: 0 st: 0 dts:2.684344 pts:-102481911520608.625000 pos:29328 size:9171 flags:1
ret: 0 st: 1 ts:1.565844 flags:1 ret: 0 st: 1 ts:1.565844 flags:1
ret: 0 st: 0 dts:1.557444 pts:-102481911520608.625000 pos:134044 size:5682 flags:1 ret: 0 st: 0 dts:1.562344 pts:-102481911520608.625000 pos:101520 size:11942 flags:1
ret: 0 st:-1 ts:0.460008 flags:0 ret: 0 st:-1 ts:0.460008 flags:0
ret: 0 st: 0 dts:0.466244 pts:-102481911520608.625000 pos:83472 size:4446 flags:1 ret: 0 st: 0 dts:0.467844 pts:-102481911520608.625000 pos:68996 size:10314 flags:1
ret: 0 st:-1 ts:-0.645825 flags:1 ret: 0 st:-1 ts:-0.645825 flags:1
ret: 0 st: 0 dts:0.019156 pts:-102481911520608.625000 pos:29328 size:22036 flags:1 ret: 0 st: 0 dts:0.027844 pts:-102481911520608.625000 pos:29328 size:22036 flags:1
---------------- ----------------
tests/data/b-lavf.ul tests/data/b-lavf.ul
ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:0 size:1024 flags:1 ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:0 size:1024 flags:1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment