[FFmpeg-cvslog] r19902 - in trunk: libavformat/mpegtsenc.c tests/lavf.regression.ref

bcoudurier subversion
Thu Sep 17 21:07:09 CEST 2009


Author: bcoudurier
Date: Thu Sep 17 21:07:09 2009
New Revision: 19902

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

Modified:
   trunk/libavformat/mpegtsenc.c
   trunk/tests/lavf.regression.ref

Modified: trunk/libavformat/mpegtsenc.c
==============================================================================
--- trunk/libavformat/mpegtsenc.c	Thu Sep 17 20:57:22 2009	(r19901)
+++ trunk/libavformat/mpegtsenc.c	Thu Sep 17 21:07:09 2009	(r19902)
@@ -428,10 +428,18 @@ static int mpegts_write_header(AVFormatC
         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 */

Modified: trunk/tests/lavf.regression.ref
==============================================================================
--- trunk/tests/lavf.regression.ref	Thu Sep 17 20:57:22 2009	(r19901)
+++ trunk/tests/lavf.regression.ref	Thu Sep 17 21:07:09 2009	(r19902)
@@ -15,8 +15,8 @@ e36a005ecca9add8bda6e0655d03716f *./test
 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



More information about the ffmpeg-cvslog mailing list