[Ffmpeg-devel] RTP patches & RFC

Ryan Martell rdm4
Mon Oct 9 16:55:04 CEST 2006


Hi--

I'm finalizing my h264/rtp patch, and had some questions about what  
would be the "best" way (or accepted) to do things:

1) All of my h264 specific stuff is in a separate file, currently  
called rtp_h264.c.  It has 4 functions that aren't static:

void sdp_parse_fmtp_config_h264(struct AVCodecContext *codec, struct  
h264_rtp_extra_data *h264_data, char *attr, char *value);

struct h264_rtp_extra_data *new_h264_extradata();
void free_h264_extra_data(struct h264_rtp_extra_data *data);

int handle_h264_rtp_packet(struct RTPDemuxContext *s, AVPacket *pkt,  
uint32_t timestamp, const uint8_t *buf, int len);

I think what I would like to do is extend AVRtpPayloadType_s to  
include function pointers for the above, and make the sdp_parse  
function more generic (return a boolean and be called first for any  
sdp line).  That way, if we added more rtp payload types that  
required different processing, we could just add more function  
pointers to that table, and create another file.  In fact, we could  
break out the mpeg_ts and AAC stuff that is special now into separate  
files.  (This would also facilitate #ifdef'ing out various RTP  
functionality, if needed).

2) Because I am using the RTPDemuxContext * in my handle function, I  
have to have that structure visible.  (It is currently private to  
rtp.c)  So I moved it into rtp.h.  Is this okay?  If we were to go  
with more of a function pointer/plugin structure, should I create a  
file called rtp_private.h (or something) to hold things that are  
shared among the rtp code, but nowhere else?

3) My sdp parsing code uses a few functions from rtsp.c:  
redir_isspace, skip_spaces, and get_word_sep.  These are all small  
functions, but I hate duplicating code. What's the best solution for  
this?  Make those functions non-static in rtsp.c?

4) The AAC stuff in rtp doesn't compute the pkts, or use the  
timestamp field of the rtp packet.  I assume this is because timing  
information is inherent in the frequency of the audio, but I'm not  
sure.  What do I need to do to make the AAC audio sync to the video?   
(I am using ffplay as a test harness).

5) My code in rtp_h264 uses linked lists.  It creates packets, copies  
stuff into them, resizes them, etc.  It means at best 2 copies per  
packet (from the UDP buffer, to my packet, to the AVPacket), and at  
worst it could be many copies (I have to aggregate all of the packets  
for a given timestamp together).  My philosophy is "get it working,  
then make it fast.".  Are these acceptable issues?  I could keep a  
pool of packets around, but the payloads are various sizes.   
Alternatively could set it up the way tcp handles it's streams, but  
that's a lot of pointer overhead and room for error.

6) Finally, I have a Base64 decoding routine for the sdp/pps packets  
that are sent in the sdp stream.  Does this exist elsewhere in the  
codebase?

Thanks for any pointers and solutions!
-Ryan





More information about the ffmpeg-devel mailing list