static int vp8_handle_packet(AVFormatContext *ctx, PayloadContext *vp8,

                             AVStream *st, AVPacket *pkt, uint32_t *timestamp,

                             const uint8_t *buf, int len, uint16_t seq,

                             int flags)

{

    int start_partition, end_packet;

    int extended_bits, part_id;

    int pictureid_present = 0, tl0picidx_present = 0, tid_present = 0,

        keyidx_present = 0;

    int pictureid = -1, pictureid_mask = 0;

    int returned_old_frame = 0;

    uint32_t old_timestamp;



    if (!buf) {

        if (vp8->data) {

            int ret = ff_rtp_finalize_packet(pkt, &vp8->data, st->index);

            if (ret < 0)

                return ret;

            *timestamp = vp8->timestamp;

            if (vp8->sequence_dirty)

                pkt->flags |= AV_PKT_FLAG_CORRUPT;

            return 0;

        }

        return AVERROR(EAGAIN);

    }



    if (len < 1)

        return AVERROR_INVALIDDATA;



    extended_bits   = buf[0] & 0x80;

    start_partition = buf[0] & 0x10;

    part_id         = buf[0] & 0x0f;

    end_packet      = flags & RTP_FLAG_MARKER;

    buf++;

    len--;

    if (extended_bits) {

        if (len < 1)

            return AVERROR_INVALIDDATA;

        pictureid_present = buf[0] & 0x80;

        tl0picidx_present = buf[0] & 0x40;

        tid_present       = buf[0] & 0x20;

        keyidx_present    = buf[0] & 0x10;

        buf++;

        len--;

    }

    if (pictureid_present) {

        if (len < 1)

            return AVERROR_INVALIDDATA;

        if (buf[0] & 0x80) {

            if (len < 2)

                return AVERROR_INVALIDDATA;

            pictureid = AV_RB16(buf) & 0x7fff;

            pictureid_mask = 0x7fff;

            buf += 2;

            len -= 2;

        } else {

            pictureid = buf[0] & 0x7f;

            pictureid_mask = 0x7f;

            buf++;

            len--;

        }

    }

    if (tl0picidx_present) {

        // Ignoring temporal level zero index

        buf++;

        len--;

    }

    if (tid_present || keyidx_present) {

        // Ignoring temporal layer index, layer sync bit and keyframe index

        buf++;

        len--;

    }

    if (len < 1)

        return AVERROR_INVALIDDATA;



    if (start_partition && part_id == 0 && len >= 3) {

        int res;

        int non_key = buf[0] & 0x01;

        if (!non_key) {

            vp8_free_buffer(vp8);

            // Keyframe, decoding ok again

            vp8->sequence_ok = 1;

            vp8->sequence_dirty = 0;

            vp8->got_keyframe = 1;

        } else {

            int can_continue = vp8->data && !vp8->is_keyframe &&

                               avio_tell(vp8->data) >= vp8->first_part_size;

            if (!vp8->sequence_ok)

                return AVERROR(EAGAIN);

            if (!vp8->got_keyframe)

                return vp8_broken_sequence(ctx, vp8, "Keyframe missing\n");

            if (pictureid >= 0) {

                if (pictureid != ((vp8->prev_pictureid + 1) & pictureid_mask)) {

                    return vp8_broken_sequence(ctx, vp8,

                                               "Missed a picture, sequence broken\n");

                } else {

                    if (vp8->data && !can_continue)

                        return vp8_broken_sequence(ctx, vp8,

                                                   "Missed a picture, sequence broken\n");

                }

            } else {

                uint16_t expected_seq = vp8->prev_seq + 1;

                int16_t diff = seq - expected_seq;

                if (vp8->data) {

                    // No picture id, so we can't know if missed packets

                    // contained any new frames. If diff == 0, we did get

                    // later packets from the same frame (matching timestamp),

                    // so we know we didn't miss any frame. If diff == 1 and

                    // we still have data (not flushed by the end of frame

                    // marker), the single missed packet must have been part

                    // of the same frame.

                    if ((diff == 0 || diff == 1) && can_continue) {

                        // Proceed with what we have

                    } else {

                        return vp8_broken_sequence(ctx, vp8,

                                                   "Missed too much, sequence broken\n");

                    }

                } else {

                    if (diff != 0)

                        return vp8_broken_sequence(ctx, vp8,

                                                   "Missed unknown data, sequence broken\n");

                }

            }

            if (vp8->data) {

                vp8->sequence_dirty = 1;

                if (avio_tell(vp8->data) >= vp8->first_part_size) {

                    int ret = ff_rtp_finalize_packet(pkt, &vp8->data, st->index);

                    if (ret < 0)

                        return ret;

                    pkt->flags |= AV_PKT_FLAG_CORRUPT;

                    returned_old_frame = 1;

                    old_timestamp = vp8->timestamp;

                } else {

                    // Shouldn't happen

                    vp8_free_buffer(vp8);

                }

            }

        }

        vp8->first_part_size = (AV_RL16(&buf[1]) << 3 | buf[0] >> 5) + 3;

        if ((res = avio_open_dyn_buf(&vp8->data)) < 0)

            return res;

        vp8->timestamp = *timestamp;

        vp8->broken_frame = 0;

        vp8->prev_pictureid = pictureid;

        vp8->is_keyframe = !non_key;

    } else {

        uint16_t expected_seq = vp8->prev_seq + 1;



        if (!vp8->sequence_ok)

            return AVERROR(EAGAIN);



        if (vp8->timestamp != *timestamp) {

            // Missed the start of the new frame, sequence broken

            return vp8_broken_sequence(ctx, vp8,

                                       "Received no start marker; dropping frame\n");

        }



        if (seq != expected_seq) {

            if (vp8->is_keyframe) {

                return vp8_broken_sequence(ctx, vp8,

                                           "Missed part of a keyframe, sequence broken\n");

            } else if (vp8->data && avio_tell(vp8->data) >= vp8->first_part_size) {

                vp8->broken_frame = 1;

                vp8->sequence_dirty = 1;

            } else {

                return vp8_broken_sequence(ctx, vp8,

                                           "Missed part of the first partition, sequence broken\n");

            }

        }

    }



    if (!vp8->data)

        return vp8_broken_sequence(ctx, vp8, "Received no start marker\n");



    vp8->prev_seq = seq;

    if (!vp8->broken_frame)

        avio_write(vp8->data, buf, len);



    if (returned_old_frame) {

        *timestamp = old_timestamp;

        return end_packet ? 1 : 0;

    }



    if (end_packet) {

        int ret;

        ret = ff_rtp_finalize_packet(pkt, &vp8->data, st->index);

        if (ret < 0)

            return ret;

        if (vp8->sequence_dirty)

            pkt->flags |= AV_PKT_FLAG_CORRUPT;

        return 0;

    }



    return AVERROR(EAGAIN);

}

