Revision c69d2241 libavformat/mpegtsenc.c

View differences:

libavformat/mpegtsenc.c
426 426
            service->pcr_pid == 0x1fff)
427 427
            service->pcr_pid = ts_st->pid;
428 428
        total_bit_rate += st->codec->bit_rate;
429
        /* PES header size */
430
        if (st->codec->codec_type == CODEC_TYPE_VIDEO ||
431
            st->codec->codec_type == CODEC_TYPE_SUBTITLE)
432
            total_bit_rate += 25 * 8 / av_q2d(st->codec->time_base);
433
        else
434
            total_bit_rate += total_bit_rate * 25 / DEFAULT_PES_PAYLOAD_SIZE;
429 435
    }
430 436

  
431 437
    /* if no video stream, use the first stream as PCR */
......
458 464
    pat_pmt_size = url_ftell(s->pb) - pos;
459 465

  
460 466
    total_bit_rate +=
461
        total_bit_rate * 25 / DEFAULT_PES_PAYLOAD_SIZE + /* PES header size */
462 467
        total_bit_rate *  4 / TS_PACKET_SIZE           + /* TS  header size */
463 468
        SDT_RETRANS_TIME * 8 * sdt_size     / 1000     + /* SDT size */
464 469
        PAT_RETRANS_TIME * 8 * pat_pmt_size / 1000     + /* PAT+PMT size */

Also available in: Unified diff