Bug in H264 decode buffer size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Bill,

Just fixed this in SVN trunk, see https://trac.pjsip.org/repos/ticket/1769.

Thank you for the report.

BR,
nanang



On Mon, May 19, 2014 at 11:15 PM, Bill Gardner <billg at wavearts.com> wrote:

> I'd like to report a bug in how PJSIP 2.2 allocates H264 video decode
> buffer. I discovered the issue when connecting to another endpoint sending
> 4CIF format video (704x576), using H264. This resulted in no video decoding
> and the following repeated errors in log:
>
> 10:02:34.142 vstdec0298F6EC  Error: not enough buffer for decoded frame
> (supplied=589824, required=608256)
> 10:02:34.169 vstdec0298F6EC  codec decode() error: Size is too short
> (PJ_ETOOSMALL) [err:70019]
>
> PJSIP uses the largest possible frame supported by the H264 profile level
> which also has 3/2 aspect ratio, in multiples of 16 pixels (the H264
> macroblock size). See function find_highest_res() in vid_codec_util.c. So
> at level 3.0 PJSIP allocates a 768x512 frame, exactly 3/2 aspect ratio.
> PJSIP can resize dynamically, but only to smaller frame sizes. So when 4CIF
> comes in at 704x576 (which is a slightly larger image but still supported
> by level 3.0) PJSIP can't decode the video and emits error messages.
> Fortunately an easy workaround is to set the profile level to 3.1 and then
> PJSIP allocates a pretty huge frame for decoding.
>
> It seems the proper fix is to allocate a frame buffer large enough to hold
> the maximum number of macroblocks for the profile level, without concern
> for accurate aspect ratio. I realize now that 4CIF is 1620 macroblocks
> which is the maximum for profile level 3.0, and 704x576 is the closest to
> 3/2 ratio you can get using 1620 macroblocks. So maybe these max sizes need
> to be baked in?
>
> Bill
>
>
>
>
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
>
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20140604/5fc1f9c9/attachment.html>


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux