- 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) {
- /* 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;