[FFmpeg-devel] [PATCH] RTP depacketizer for AMR

Ronald S. Bultje rsbultje
Mon Feb 8 19:44:19 CET 2010


Hi,

On Sun, Jan 31, 2010 at 3:29 PM, Martin Storsj? <martin at martin.st> wrote:
> Updated patch that returns all frames from the RTP packet at once. All
> other issues are taken care of, except for sharing the frame size tables
> with other code handling AMR.

Minor nitpicking-time:

> +    /* Count the number of frames in the packet. The highest bit
> +     * is set in a TOC byte if there are more frames following.
> +     */
> +    while (1 + frames < len && (buf[1 + frames] & 0x80))
> +        frames++;
> +    frames++;

int frames = 0;
[..]
do {
    frames++;
} while (frames < len && buf[frames] & 0x80);

is shorter. You could also use for() since it has a clear increment/start/stop:

int frames;
[..]
for (frames = 1; frames < ln && buf[frames] & 0x80; frames++) ;

Or something like that.

The rest is fine, thanks!

Ronald



More information about the ffmpeg-devel mailing list