redo:
for(;;){
static int flv_read_packet(AVFormatContext *s, AVPacket *pkt){    int ret, i, type, size, pts, flags;    AVStream *st;     redo:    url_fskip(&s->pb, 4); /* size of previous packet */    type = get_byte(&s->pb);    size = get_be24(&s->pb);    pts = get_be24(&s->pb);//    av_log(s, AV_LOG_DEBUG, "type:%d, size:%d, pts:%d\n", type, size, pts);    if (url_feof(&s->pb))        return -EIO;    url_fskip(&s->pb, 4); /* reserved */    flags = 0;    if (type == 8) {        flags = get_byte(&s->pb);        size--;        if ((flags >> 4) != 2) { /* 0: uncompressed 1: ADPCM 2: mp3 5: Nellymoser 8kHz mono 6: Nellymoser*/            goto skip;        }    } else if (type == 9) {        flags = get_byte(&s->pb);        size--;        if ((flags & 0xF) != 2) { /* 2: only format */            goto skip;        }    } else {    skip:        /* skip packet */        av_log(s, AV_LOG_ERROR, "skipping flv packet: type %d, size %d, flags %d\n", type, size, flags);        url_fskip(&s->pb, size);        goto redo;    }    /* now find stream */    for(i=0;i<s->nb_streams;i++) {        st = s->streams[i];        if (st->id == ((type == 9) ? 0 : 1))            goto found;    }    goto skip; found:    if(type == 8 && st->codec.sample_rate == 0){        st->codec.channels = (flags&1)+1;        st->codec.sample_rate = (44100<<((flags>>2)&3))>>3;    }    //guess the frame rate    if(type==9 && st->codec.frame_rate == FRAME_RATE_UNKNOWN && pts){        st->codec.frame_rate_base=1;        st->codec.frame_rate= (1000 + pts/2)/pts;    }    if (av_new_packet(pkt, size) < 0)        return -EIO;    ret = get_buffer(&s->pb, pkt->data, size);    if (ret <= 0) {        av_free_packet(pkt);        return -EIO;    }    /* note: we need to modify the packet size here to handle the last       packet */    pkt->size = ret;    pkt->pts = pts;    pkt->stream_index = st->index;    return ret;}