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

Martin Storsjö martin
Wed Jan 27 21:52:35 CET 2010


Hi Ronald,

On Wed, 27 Jan 2010, Ronald S. Bultje wrote:

> On Wed, Jan 27, 2010 at 3:16 PM, Martin Storsj? <martin at martin.st> wrote:
> > With url_open_dyn_packet_buf, wouldn't I have to allocate a new one each
> > time, write the RTP packet to be buffered into it, then url_close_dyn_buf
> > to get the pointer to the buffered data, then free it after using it? To
> > me, that feels like an awful lot of extra overhead compared to keeping one
> > single buffer and just reallocating it if a bigger one is needed.
> 
> It prevents the memcpy() to the packet buffer... Don't forget
> av_new_packet() allocs a new buffer anyway.

Hmm, I'm not sure I'm following you here on how you intend that I should 
use it. Care to elaborate?

One way of avoiding the extra memcpy()s would be to allocate 
all the output AVPackets at once at the first call when the RTP packet is 
provided, and then just return them one at a time in the later calls. Then 
the speech data for each frame is copied only once. But I don't follow you 
on how to accomplish that using url_open_dyn_packet_buf.

// Martin



More information about the ffmpeg-devel mailing list