void ff_rtp_send_aac(AVFormatContext *s1, const uint8_t *buff, int size)

{

    RTPMuxContext *s = s1->priv_data;

    int len, max_packet_size;

    uint8_t *p;



    /* skip ADTS header, if present */

    if ((s1->streams[0]->codec->extradata_size) == 0) {

        size -= 7;

        buff += 7;

    }

    max_packet_size = s->max_payload_size - MAX_AU_HEADERS_SIZE;



    /* test if the packet must be sent */

    len = (s->buf_ptr - s->buf);

    if ((s->num_frames == MAX_FRAMES_PER_PACKET) || (len && (len + size) > s->max_payload_size)) {

        int au_size = s->num_frames * 2;



        p = s->buf + MAX_AU_HEADERS_SIZE - au_size - 2;

        if (p != s->buf) {

            memmove(p + 2, s->buf + 2, au_size);

        }

        /* Write the AU header size */

        p[0] = ((au_size * 8) & 0xFF) >> 8;

        p[1] = (au_size * 8) & 0xFF;



        ff_rtp_send_data(s1, p, s->buf_ptr - p, 1);



        s->num_frames = 0;

    }

    if (s->num_frames == 0) {

        s->buf_ptr = s->buf + MAX_AU_HEADERS_SIZE;

        s->timestamp = s->cur_timestamp;

    }



    if (size <= max_packet_size) {

        p = s->buf + s->num_frames++ * 2 + 2;

        *p++ = size >> 5;

        *p = (size & 0x1F) << 3;

        memcpy(s->buf_ptr, buff, size);

        s->buf_ptr += size;

    } else {

        if (s->buf_ptr != s->buf + MAX_AU_HEADERS_SIZE) {

            av_log(s1, AV_LOG_ERROR, "Strange...\n");

            av_abort();

        }

        max_packet_size = s->max_payload_size - 4;

        p = s->buf;

        p[0] = 0;

        p[1] = 16;

        while (size > 0) {

            len = FFMIN(size, max_packet_size);

            p[2] = len >> 5;

            p[3] = (size & 0x1F) << 3;

            memcpy(p + 4, buff, len);

            ff_rtp_send_data(s1, p, len + 4, len == size);

            size -= len;

            buff += len;

        }

    }

}

void ff_rtp_send_aac(AVFormatContext *s1, const uint8_t *buff, int size)

{

    RTPMuxContext *s = s1->priv_data;

    int len, max_packet_size;

    uint8_t *p;



    

    if ((s1->streams[0]->codec->extradata_size) == 0) {

        size -= 7;

        buff += 7;

    }

    max_packet_size = s->max_payload_size - MAX_AU_HEADERS_SIZE;



    

    len = (s->buf_ptr - s->buf);

    if ((s->num_frames == MAX_FRAMES_PER_PACKET) || (len && (len + size) > s->max_payload_size)) {

        int au_size = s->num_frames * 2;



        p = s->buf + MAX_AU_HEADERS_SIZE - au_size - 2;

        if (p != s->buf) {

            memmove(p + 2, s->buf + 2, au_size);

        }

        

        p[0] = ((au_size * 8) & 0xFF) >> 8;

        p[1] = (au_size * 8) & 0xFF;



        ff_rtp_send_data(s1, p, s->buf_ptr - p, 1);



        s->num_frames = 0;

    }

    if (s->num_frames == 0) {

        s->buf_ptr = s->buf + MAX_AU_HEADERS_SIZE;

        s->timestamp = s->cur_timestamp;

    }



    if (size <= max_packet_size) {

        p = s->buf + s->num_frames++ * 2 + 2;

        *p++ = size >> 5;

        *p = (size & 0x1F) << 3;

        memcpy(s->buf_ptr, buff, size);

        s->buf_ptr += size;

    } else {

        if (s->buf_ptr != s->buf + MAX_AU_HEADERS_SIZE) {

            av_log(s1, AV_LOG_ERROR, "Strange...\n");

            av_abort();

        }

        max_packet_size = s->max_payload_size - 4;

        p = s->buf;

        p[0] = 0;

        p[1] = 16;

        while (size > 0) {

            len = FFMIN(size, max_packet_size);

            p[2] = len >> 5;

            p[3] = (size & 0x1F) << 3;

            memcpy(p + 4, buff, len);

            ff_rtp_send_data(s1, p, len + 4, len == size);

            size -= len;

            buff += len;

        }

    }

}

void FUNC_0(AVFormatContext *VAR_0, const uint8_t *VAR_1, int VAR_2)