static int vp8_handle_packet(AVFormatContext *ctx, PayloadContext *vp8,

                             AVStream *st, AVPacket *pkt, uint32_t *timestamp,

                             const uint8_t *buf, int len, uint16_t seq,

                             int flags)

{

    int start_partition, end_packet;

    int extended_bits, part_id;

    int pictureid_present = 0, tl0picidx_present = 0, tid_present = 0,

        keyidx_present = 0;

    int pictureid = -1, pictureid_mask = 0;

    int returned_old_frame = 0;

    uint32_t old_timestamp;



    if (!buf) {

        if (vp8->data) {

            int ret = ff_rtp_finalize_packet(pkt, &vp8->data, st->index);

            if (ret < 0)

                return ret;

            *timestamp = vp8->timestamp;

            if (vp8->sequence_dirty)

                pkt->flags |= AV_PKT_FLAG_CORRUPT;

            return 0;

        }

        return AVERROR(EAGAIN);

    }



    if (len < 1)

        return AVERROR_INVALIDDATA;



    extended_bits   = buf[0] & 0x80;

    start_partition = buf[0] & 0x10;

    part_id         = buf[0] & 0x0f;

    end_packet      = flags & RTP_FLAG_MARKER;

    buf++;

    len--;

    if (extended_bits) {

        if (len < 1)

            return AVERROR_INVALIDDATA;

        pictureid_present = buf[0] & 0x80;

        tl0picidx_present = buf[0] & 0x40;

        tid_present       = buf[0] & 0x20;

        keyidx_present    = buf[0] & 0x10;

        buf++;

        len--;

    }

    if (pictureid_present) {

        if (len < 1)

            return AVERROR_INVALIDDATA;

        if (buf[0] & 0x80) {

            if (len < 2)

                return AVERROR_INVALIDDATA;

            pictureid = AV_RB16(buf) & 0x7fff;

            pictureid_mask = 0x7fff;

            buf += 2;

            len -= 2;

        } else {

            pictureid = buf[0] & 0x7f;

            pictureid_mask = 0x7f;

            buf++;

            len--;

        }

    }

    if (tl0picidx_present) {

        

        buf++;

        len--;

    }

    if (tid_present || keyidx_present) {

        

        buf++;

        len--;

    }

    if (len < 1)

        return AVERROR_INVALIDDATA;



    if (start_partition && part_id == 0 && len >= 3) {

        int res;

        int non_key = buf[0] & 0x01;

        if (!non_key) {

            vp8_free_buffer(vp8);

            

            vp8->sequence_ok = 1;

            vp8->sequence_dirty = 0;

            vp8->got_keyframe = 1;

        } else {

            int can_continue = vp8->data && !vp8->is_keyframe &&

                               avio_tell(vp8->data) >= vp8->first_part_size;

            if (!vp8->sequence_ok)

                return AVERROR(EAGAIN);

            if (!vp8->got_keyframe)

                return vp8_broken_sequence(ctx, vp8, "Keyframe missing\n");

            if (pictureid >= 0) {

                if (pictureid != ((vp8->prev_pictureid + 1) & pictureid_mask)) {

                    return vp8_broken_sequence(ctx, vp8,

                                               "Missed a picture, sequence broken\n");

                } else {

                    if (vp8->data && !can_continue)

                        return vp8_broken_sequence(ctx, vp8,

                                                   "Missed a picture, sequence broken\n");

                }

            } else {

                uint16_t expected_seq = vp8->prev_seq + 1;

                int16_t diff = seq - expected_seq;

                if (vp8->data) {

                    

                    

                    

                    

                    

                    

                    

                    if ((diff == 0 || diff == 1) && can_continue) {

                        

                    } else {

                        return vp8_broken_sequence(ctx, vp8,

                                                   "Missed too much, sequence broken\n");

                    }

                } else {

                    if (diff != 0)

                        return vp8_broken_sequence(ctx, vp8,

                                                   "Missed unknown data, sequence broken\n");

                }

            }

            if (vp8->data) {

                vp8->sequence_dirty = 1;

                if (avio_tell(vp8->data) >= vp8->first_part_size) {

                    int ret = ff_rtp_finalize_packet(pkt, &vp8->data, st->index);

                    if (ret < 0)

                        return ret;

                    pkt->flags |= AV_PKT_FLAG_CORRUPT;

                    returned_old_frame = 1;

                    old_timestamp = vp8->timestamp;

                } else {

                    

                    vp8_free_buffer(vp8);

                }

            }

        }

        vp8->first_part_size = (AV_RL16(&buf[1]) << 3 | buf[0] >> 5) + 3;

        if ((res = avio_open_dyn_buf(&vp8->data)) < 0)

            return res;

        vp8->timestamp = *timestamp;

        vp8->broken_frame = 0;

        vp8->prev_pictureid = pictureid;

        vp8->is_keyframe = !non_key;

    } else {

        uint16_t expected_seq = vp8->prev_seq + 1;



        if (!vp8->sequence_ok)

            return AVERROR(EAGAIN);



        if (vp8->timestamp != *timestamp) {

            

            return vp8_broken_sequence(ctx, vp8,

                                       "Received no start marker; dropping frame\n");

        }



        if (seq != expected_seq) {

            if (vp8->is_keyframe) {

                return vp8_broken_sequence(ctx, vp8,

                                           "Missed part of a keyframe, sequence broken\n");

            } else if (vp8->data && avio_tell(vp8->data) >= vp8->first_part_size) {

                vp8->broken_frame = 1;

                vp8->sequence_dirty = 1;

            } else {

                return vp8_broken_sequence(ctx, vp8,

                                           "Missed part of the first partition, sequence broken\n");

            }

        }

    }



    if (!vp8->data)

        return vp8_broken_sequence(ctx, vp8, "Received no start marker\n");



    vp8->prev_seq = seq;

    if (!vp8->broken_frame)

        avio_write(vp8->data, buf, len);



    if (returned_old_frame) {

        *timestamp = old_timestamp;

        return end_packet ? 1 : 0;

    }



    if (end_packet) {

        int ret;

        ret = ff_rtp_finalize_packet(pkt, &vp8->data, st->index);

        if (ret < 0)

            return ret;

        if (vp8->sequence_dirty)

            pkt->flags |= AV_PKT_FLAG_CORRUPT;

        return 0;

    }



    return AVERROR(EAGAIN);

}

    uint32_t old_timestamp;
