summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBaptiste Coudurier <baptiste.coudurier@gmail.com>2010-01-13 22:23:29 +0000
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>2010-01-13 22:23:29 +0000
commit33931016e51c0c928651996ce28b086dfb7b9385 (patch)
tree5fcd777ed8dbea69b452c6ba7ab3e84d0ec86b33
parent01d6bd525ac964af338c05169f4de473d29ec160 (diff)
downloadffmpeg-streaming-33931016e51c0c928651996ce28b086dfb7b9385.zip
ffmpeg-streaming-33931016e51c0c928651996ce28b086dfb7b9385.tar.gz
use codec rc_max_rate if set and warn if bit rate is not set
Originally committed as revision 21204 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavformat/mpegtsenc.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index be30e68..9b12af7 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -425,7 +425,16 @@ static int mpegts_write_header(AVFormatContext *s)
if (st->codec->codec_type == CODEC_TYPE_VIDEO &&
service->pcr_pid == 0x1fff)
service->pcr_pid = ts_st->pid;
- total_bit_rate += st->codec->bit_rate;
+ if (st->codec->rc_max_rate)
+ total_bit_rate += st->codec->rc_max_rate;
+ else {
+ if (!st->codec->bit_rate) {
+ av_log(s, AV_LOG_WARNING,
+ "stream %d, bit rate is not set, this will cause problems\n",
+ st->index);
+ }
+ 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) {
OpenPOWER on IntegriCloud