[FFmpeg-devel] [PATCH] RTP H.264 / AVC support

Luca Abeni lucabe72
Wed Jun 2 12:39:02 CEST 2010

On 06/01/2010 10:50 AM, Luca Abeni wrote:
> Regarding the sdp.c patch, I am not sure about the complexity added by
> callback... Maybe opencoding the call the the NAL parsing function would
> simplify the code.
> Moreover, the patch changes "uint8_t nal_type" in "int naltype" and
> introduces some unrelated changes.

Ok, I re-read the whole thread, and I agree that maybe I have been
not clear enough in describing how I think the patch should look like.
Let me apologise about that.

So, instead of writing another long email to explain my idea (with the
risk of being unclear again), I tried to write down some code to
better explain it (warning: the attached thing works for me, but it is
just a 5 minutes hack intended to explain an idea... It probably misses
some error checking, I did not run patchcheck on it, etc...).

The attached patch tries to explain how I think the sdp.c modifications
should look like (it does not address the rtpenc_h264.c modifications
yet). It uses a bitstream filter (and it requires a small modification /
improvement to the mp4toannexb bsf), because the SDP is written only one
time, before starting the stream... So a small memcopy and memory
reallocation cannot be a problem.
I ran some minimal tests, and it works here (maybe it fails in some
other cases, but it is just a proof of concept)

Regarding the rtpenc_h264.c modifications, I think that introducing a
static inline const uint8_t *ff_avc_find_startcode_avc(const uint8_t *p, const uint8_t *end, int nal_length_size)
or a
static inline int ff_avc_nal_size_avc(const uint8_t *p, int nal_length_size)
helper (that can be shared with the bsf and with h264.c) can help in
writing a small patch.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: use_bsf_for_sdp.diff
Type: text/x-diff
Size: 2712 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100602/b4ce493b/attachment.diff>

More information about the ffmpeg-devel mailing list