[h323plus] "possible" bug in H323plus video codec for h.264

Simon Horne s.horne at packetizer.com
Fri Feb 25 08:53:05 EST 2011


H323plus does not call to_customise_options function. This is only for Opal.

 

Simon

 

From: h323plus-bounces at lists.packetizer.com
[mailto:h323plus-bounces at lists.packetizer.com] On Behalf Of Vladimir Fekete
Sent: 25 February 2011 23:33
To: opalvoip-devel at lists.sourceforge.net
Cc: h323plus at lists.packetizer.com
Subject: [h323plus] "possible" bug in H323plus video codec for h.264

 

Hello all,

 

 I've been playing with h.264-x264 plugin for a while and since I had no
problems between h323plus vs h323plus nor OpenPhone 3.8.3 application I do
have problems with 

 

video codec h.264 for h323 from recent h323 plus  (e.g. version 1.22.0,
01/11/2011)

and 

application based on recent opal (rev. 25192)

 

I say "possible" because - as was said from few recent mails on mailing
lists, opal and h323+ have similar root but they don't share plugins
(necessarily). Nevertheless, when I tried to make a connection from OPAL
application to h323+ based application, where both used h264-x264 plugin
from h323plus video codecs (v. 1.22.0), my opal application crashed. 

I traced down the problem and fixed the lines in h264-x264.cxx and now it
works for me.

 

 

 

Problem was following :

 

during the codec options set stage a method of OpalPluginMediaFormatInternal
class is called. This one (opalpluginmgr.cxx)

 

bool OpalPluginMediaFormatInternal::AdjustOptions(OpalMediaFormatInternal &
fmt, OpalPluginControl & control) const

 

call was made from void H323Capabilities::BuildPDU(const H323Connection &
connection,  H245_TerminalCapabilitySet & pdu) const

line n.2706 (capability.GetWritableMediaFormat().ToCustomisedOptions();) in
h323caps.cxx

 

in method AdjustOptions there are 2 variables set inside :

 

    char ** input = fmt.GetOptions().ToCharArray(false);

    char ** output = input;

 

and yes there are set *correctly*

 

they are immediately followed by this line (in my case line n. 477 in
opalpluginmgr.cxx)

 

    bool ok = control.Call(&output, sizeof(output)) != 0;

 

which calls (opalpluginmgr.h)

 

    int  OpalPluginControl::Call(void * parm, unsigned   parmLen, void *
context = NULL) const

 

and that one calls 

 

    int OpalPluginControl::Call(void * parm, unsigned * parmLen, void *
context = NULL) const

 

(these 2 methods are not same, difference is in the second parameter, one is
not a pointer other is) and this second Call(..) calls to_customised_options
from h264_x264.cxx

 

    static int to_customised_options(const struct PluginCodec_Definition *
codec, void * _context, const char *, void * parm, unsigned * parmLen)

 

and there is a line (in my case 837)

 

    const char ** option = (const char **)parm;

 

and here is the problem. if you look at the chain :

 

    AdjustOptions > Call > the "other" Call > to_customised_options

 

then you see that the output variable is transfered as :

 

   AdjustOptions               &output    char***

   Call                              parm        void *

   Call                              parm        void *

   to_customised_options  parm        void*

 

so in the end, parm is char *** and not char ** and this caused the crash

 

 

 

 How I fixed it 

 

changed "to_custoimized_options", file
h323plus/plugins/video/H.264/h264-x264.cxx, line number 837

   const char ** option = (const char **)parm;

to

   const char ** option = *((const char ***)parm);

 

and also (same function, same file, line 858)

    char ** options = (char **)parm;

to

    char ** options = *((char ***)parm);

 

recompiled h264 plugin and it works.

 

 

 

Best regards,

 

 Vladimir Fekete

 

P.S.  I don't want to call it a bug because I'm not sure whether it's valid
to mix h323plus codecs with opal (eg. separately they may work ok).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.packetizer.com/pipermail/h323plus/attachments/20110225/b06013ec/attachment.htm>


More information about the h323plus mailing list