[FFmpeg-devel] [PATCH] RTP H.264 invalid scaling dimension

Luca Abeni lucabe72
Mon Nov 2 09:19:46 CET 2009

Hi Gordon,

Gordon Irlam wrote:
> And then ffmpeg immediatley exits.  The original image was 320x480,
> but is incorrectly interpreted as 3x0 by parse_h264_sdp_line() inside
> libavformat/rtp_h264.c
> This is due to a small bug a patch for which is attached.
> In reviewing the bug it might help to know the following declarations
> in the code:
>         char buf1[50];
>         char *dst = buf1;
> This patch fixes the problem, and ffmpeg now reads the RTSP/RTP
> stream

The patch looks correct to me, thanks for investigating this issue
(I think this explains some bugs that have been reported in the past,
too). If noone objects in 2 or 3 days, I'll commit it.

However, I am a little bit surprised by this code... Can you please try
to comment out the
         codec->width = atoi(buf1);
         codec->height = atoi(p + 1); // skip the -
         codec->pix_fmt = PIX_FMT_YUV420P;
lines inside the "if (av_strstart(p, "framesize:", &p)) {" block,
and see what happens?
(I think the information about height, width, etc... are in the PPS
and SPS NALs, so I am not sure if setting them here is a good idea
or not...)

>, although it gets numerous "non-existing PPS referenced"
> errors, which I haven't yet been able to track down.

Do you see these warnings only when you start playing the stream,
or are they continuously repeated? Does your SDP contain an
"sprop-parameters-set" entry?

> So I have a general question.  Given this bug appears to have been
> present for a while, and seems like it may prevent RTP H.264 streams
> from working at all, does anyone have any insight into the overall
> state of the RTP H.264 code?

Well, I cannot comment about the state of all the code (I believe the
whole RTP demuxer has issues), but in my experience it generally works.
This particular bug does not affect all the RTP H.264 streams, but only
the ones containing a "framesize:" entry (which, as far as I know, is
not mandatory). I used libavformat to receive some H.264 streams over
RTP in the past, and it worked.
(but keep in mind that there are issues if the RTP packets arrive in
the wrong order, etc...)


More information about the ffmpeg-devel mailing list