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

Martin Storsjö martin
Wed Jan 27 16:14:41 CET 2010


On Wed, 27 Jan 2010, Luca Abeni wrote:

> > It seems to me that the missing timestamps aren't filled in automatically by
> > libavformat. Around lines 421-424 in rtpdec.c, the timestamp is set to 0
> 
> Congratulations, I think you just found a bug ;-)
> That should be AV_NOPTS_VALUE, not 0.
> Can you try this change and see what happens if the payload handler does
> not mess with timestamps?

No, that won't work. "timestamp" in this case is an uint32_t, not an 
int64_t as the AVPacket::pts field. With the attached patch, I seem to be 
able to leave out the timestamp updating in the AMR depacketizer, though,
but that makes proper cases where timestamp == 0 map to AV_NOPTS_VALUE.


But as far as I can see, the dynamic rtp packetload handlers really are 
intended to set the timestamp in this way. From rtpdec.h:

/**
 * Packet parsing for "private" payloads in the RTP specs.
[...]
 * @param timestamp pointer in which to write the timestamp of this RTP 
packet
 */
typedef int (*DynamicPayloadPacketHandlerProc) (AVFormatContext *ctx,
                                                PayloadContext *s,
                                                AVStream *st,
                                                AVPacket * pkt,
                                                uint32_t *timestamp,
                                                const uint8_t * buf,
                                                int len, int flags);

If they were not intended to set the timestamp, the timestamp parameter 
wouldn't be a pointer.

So to me, setting the timestamp from the dynamic payload handler doesn't 
look like an issue. Ronald?

// Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rtptimestamp.patch
Type: text/x-diff
Size: 531 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100127/1bfd78d1/attachment.patch>



More information about the ffmpeg-devel mailing list