{

    RTPMuxContext *s = VAR_0->priv_data;

    int VAR_3, VAR_4;

    uint8_t *p;



    

    if ((VAR_0->streams[0]->codec->extradata_size) == 0) {

        VAR_2 -= 7;

        VAR_1 += 7;

    }

    VAR_4 = s->max_payload_size - MAX_AU_HEADERS_SIZE;



    

    VAR_3 = (s->buf_ptr - s->buf);

    if ((s->num_frames == MAX_FRAMES_PER_PACKET) || (VAR_3 && (VAR_3 + VAR_2) > s->max_payload_size)) {

        int VAR_5 = s->num_frames * 2;



        p = s->buf + MAX_AU_HEADERS_SIZE - VAR_5 - 2;

        if (p != s->buf) {

            memmove(p + 2, s->buf + 2, VAR_5);

        }

        

        p[0] = ((VAR_5 * 8) & 0xFF) >> 8;

        p[1] = (VAR_5 * 8) & 0xFF;



        ff_rtp_send_data(VAR_0, p, s->buf_ptr - p, 1);



        s->num_frames = 0;

    }

    if (s->num_frames == 0) {

        s->buf_ptr = s->buf + MAX_AU_HEADERS_SIZE;

        s->timestamp = s->cur_timestamp;

    }



    if (VAR_2 <= VAR_4) {

        p = s->buf + s->num_frames++ * 2 + 2;

        *p++ = VAR_2 >> 5;

        *p = (VAR_2 & 0x1F) << 3;

        memcpy(s->buf_ptr, VAR_1, VAR_2);

        s->buf_ptr += VAR_2;

    } else {

        if (s->buf_ptr != s->buf + MAX_AU_HEADERS_SIZE) {

            av_log(VAR_0, AV_LOG_ERROR, "Strange...\n");

            av_abort();

        }

        VAR_4 = s->max_payload_size - 4;

        p = s->buf;

        p[0] = 0;

        p[1] = 16;

        while (VAR_2 > 0) {

            VAR_3 = FFMIN(VAR_2, VAR_4);

            p[2] = VAR_3 >> 5;

            p[3] = (VAR_2 & 0x1F) << 3;

            memcpy(p + 4, VAR_1, VAR_3);

            ff_rtp_send_data(VAR_0, p, VAR_3 + 4, VAR_3 == VAR_2);

            VAR_2 -= VAR_3;

            VAR_1 += VAR_3;

        }

    }

}

void FUNC_0(AVFormatContext *VAR_0, const uint8_t *VAR_1, int VAR_2)
{ RTPMuxContext *s = VAR_0->priv_data; int VAR_3, VAR_4; uint8_t *p; if ((VAR_0->streams[0]->codec->extradata_size) == 0) { VAR_2 -= 7; VAR_1 += 7; } VAR_4 = s->max_payload_size - MAX_AU_HEADERS_SIZE; VAR_3 = (s->buf_ptr - s->buf); if ((s->num_frames == MAX_FRAMES_PER_PACKET) || (VAR_3 && (VAR_3 + VAR_2) > s->max_payload_size)) { int VAR_5 = s->num_frames * 2; p = s->buf + MAX_AU_HEADERS_SIZE - VAR_5 - 2; if (p != s->buf) { memmove(p + 2, s->buf + 2, VAR_5); } p[0] = ((VAR_5 * 8) & 0xFF) >> 8; p[1] = (VAR_5 * 8) & 0xFF; ff_rtp_send_data(VAR_0, p, s->buf_ptr - p, 1); s->num_frames = 0; } if (s->num_frames == 0) { s->buf_ptr = s->buf + MAX_AU_HEADERS_SIZE; s->timestamp = s->cur_timestamp; } if (VAR_2 <= VAR_4) { p = s->buf + s->num_frames++ * 2 + 2; *p++ = VAR_2 >> 5; *p = (VAR_2 & 0x1F) << 3; memcpy(s->buf_ptr, VAR_1, VAR_2); s->buf_ptr += VAR_2; } else { if (s->buf_ptr != s->buf + MAX_AU_HEADERS_SIZE) { av_log(VAR_0, AV_LOG_ERROR, "Strange...\n"); av_abort(); } VAR_4 = s->max_payload_size - 4; p = s->buf; p[0] = 0; p[1] = 16; while (VAR_2 > 0) { VAR_3 = FFMIN(VAR_2, VAR_4); p[2] = VAR_3 >> 5; p[3] = (VAR_2 & 0x1F) << 3; memcpy(p + 4, VAR_1, VAR_3); ff_rtp_send_data(VAR_0, p, VAR_3 + 4, VAR_3 == VAR_2); VAR_2 -= VAR_3; VAR_1 += VAR_3; } } }