libavformat/flvenc.c:501: error: Uninitialized Value
  The value read from flags was never initialized.

libavformat/flvenc.c:501:5: 
499.         avio_wb32(pb, data_size + 11);
500.     } else {
501.     avio_w8(pb,flags);
         ^
502.     if (enc->codec_id == CODEC_ID_VP6)
503.         avio_w8(pb,0);

static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
{
    AVIOContext *pb = s->pb;
    AVCodecContext *enc = s->streams[pkt->stream_index]->codec;
    FLVContext *flv = s->priv_data;
    FLVStreamContext *sc = s->streams[pkt->stream_index]->priv_data;
    unsigned ts;
    int size= pkt->size;
    uint8_t *data= NULL;
    int flags, flags_size;
    if(enc->codec_id == CODEC_ID_VP6 || enc->codec_id == CODEC_ID_VP6F ||
       enc->codec_id == CODEC_ID_AAC)
        flags_size= 2;
    else if(enc->codec_id == CODEC_ID_H264)
        flags_size= 5;
    else
        flags_size= 1;
    switch (enc->codec_type) {
    case AVMEDIA_TYPE_VIDEO:
        avio_w8(pb, FLV_TAG_TYPE_VIDEO);
        flags = enc->codec_tag;
        if(flags == 0) {
            av_log(s, AV_LOG_ERROR, "video codec %X not compatible with flv\n",enc->codec_id);
            return -1;
        }
        flags |= pkt->flags & AV_PKT_FLAG_KEY ? FLV_FRAME_KEY : FLV_FRAME_INTER;
        break;
    case AVMEDIA_TYPE_AUDIO:
        flags = get_audio_flags(s, enc);
        assert(size);
        avio_w8(pb, FLV_TAG_TYPE_AUDIO);
        break;
    case AVMEDIA_TYPE_DATA:
        avio_w8(pb, FLV_TAG_TYPE_META);
        break;
    default:
        return AVERROR(EINVAL);
    }
    if (enc->codec_id == CODEC_ID_H264) {
        if (enc->extradata_size > 0 && *(uint8_t*)enc->extradata != 1) {
            if (ff_avc_parse_nal_units_buf(pkt->data, &data, &size) < 0)
                return -1;
        }
    }
    if (flv->delay == AV_NOPTS_VALUE)
        flv->delay = -pkt->dts;
    if (pkt->dts < -flv->delay) {
        av_log(s, AV_LOG_WARNING, "Packets are not in the proper order with "
                                  "respect to DTS\n");
        return AVERROR(EINVAL);
    }
    ts = pkt->dts + flv->delay;
    if (enc->codec_id == CODEC_ID_SPEEX && ts - sc->last_ts > 160) {
        av_log(s, AV_LOG_WARNING, "Warning: Speex stream has more than "
                                  "8 frames per packet. Adobe Flash "
                                  "Player cannot handle this!\n");
    }
    if (sc->last_ts < ts)
        sc->last_ts = ts;
    avio_wb24(pb,size + flags_size);
    avio_wb24(pb,ts);
    avio_w8(pb,(ts >> 24) & 0x7F);
    avio_wb24(pb,flv->reserved);
    if (enc->codec_type == AVMEDIA_TYPE_DATA) {
        int data_size;
        int metadata_size_pos = avio_tell(pb);
        avio_w8(pb, AMF_DATA_TYPE_STRING);
        put_amf_string(pb, "onTextData");
        avio_w8(pb, AMF_DATA_TYPE_MIXEDARRAY);
        avio_wb32(pb, 2);
        put_amf_string(pb, "type");
        avio_w8(pb, AMF_DATA_TYPE_STRING);
        put_amf_string(pb, "Text");
        put_amf_string(pb, "text");
        avio_w8(pb, AMF_DATA_TYPE_STRING);
        put_amf_string(pb, pkt->data);
        put_amf_string(pb, "");
        avio_w8(pb, AMF_END_OF_OBJECT);
        data_size = avio_tell(pb) - metadata_size_pos;
        avio_seek(pb, metadata_size_pos - 10, SEEK_SET);
        avio_wb24(pb, data_size);
        avio_seek(pb, data_size + 10 - 3, SEEK_CUR);
        avio_wb32(pb, data_size + 11);
    } else {
    avio_w8(pb,flags);
    if (enc->codec_id == CODEC_ID_VP6)
        avio_w8(pb,0);
    if (enc->codec_id == CODEC_ID_VP6F)
        avio_w8(pb, enc->extradata_size ? enc->extradata[0] : 0);
    else if (enc->codec_id == CODEC_ID_AAC)
        avio_w8(pb,1);
    else if (enc->codec_id == CODEC_ID_H264) {
        avio_w8(pb,1);
        avio_wb24(pb,pkt->pts - pkt->dts);
    }
    avio_write(pb, data ? data : pkt->data, size);
    avio_wb32(pb,size+flags_size+11);
    flv->duration = FFMAX(flv->duration, pkt->pts + flv->delay + pkt->duration);
    }
    avio_flush(pb);
    av_free(data);
    return pb->error;
}
['static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)\n{\n    AVIOContext *pb = s->pb;\n    AVCodecContext *enc = s->streams[pkt->stream_index]->codec;\n    FLVContext *flv = s->priv_data;\n    FLVStreamContext *sc = s->streams[pkt->stream_index]->priv_data;\n    unsigned ts;\n    int size= pkt->size;\n    uint8_t *data= NULL;\n    int flags, flags_size;\n    if(enc->codec_id == CODEC_ID_VP6 || enc->codec_id == CODEC_ID_VP6F ||\n       enc->codec_id == CODEC_ID_AAC)\n        flags_size= 2;\n    else if(enc->codec_id == CODEC_ID_H264)\n        flags_size= 5;\n    else\n        flags_size= 1;\n    switch (enc->codec_type) {\n    case AVMEDIA_TYPE_VIDEO:\n        avio_w8(pb, FLV_TAG_TYPE_VIDEO);\n        flags = enc->codec_tag;\n        if(flags == 0) {\n            av_log(s, AV_LOG_ERROR, "video codec %X not compatible with flv\\n",enc->codec_id);\n            return -1;\n        }\n        flags |= pkt->flags & AV_PKT_FLAG_KEY ? FLV_FRAME_KEY : FLV_FRAME_INTER;\n        break;\n    case AVMEDIA_TYPE_AUDIO:\n        flags = get_audio_flags(s, enc);\n        assert(size);\n        avio_w8(pb, FLV_TAG_TYPE_AUDIO);\n        break;\n    case AVMEDIA_TYPE_DATA:\n        avio_w8(pb, FLV_TAG_TYPE_META);\n        break;\n    default:\n        return AVERROR(EINVAL);\n    }\n    if (enc->codec_id == CODEC_ID_H264) {\n        if (enc->extradata_size > 0 && *(uint8_t*)enc->extradata != 1) {\n            if (ff_avc_parse_nal_units_buf(pkt->data, &data, &size) < 0)\n                return -1;\n        }\n    }\n    if (flv->delay == AV_NOPTS_VALUE)\n        flv->delay = -pkt->dts;\n    if (pkt->dts < -flv->delay) {\n        av_log(s, AV_LOG_WARNING, "Packets are not in the proper order with "\n                                  "respect to DTS\\n");\n        return AVERROR(EINVAL);\n    }\n    ts = pkt->dts + flv->delay;\n    if (enc->codec_id == CODEC_ID_SPEEX && ts - sc->last_ts > 160) {\n        av_log(s, AV_LOG_WARNING, "Warning: Speex stream has more than "\n                                  "8 frames per packet. Adobe Flash "\n                                  "Player cannot handle this!\\n");\n    }\n    if (sc->last_ts < ts)\n        sc->last_ts = ts;\n    avio_wb24(pb,size + flags_size);\n    avio_wb24(pb,ts);\n    avio_w8(pb,(ts >> 24) & 0x7F);\n    avio_wb24(pb,flv->reserved);\n    if (enc->codec_type == AVMEDIA_TYPE_DATA) {\n        int data_size;\n        int metadata_size_pos = avio_tell(pb);\n        avio_w8(pb, AMF_DATA_TYPE_STRING);\n        put_amf_string(pb, "onTextData");\n        avio_w8(pb, AMF_DATA_TYPE_MIXEDARRAY);\n        avio_wb32(pb, 2);\n        put_amf_string(pb, "type");\n        avio_w8(pb, AMF_DATA_TYPE_STRING);\n        put_amf_string(pb, "Text");\n        put_amf_string(pb, "text");\n        avio_w8(pb, AMF_DATA_TYPE_STRING);\n        put_amf_string(pb, pkt->data);\n        put_amf_string(pb, "");\n        avio_w8(pb, AMF_END_OF_OBJECT);\n        data_size = avio_tell(pb) - metadata_size_pos;\n        avio_seek(pb, metadata_size_pos - 10, SEEK_SET);\n        avio_wb24(pb, data_size);\n        avio_seek(pb, data_size + 10 - 3, SEEK_CUR);\n        avio_wb32(pb, data_size + 11);\n    } else {\n    avio_w8(pb,flags);\n    if (enc->codec_id == CODEC_ID_VP6)\n        avio_w8(pb,0);\n    if (enc->codec_id == CODEC_ID_VP6F)\n        avio_w8(pb, enc->extradata_size ? enc->extradata[0] : 0);\n    else if (enc->codec_id == CODEC_ID_AAC)\n        avio_w8(pb,1);\n    else if (enc->codec_id == CODEC_ID_H264) {\n        avio_w8(pb,1);\n        avio_wb24(pb,pkt->pts - pkt->dts);\n    }\n    avio_write(pb, data ? data : pkt->data, size);\n    avio_wb32(pb,size+flags_size+11);\n    flv->duration = FFMAX(flv->duration, pkt->pts + flv->delay + pkt->duration);\n    }\n    avio_flush(pb);\n    av_free(data);\n    return pb->error;\n}']