Ticket #5044: fix-mpegtsenc-cbr-scaling.patch

File fix-mpegtsenc-cbr-scaling.patch, 1.1 KB (added by fabled, 11 years ago)

fix

  • libavformat/mpegtsenc.c

    diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
    index 468bad4..8c0987c 100644
    a b static int mpegts_write_header(AVFormatContext *s)  
    852852        ts_st = pcr_st->priv_data;
    853853
    854854    if (ts->mux_rate > 1) {
    855         service->pcr_packet_period = (ts->mux_rate * ts->pcr_period) /
    856                                      (TS_PACKET_SIZE * 8 * 1000);
    857         ts->sdt_packet_period      = (ts->mux_rate * SDT_RETRANS_TIME) /
    858                                      (TS_PACKET_SIZE * 8 * 1000);
    859         ts->pat_packet_period      = (ts->mux_rate * PAT_RETRANS_TIME) /
    860                                      (TS_PACKET_SIZE * 8 * 1000);
     855        service->pcr_packet_period = av_rescale(ts->pcr_period,   ts->mux_rate, TS_PACKET_SIZE * 8 * 1000);
     856        ts->sdt_packet_period      = av_rescale(SDT_RETRANS_TIME, ts->mux_rate, TS_PACKET_SIZE * 8 * 1000);
     857        ts->pat_packet_period      = av_rescale(PAT_RETRANS_TIME, ts->mux_rate, TS_PACKET_SIZE * 8 * 1000);
    861858
    862859        if (ts->copyts < 1)
    863860            ts->first_pcr = av_rescale(s->max_delay, PCR_TIME_BASE, AV_TIME_BASE);