static int FUNC_0(AVFormatContext *VAR_0, PayloadContext *VAR_1,

                             AVStream *VAR_2, AVPacket *VAR_3, uint32_t *VAR_4,

                             const uint8_t *VAR_5, int VAR_6, uint16_t VAR_7,

                             int VAR_8)

{

    int VAR_9, VAR_10;

    int VAR_11, VAR_12;

    int VAR_13 = 0, VAR_14 = 0, VAR_15 = 0,

        VAR_16 = 0;

    int VAR_17 = -1, VAR_18 = 0;

    int VAR_19 = 0;

    uint32_t old_timestamp;



    if (!VAR_5) {

        if (VAR_1->data) {

            int VAR_24 = ff_rtp_finalize_packet(VAR_3, &VAR_1->data, VAR_2->index);

            if (VAR_24 < 0)

                return VAR_24;

            *VAR_4 = VAR_1->VAR_4;

            if (VAR_1->sequence_dirty)

                VAR_3->VAR_8 |= AV_PKT_FLAG_CORRUPT;

            return 0;

        }

        return AVERROR(EAGAIN);

    }



    if (VAR_6 < 1)

        return AVERROR_INVALIDDATA;



    VAR_11   = VAR_5[0] & 0x80;

    VAR_9 = VAR_5[0] & 0x10;

    VAR_12         = VAR_5[0] & 0x0f;

    VAR_10      = VAR_8 & RTP_FLAG_MARKER;

    VAR_5++;

    VAR_6--;

    if (VAR_11) {

        if (VAR_6 < 1)

            return AVERROR_INVALIDDATA;

        VAR_13 = VAR_5[0] & 0x80;

        VAR_14 = VAR_5[0] & 0x40;

        VAR_15       = VAR_5[0] & 0x20;

        VAR_16    = VAR_5[0] & 0x10;

        VAR_5++;

        VAR_6--;

    }

    if (VAR_13) {

        if (VAR_6 < 1)

            return AVERROR_INVALIDDATA;

        if (VAR_5[0] & 0x80) {

            if (VAR_6 < 2)

                return AVERROR_INVALIDDATA;

            VAR_17 = AV_RB16(VAR_5) & 0x7fff;

            VAR_18 = 0x7fff;

            VAR_5 += 2;

            VAR_6 -= 2;

        } else {

            VAR_17 = VAR_5[0] & 0x7f;

            VAR_18 = 0x7f;

            VAR_5++;

            VAR_6--;

        }

    }

    if (VAR_14) {

        

        VAR_5++;

        VAR_6--;

    }

    if (VAR_15 || VAR_16) {

        

        VAR_5++;

        VAR_6--;

    }

    if (VAR_6 < 1)

        return AVERROR_INVALIDDATA;



    if (VAR_9 && VAR_12 == 0 && VAR_6 >= 3) {

        int VAR_21;

        int VAR_22 = VAR_5[0] & 0x01;

        if (!VAR_22) {

            vp8_free_buffer(VAR_1);

            

            VAR_1->sequence_ok = 1;

            VAR_1->sequence_dirty = 0;

            VAR_1->got_keyframe = 1;

        } else {

            int VAR_23 = VAR_1->data && !VAR_1->is_keyframe &&

                               avio_tell(VAR_1->data) >= VAR_1->first_part_size;

            if (!VAR_1->sequence_ok)

                return AVERROR(EAGAIN);

            if (!VAR_1->got_keyframe)

                return vp8_broken_sequence(VAR_0, VAR_1, "Keyframe missing\n");

            if (VAR_17 >= 0) {

                if (VAR_17 != ((VAR_1->prev_pictureid + 1) & VAR_18)) {

                    return vp8_broken_sequence(VAR_0, VAR_1,

                                               "Missed a picture, sequence broken\n");

                } else {

                    if (VAR_1->data && !VAR_23)

                        return vp8_broken_sequence(VAR_0, VAR_1,

                                                   "Missed a picture, sequence broken\n");

                }

            } else {

                uint16_t expected_seq = VAR_1->prev_seq + 1;

                int16_t diff = VAR_7 - expected_seq;

                if (VAR_1->data) {

                    

                    

                    

                    

                    

                    

                    

                    if ((diff == 0 || diff == 1) && VAR_23) {

                        

                    } else {

                        return vp8_broken_sequence(VAR_0, VAR_1,

                                                   "Missed too much, sequence broken\n");

                    }

                } else {

                    if (diff != 0)

                        return vp8_broken_sequence(VAR_0, VAR_1,

                                                   "Missed unknown data, sequence broken\n");

                }

            }

            if (VAR_1->data) {

                VAR_1->sequence_dirty = 1;

                if (avio_tell(VAR_1->data) >= VAR_1->first_part_size) {

                    int VAR_24 = ff_rtp_finalize_packet(VAR_3, &VAR_1->data, VAR_2->index);

                    if (VAR_24 < 0)

                        return VAR_24;

                    VAR_3->VAR_8 |= AV_PKT_FLAG_CORRUPT;

                    VAR_19 = 1;

                    old_timestamp = VAR_1->VAR_4;

                } else {

                    

                    vp8_free_buffer(VAR_1);

                }

            }

        }

        VAR_1->first_part_size = (AV_RL16(&VAR_5[1]) << 3 | VAR_5[0] >> 5) + 3;

        if ((VAR_21 = avio_open_dyn_buf(&VAR_1->data)) < 0)

            return VAR_21;

        VAR_1->VAR_4 = *VAR_4;

        VAR_1->broken_frame = 0;

        VAR_1->prev_pictureid = VAR_17;

        VAR_1->is_keyframe = !VAR_22;

    } else {

        uint16_t expected_seq = VAR_1->prev_seq + 1;



        if (!VAR_1->sequence_ok)

            return AVERROR(EAGAIN);



        if (VAR_1->VAR_4 != *VAR_4) {

            

            return vp8_broken_sequence(VAR_0, VAR_1,

                                       "Received no start marker; dropping frame\n");

        }



        if (VAR_7 != expected_seq) {

            if (VAR_1->is_keyframe) {

                return vp8_broken_sequence(VAR_0, VAR_1,

                                           "Missed part of a keyframe, sequence broken\n");

            } else if (VAR_1->data && avio_tell(VAR_1->data) >= VAR_1->first_part_size) {

                VAR_1->broken_frame = 1;

                VAR_1->sequence_dirty = 1;

            } else {

                return vp8_broken_sequence(VAR_0, VAR_1,

                                           "Missed part of the first partition, sequence broken\n");

            }

        }

    }



    if (!VAR_1->data)

        return vp8_broken_sequence(VAR_0, VAR_1, "Received no start marker\n");



    VAR_1->prev_seq = VAR_7;

    if (!VAR_1->broken_frame)

        avio_write(VAR_1->data, VAR_5, VAR_6);



    if (VAR_19) {

        *VAR_4 = old_timestamp;

        return VAR_10 ? 1 : 0;

    }



    if (VAR_10) {

        int VAR_24;

        VAR_24 = ff_rtp_finalize_packet(VAR_3, &VAR_1->data, VAR_2->index);

        if (VAR_24 < 0)

            return VAR_24;

        if (VAR_1->sequence_dirty)

            VAR_3->VAR_8 |= AV_PKT_FLAG_CORRUPT;

        return 0;

    }



    return AVERROR(EAGAIN);

}

