libavformat/mp3enc.c:158: error: Uninitialized Value
  The value read from srate_idx was never initialized.

libavformat/mp3enc.c:158:5: 
156.     header  =  0xff                                  << 24; // sync
157.     header |= (0x7 << 5 | ver << 3 | 0x1 << 1 | 0x1) << 16; // sync/audio-version/layer 3/no crc*/
158.     header |= (bitrate_idx << 4 | srate_idx << 2)    <<  8;
         ^
159.     header |= channels << 6;
160.     avio_wb32(s->pb, header);

static void mp3_write_xing(AVFormatContext *s)
{
    MP3Context       *mp3 = s->priv_data;
    AVCodecContext *codec = s->streams[mp3->audio_stream_idx]->codec;
    int32_t        header;
    MPADecodeHeader  mpah;
    int srate_idx, i, channels;
    int bitrate_idx;
    int xing_offset;
    int ver = 0;
    if (!s->pb->seekable)
        return;
    for (i = 0; i < FF_ARRAY_ELEMS(avpriv_mpa_freq_tab); i++) {
        const uint16_t base_freq = avpriv_mpa_freq_tab[i];
        if      (codec->sample_rate == base_freq)     ver = 0x3;
        else if (codec->sample_rate == base_freq / 2) ver = 0x2;
        else if (codec->sample_rate == base_freq / 4) ver = 0x0;
        else continue;
        srate_idx = i;
        break;
    }
    if (i == FF_ARRAY_ELEMS(avpriv_mpa_freq_tab)) {
        av_log(s, AV_LOG_WARNING, "Unsupported sample rate, not writing Xing "
               "header.\n");
        return;
    }
    switch (codec->channels) {
    case 1:  channels = MPA_MONO;                                          break;
    case 2:  channels = MPA_STEREO;                                        break;
    default: av_log(s, AV_LOG_WARNING, "Unsupported number of channels, "
                    "not writing Xing header.\n");
             return;
    }
    bitrate_idx = (ver == 3) ? 5 : 8;
    header  =  0xff                                  << 24;
    header |= (0x7 << 5 | ver << 3 | 0x1 << 1 | 0x1) << 16;
    header |= (bitrate_idx << 4 | srate_idx << 2)    <<  8;
    header |= channels << 6;
    avio_wb32(s->pb, header);
    avpriv_mpegaudio_decode_header(&mpah, header);
    av_assert0(mpah.frame_size >= XING_MAX_SIZE);
    xing_offset = xing_offtbl[ver != 3][codec->channels == 1];
    ffio_fill(s->pb, 0, xing_offset);
    mp3->xing_offset = avio_tell(s->pb);
    ffio_wfourcc(s->pb, "Xing");
    avio_wb32(s->pb, 0x01 | 0x02 | 0x04);
    mp3->size = mpah.frame_size;
    mp3->want = 1;
    avio_wb32(s->pb, 0);
    avio_wb32(s->pb, 0);
    for (i = 0; i < XING_TOC_SIZE; i++)
        avio_w8(s->pb, 255 * i / XING_TOC_SIZE);
    mpah.frame_size -= 4 + xing_offset + 4 + 4 + 4 + 4 + XING_TOC_SIZE;
    ffio_fill(s->pb, 0, mpah.frame_size);
}
['static void mp3_write_xing(AVFormatContext *s)\n{\n    MP3Context       *mp3 = s->priv_data;\n    AVCodecContext *codec = s->streams[mp3->audio_stream_idx]->codec;\n    int32_t        header;\n    MPADecodeHeader  mpah;\n    int srate_idx, i, channels;\n    int bitrate_idx;\n    int xing_offset;\n    int ver = 0;\n    if (!s->pb->seekable)\n        return;\n    for (i = 0; i < FF_ARRAY_ELEMS(avpriv_mpa_freq_tab); i++) {\n        const uint16_t base_freq = avpriv_mpa_freq_tab[i];\n        if      (codec->sample_rate == base_freq)     ver = 0x3;\n        else if (codec->sample_rate == base_freq / 2) ver = 0x2;\n        else if (codec->sample_rate == base_freq / 4) ver = 0x0;\n        else continue;\n        srate_idx = i;\n        break;\n    }\n    if (i == FF_ARRAY_ELEMS(avpriv_mpa_freq_tab)) {\n        av_log(s, AV_LOG_WARNING, "Unsupported sample rate, not writing Xing "\n               "header.\\n");\n        return;\n    }\n    switch (codec->channels) {\n    case 1:  channels = MPA_MONO;                                          break;\n    case 2:  channels = MPA_STEREO;                                        break;\n    default: av_log(s, AV_LOG_WARNING, "Unsupported number of channels, "\n                    "not writing Xing header.\\n");\n             return;\n    }\n    bitrate_idx = (ver == 3) ? 5 : 8;\n    header  =  0xff                                  << 24;\n    header |= (0x7 << 5 | ver << 3 | 0x1 << 1 | 0x1) << 16;\n    header |= (bitrate_idx << 4 | srate_idx << 2)    <<  8;\n    header |= channels << 6;\n    avio_wb32(s->pb, header);\n    avpriv_mpegaudio_decode_header(&mpah, header);\n    av_assert0(mpah.frame_size >= XING_MAX_SIZE);\n    xing_offset = xing_offtbl[ver != 3][codec->channels == 1];\n    ffio_fill(s->pb, 0, xing_offset);\n    mp3->xing_offset = avio_tell(s->pb);\n    ffio_wfourcc(s->pb, "Xing");\n    avio_wb32(s->pb, 0x01 | 0x02 | 0x04);\n    mp3->size = mpah.frame_size;\n    mp3->want = 1;\n    avio_wb32(s->pb, 0);\n    avio_wb32(s->pb, 0);\n    for (i = 0; i < XING_TOC_SIZE; i++)\n        avio_w8(s->pb, 255 * i / XING_TOC_SIZE);\n    mpah.frame_size -= 4 + xing_offset + 4 + 4 + 4 + 4 + XING_TOC_SIZE;\n    ffio_fill(s->pb, 0, mpah.frame_size);\n}']