[FFmpeg-devel] Request for advice/ small patch for RTCP BYE pactets

Michael Niedermayer michaelni
Thu Apr 9 02:25:33 CEST 2009


On Mon, Apr 06, 2009 at 02:30:34PM -0400, kdub432 at gmail.com wrote:
> diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
> index 9076f3f..de95307 100644
> --- a/libavformat/rtpdec.c
> +++ b/libavformat/rtpdec.c
> @@ -68,13 +68,49 @@ void av_register_rtp_dynamic_payload_handlers(void)
>  
>  static int rtcp_parse_packet(RTPDemuxContext *s, const unsigned char *buf, int len)
>  {
> -    if (buf[1] != 200)
> +    if ( (buf[1] != 200) || (buf[1] != 203) )
>          return -1;

> -    s->last_rtcp_ntp_time = AV_RB64(buf + 8);
> -    if (s->first_rtcp_ntp_time == AV_NOPTS_VALUE)
> -        s->first_rtcp_ntp_time = s->last_rtcp_ntp_time;
> -    s->last_rtcp_timestamp = AV_RB32(buf + 16);
> -    return 0;
> +
> +    if (buf[1] == 200)
> +    {
> +        s->last_rtcp_ntp_time = AV_RB64(buf + 8);
> +        if (s->first_rtcp_ntp_time == AV_NOPTS_VALUE)
> +            s->first_rtcp_ntp_time = s->last_rtcp_ntp_time;
> +        s->last_rtcp_timestamp = AV_RB32(buf + 16);
> +        return 0;
> +    }

reindention must be seperate from functional changes



> +
> +    if (buf[1] == 203) /* RTCP BYE PACKET */
> +    {

this isnt K&R style


> +        /* find ssrc in member and sender tables. remove it*/
> +        int i;
> +        for (i = 0; i < s->member_num; i++ )
> +        {
> +            if ( s->member[ i ]  == s->ssrc)
> +            {
> +                memmove(&s->member[i], &s->member[i], (s->member_num -i ) * sizeof(uint32_t));

sizeof(s->member[i])


> +                s->member_num--;
> +                break;
> +            }
> +
> +            if ( s->senders[ i ]  == s->ssrc)
> +            {
> +                memmove(&s->senders[i], &s->senders[i], (s->sender_num -i ) * sizeof(uint32_t));
> +                s->sender_num--;
> +                break;
> +            }
> +
> +            /* todo: OPTIONAL RFC 3550 6.3.4 suggests an optional
> +            *        ratecontrol algorithm that is updated on RTCP BYE packet */
> +        }
> +

> +         

trailing whitespace


> +
> +
> +
> +    }
> +
> +
>  }

useless empty lines

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090409/1d22c252/attachment.pgp>



More information about the ffmpeg-devel mailing list