static int FUNC_0(AVFormatContext *VAR_0, PayloadContext *VAR_1,
AVStream *VAR_2, AVPacket *VAR_3, uint32_t *VAR_4,
const uint8_t *VAR_5, int VAR_6, uint16_t VAR_7,
int VAR_8)
{ int VAR_9, VAR_10; int VAR_11, VAR_12; int VAR_13 = 0, VAR_14 = 0, VAR_15 = 0,
VAR_16 = 0; int VAR_17 = -1, VAR_18 = 0; int VAR_19 = 0; uint32_t old_timestamp; if (!VAR_5) { if (VAR_1->data) { int VAR_24 = ff_rtp_finalize_packet(VAR_3, &VAR_1->data, VAR_2->index); if (VAR_24 < 0)
return VAR_24; *VAR_4 = VAR_1->VAR_4; if (VAR_1->sequence_dirty)
VAR_3->VAR_8 |= AV_PKT_FLAG_CORRUPT; return 0; } return AVERROR(EAGAIN); } if (VAR_6 < 1)
return AVERROR_INVALIDDATA; VAR_11   = VAR_5[0] & 0x80; VAR_9 = VAR_5[0] & 0x10; VAR_12         = VAR_5[0] & 0x0f; VAR_10      = VAR_8 & RTP_FLAG_MARKER; VAR_5++; VAR_6--; if (VAR_11) { if (VAR_6 < 1)
return AVERROR_INVALIDDATA; VAR_13 = VAR_5[0] & 0x80; VAR_14 = VAR_5[0] & 0x40; VAR_15       = VAR_5[0] & 0x20; VAR_16    = VAR_5[0] & 0x10; VAR_5++; VAR_6--; } if (VAR_13) { if (VAR_6 < 1)
return AVERROR_INVALIDDATA; if (VAR_5[0] & 0x80) { if (VAR_6 < 2)
return AVERROR_INVALIDDATA; VAR_17 = AV_RB16(VAR_5) & 0x7fff; VAR_18 = 0x7fff; VAR_5 += 2; VAR_6 -= 2; } else { VAR_17 = VAR_5[0] & 0x7f; VAR_18 = 0x7f; VAR_5++; VAR_6--; } } if (VAR_14) { VAR_5++; VAR_6--; } if (VAR_15 || VAR_16) { VAR_5++; VAR_6--; } if (VAR_6 < 1)
return AVERROR_INVALIDDATA; if (VAR_9 && VAR_12 == 0 && VAR_6 >= 3) { int VAR_21; int VAR_22 = VAR_5[0] & 0x01; if (!VAR_22) { vp8_free_buffer(VAR_1); VAR_1->sequence_ok = 1; VAR_1->sequence_dirty = 0; VAR_1->got_keyframe = 1; } else { int VAR_23 = VAR_1->data && !VAR_1->is_keyframe &&
avio_tell(VAR_1->data) >= VAR_1->first_part_size; if (!VAR_1->sequence_ok)
return AVERROR(EAGAIN); if (!VAR_1->got_keyframe)
return vp8_broken_sequence(VAR_0, VAR_1, "Keyframe missing\n"); if (VAR_17 >= 0) { if (VAR_17 != ((VAR_1->prev_pictureid + 1) & VAR_18)) { return vp8_broken_sequence(VAR_0, VAR_1,
"Missed a picture, sequence broken\n"); } else { if (VAR_1->data && !VAR_23)
return vp8_broken_sequence(VAR_0, VAR_1,
"Missed a picture, sequence broken\n"); } } else { uint16_t expected_seq = VAR_1->prev_seq + 1; int16_t diff = VAR_7 - expected_seq; if (VAR_1->data) { if ((diff == 0 || diff == 1) && VAR_23) { } else { return vp8_broken_sequence(VAR_0, VAR_1,
"Missed too much, sequence broken\n"); } } else { if (diff != 0)
return vp8_broken_sequence(VAR_0, VAR_1,
"Missed unknown data, sequence broken\n"); } } if (VAR_1->data) { VAR_1->sequence_dirty = 1; if (avio_tell(VAR_1->data) >= VAR_1->first_part_size) { int VAR_24 = ff_rtp_finalize_packet(VAR_3, &VAR_1->data, VAR_2->index); if (VAR_24 < 0)
return VAR_24; VAR_3->VAR_8 |= AV_PKT_FLAG_CORRUPT; VAR_19 = 1; old_timestamp = VAR_1->VAR_4; } else { vp8_free_buffer(VAR_1); } } } VAR_1->first_part_size = (AV_RL16(&VAR_5[1]) << 3 | VAR_5[0] >> 5) + 3; if ((VAR_21 = avio_open_dyn_buf(&VAR_1->data)) < 0)
return VAR_21; VAR_1->VAR_4 = *VAR_4; VAR_1->broken_frame = 0; VAR_1->prev_pictureid = VAR_17; VAR_1->is_keyframe = !VAR_22; } else { uint16_t expected_seq = VAR_1->prev_seq + 1; if (!VAR_1->sequence_ok)
return AVERROR(EAGAIN); if (VAR_1->VAR_4 != *VAR_4) { return vp8_broken_sequence(VAR_0, VAR_1,
"Received no start marker; dropping frame\n"); } if (VAR_7 != expected_seq) { if (VAR_1->is_keyframe) { return vp8_broken_sequence(VAR_0, VAR_1,
"Missed part of a keyframe, sequence broken\n"); } else if (VAR_1->data && avio_tell(VAR_1->data) >= VAR_1->first_part_size) { VAR_1->broken_frame = 1; VAR_1->sequence_dirty = 1; } else { return vp8_broken_sequence(VAR_0, VAR_1,
"Missed part of the first partition, sequence broken\n"); } } } if (!VAR_1->data)
return vp8_broken_sequence(VAR_0, VAR_1, "Received no start marker\n"); VAR_1->prev_seq = VAR_7; if (!VAR_1->broken_frame)
avio_write(VAR_1->data, VAR_5, VAR_6); if (VAR_19) { *VAR_4 = old_timestamp; return VAR_10 ? 1 : 0; } if (VAR_10) { int VAR_24; VAR_24 = ff_rtp_finalize_packet(VAR_3, &VAR_1->data, VAR_2->index); if (VAR_24 < 0)
return VAR_24; if (VAR_1->sequence_dirty)
VAR_3->VAR_8 |= AV_PKT_FLAG_CORRUPT; return 0; } return AVERROR(EAGAIN); }