[FFmpeg-devel] [PATCH] Add support for packetizing AMR into RTP

Luca Abeni lucabe72
Sun Apr 5 21:45:13 CEST 2009

Hi Martin,

On Fri, 2009-04-03 at 19:03 +0300, Martin Storsj? wrote:
> Hi,
> The attached patch adds support for packetizing AMR (both NB and WB) into 
> RTP packets, according to RFC 3267.
Some comments below.

> The packetizing code is largely modelled after rtp_aac.c - should the 
> copyright statements from that file be added here, too?
After reading the patch, I think yes. I am also wondering if it is
possible to factorise some code between the two files...

> +
> +/* Packetize AMR frames into RTP packets according to RFC 3267 */
> +void ff_rtp_send_amr(AVFormatContext *s1, const uint8_t *buff, int size)
> +{
This patch is implementing the "Octet-aligned Mode", right? Can you
clarify this in the comment?

> +    } else {
> +        if (s->buf_ptr != s->buf + MAX_HEADER_TOC_SIZE) {
> +            av_log(s1, AV_LOG_ERROR, "Strange...\n");
> +            av_abort();
> +        }
> +        av_log(s1, AV_LOG_ERROR, "Unable to split an AMR frame into more than one RTP packet\n");
> +    }
Is this situation (AMR frame larger than the packet payload) possible?
If yes, how does the RFC address it? (in case the RFC provides some way
to split an AMR frame, how difficult would it be to implement it? How
probable is this situation?)
If for some reason this situation is not possible (if I understand well,
AMR frames have a fixed length in time, and a fixed bitrate of 8 or 16
kbps?), then the "} else {" branch can be removed, I think...


More information about the ffmpeg-devel mailing list