libavformat/mpegts.c:2049: error: Uninitialized Value
  The value read from packet_count[_] was never initialized.

libavformat/mpegts.c:2049:9: 
2047.         /* NOTE2: it is only the bitrate of the start of the stream */
2048.         ts->pcr_incr = (pcrs[1] - pcrs[0]) / (packet_count[1] - packet_count[0]);
2049.         ts->cur_pcr  = pcrs[0] - ts->pcr_incr * packet_count[0];
              ^
2050.         s->bit_rate  = TS_PACKET_SIZE * 8 * 27e6 / ts->pcr_incr;
2051.         st->codec->bit_rate = s->bit_rate;

static int mpegts_read_header(AVFormatContext *s)
{
    MpegTSContext *ts = s->priv_data;
    AVIOContext *pb   = s->pb;
    uint8_t buf[5 * 1024];
    int len;
    int64_t pos;
    pos = avio_tell(pb);
    len = avio_read(pb, buf, sizeof(buf));
    if (len < 0)
        return len;
    if (len != sizeof(buf))
        return AVERROR_BUG;
    ts->raw_packet_size = get_packet_size(buf, sizeof(buf));
    if (ts->raw_packet_size <= 0)
        return AVERROR_INVALIDDATA;
    ts->stream     = s;
    ts->auto_guess = 0;
    if (s->iformat == &ff_mpegts_demuxer) {
        if (avio_seek(pb, pos, SEEK_SET) < 0 && pb->seekable)
            av_log(s, AV_LOG_ERROR, "Unable to seek back to the start\n");
        mpegts_open_section_filter(ts, SDT_PID, sdt_cb, ts, 1);
        mpegts_open_section_filter(ts, PAT_PID, pat_cb, ts, 1);
        handle_packets(ts, s->probesize / ts->raw_packet_size);
        ts->auto_guess = 1;
        av_dlog(ts->stream, "tuning done\n");
        s->ctx_flags |= AVFMTCTX_NOHEADER;
    } else {
        AVStream *st;
        int pcr_pid, pid, nb_packets, nb_pcrs, ret, pcr_l;
        int64_t pcrs[2], pcr_h;
        int packet_count[2];
        uint8_t packet[TS_PACKET_SIZE];
        const uint8_t *data;
        st = avformat_new_stream(s, NULL);
        if (!st)
            return AVERROR(ENOMEM);
        avpriv_set_pts_info(st, 60, 1, 27000000);
        st->codec->codec_type = AVMEDIA_TYPE_DATA;
        st->codec->codec_id   = AV_CODEC_ID_MPEG2TS;
        pcr_pid    = -1;
        nb_pcrs    = 0;
        nb_packets = 0;
        for (;;) {
            ret = read_packet(s, packet, ts->raw_packet_size, &data);
            if (ret < 0)
                return ret;
            pid = AV_RB16(data + 1) & 0x1fff;
            if ((pcr_pid == -1 || pcr_pid == pid) &&
                parse_pcr(&pcr_h, &pcr_l, data) == 0) {
                finished_reading_packet(s, ts->raw_packet_size);
                pcr_pid = pid;
                packet_count[nb_pcrs] = nb_packets;
                pcrs[nb_pcrs] = pcr_h * 300 + pcr_l;
                nb_pcrs++;
                if (nb_pcrs >= 2)
                    break;
            } else {
                finished_reading_packet(s, ts->raw_packet_size);
            }
            nb_packets++;
        }
        ts->pcr_incr = (pcrs[1] - pcrs[0]) / (packet_count[1] - packet_count[0]);
        ts->cur_pcr  = pcrs[0] - ts->pcr_incr * packet_count[0];
        s->bit_rate  = TS_PACKET_SIZE * 8 * 27e6 / ts->pcr_incr;
        st->codec->bit_rate = s->bit_rate;
        st->start_time      = ts->cur_pcr;
        av_dlog(ts->stream, "start=%0.3f pcr=%0.3f incr=%d\n",
                st->start_time / 1000000.0, pcrs[0] / 27e6, ts->pcr_incr);
    }
    avio_seek(pb, pos, SEEK_SET);
    return 0;
}
['static int mpegts_read_header(AVFormatContext *s)\n{\n    MpegTSContext *ts = s->priv_data;\n    AVIOContext *pb   = s->pb;\n    uint8_t buf[5 * 1024];\n    int len;\n    int64_t pos;\n    pos = avio_tell(pb);\n    len = avio_read(pb, buf, sizeof(buf));\n    if (len < 0)\n        return len;\n    if (len != sizeof(buf))\n        return AVERROR_BUG;\n    ts->raw_packet_size = get_packet_size(buf, sizeof(buf));\n    if (ts->raw_packet_size <= 0)\n        return AVERROR_INVALIDDATA;\n    ts->stream     = s;\n    ts->auto_guess = 0;\n    if (s->iformat == &ff_mpegts_demuxer) {\n        if (avio_seek(pb, pos, SEEK_SET) < 0 && pb->seekable)\n            av_log(s, AV_LOG_ERROR, "Unable to seek back to the start\\n");\n        mpegts_open_section_filter(ts, SDT_PID, sdt_cb, ts, 1);\n        mpegts_open_section_filter(ts, PAT_PID, pat_cb, ts, 1);\n        handle_packets(ts, s->probesize / ts->raw_packet_size);\n        ts->auto_guess = 1;\n        av_dlog(ts->stream, "tuning done\\n");\n        s->ctx_flags |= AVFMTCTX_NOHEADER;\n    } else {\n        AVStream *st;\n        int pcr_pid, pid, nb_packets, nb_pcrs, ret, pcr_l;\n        int64_t pcrs[2], pcr_h;\n        int packet_count[2];\n        uint8_t packet[TS_PACKET_SIZE];\n        const uint8_t *data;\n        st = avformat_new_stream(s, NULL);\n        if (!st)\n            return AVERROR(ENOMEM);\n        avpriv_set_pts_info(st, 60, 1, 27000000);\n        st->codec->codec_type = AVMEDIA_TYPE_DATA;\n        st->codec->codec_id   = AV_CODEC_ID_MPEG2TS;\n        pcr_pid    = -1;\n        nb_pcrs    = 0;\n        nb_packets = 0;\n        for (;;) {\n            ret = read_packet(s, packet, ts->raw_packet_size, &data);\n            if (ret < 0)\n                return ret;\n            pid = AV_RB16(data + 1) & 0x1fff;\n            if ((pcr_pid == -1 || pcr_pid == pid) &&\n                parse_pcr(&pcr_h, &pcr_l, data) == 0) {\n                finished_reading_packet(s, ts->raw_packet_size);\n                pcr_pid = pid;\n                packet_count[nb_pcrs] = nb_packets;\n                pcrs[nb_pcrs] = pcr_h * 300 + pcr_l;\n                nb_pcrs++;\n                if (nb_pcrs >= 2)\n                    break;\n            } else {\n                finished_reading_packet(s, ts->raw_packet_size);\n            }\n            nb_packets++;\n        }\n        ts->pcr_incr = (pcrs[1] - pcrs[0]) / (packet_count[1] - packet_count[0]);\n        ts->cur_pcr  = pcrs[0] - ts->pcr_incr * packet_count[0];\n        s->bit_rate  = TS_PACKET_SIZE * 8 * 27e6 / ts->pcr_incr;\n        st->codec->bit_rate = s->bit_rate;\n        st->start_time      = ts->cur_pcr;\n        av_dlog(ts->stream, "start=%0.3f pcr=%0.3f incr=%d\\n",\n                st->start_time / 1000000.0, pcrs[0] / 27e6, ts->pcr_incr);\n    }\n    avio_seek(pb, pos, SEEK_SET);\n    return 0;\n}']