[h323plus] H323-SIP Gateway with H264 Support

Simon Horne s.horne at packetizer.com
Tue Apr 3 22:39:51 EDT 2012


Diego

 

There are 2 functions to load the plugin.

PLUGIN_CODEC_IMPLEMENT(H264)  

PLUGIN_CODEC_DLL_API struct PluginCodec_Definition *
PLUGIN_CODEC_GET_CODEC_FN(unsigned * count, unsigned version)

These are left as they are (including all the macro associated with them)

 

All Encryption/Decryption is handled by the H264Encoder/H264Decoder classes.
Simple remove these classes and everything referenced by the classes.

Where they are instanced.

static void * create_encoder(const struct PluginCodec_Definition *
/*codec*/)

static void * create_decoder(const struct PluginCodec_Definition *
/*codec*/)

return NULL.

 

That's it. It should compile without needing FFMPEG or X264.

 

Simon

 

 

From: h323plus-bounces at lists.packetizer.com
[mailto:h323plus-bounces at lists.packetizer.com] On Behalf Of Diego Carvalho
Sent: 04 April 2012 03:57
To: h323plus at lists.packetizer.com
Subject: Re: [h323plus] H323-SIP Gateway with H264 Support

 

Hi Simon.
Again, I would like to thank you because you helped me to solve two
problems: make SIP and H323 endpoints exchange media directly and set
capabilities by call basis. Actually, the code you showed me didn't work in
my tests (remove all capabilities and then add the ones I want) but I could
at least remove the capabilities I don't want. Anyway, now my last big
problem is the H264 support. I'm totally lost. You said: "Simply supply the
codec definitions and the codec will be available in h323plus. ". But supply
where? I don't know where to define the PluginCodec_Definition or the other
things you mentioned. Since I'm not an expert on H264 (I know enough to make
things work, lol) I would like to use what is already done, I mean, is it
possible to make some changes in the H264 plugin to make it work only for
signaling or I need to make something from the scratch? Regardless the
answer, give me some instructions, please. Thanks in advance.

2012/3/27 Simon Horne <s.horne at packetizer.com>

Diego

 

Sorry for delay in replying

With Reference to the document you linked to

The plugin codec exports 2 functions for capability registration

unsigned int PWLibPlugin_GetAPIVersion()

PluginCodec_Definition
<http://www.voxgratia.org/docs/codec_plugins.html#PluginCodec_Definition>  *
OpalCodecPlugin_GetCodecs(unsigned * count, unsigned version)

 

The OpalCodecPlugin_GetCodecs function returns all the information you need
on the signaling side. Simply supply the codec definitions and the codec
will be available in h323plus. 

You DO NOT need to create the Codec Methods which link to FFMPEG/x264.

 

For only supplying the codecs you need rather than removing them for the
call. Clone the Capability List then remove all the orginal and add back the
ones you want.

In your derived 

void H323Connection::OnSetLocalCapabilities()

 

H323Capabilities * myCapabilities(localCapabilities);

localCapabilities.RemoveAll();

 

H323Capability * cap = myCapabilities.FindCapability("H.264*");

If (cap)

  LocalCapabilities.Add(cap);

 

 

Simon

 

From: Diego Carvalho [mailto:diego.cdomingos2010 at gmail.com] 
Sent: 28 March 2012 06:37
To: Simon Horne


Subject: [h323plus] H323-SIP Gateway with H264 Support

 

Hi Simon, thanks for answering again. Today I could establish SIP -> H323
audio calls. So now I only need to deal with the 2 points below.

I'm really interested in being able to add H.264 in the capability set
without having to link the library with FFMPEG/X264, but I couldn't
understand what you explained. I searched on the internet and found this:
http://www.voxgratia.org/docs/codec_plugins.html
that I believe is related to what you explained but even with this page I
couldn't realize what I have to do. Is it possible to configure the plugin
that comes with the source in this way? I mean, use the plugin in
h323plus/plugin/video/H.264 for only signaling, without have to link with
FFMPEG/X264.
Another question is again about the capabilities. You said that I can remove
the capabilities that aren't supported by the SIP endpoint. But this way, I
will have to add all possible capabilities to my gateway and them remove the
ones that SIP doesn't support. It would be much easier if my gateway could
start without any capabilities and then I add the ones that SIP supports. Is
that possible? If not, I will have to do what you explained but when I will
add all the capabilities again to be ready to handle the next call?
Again, thanks for all the help. 

 

2012/3/23 Simon Horne <s.horne at packetizer.com>

Diego

 

There is some issues with changes in FFMPEG v54 and a number of function
names changed and others were depreciated recommend v52. I am currently
working through issues with v54. Again X264 is a moving target but last I
looked it compiled on Linux. On Windows is a whole different story
unfortunately.

 

If you are only using the codec for signaling there should be no need to
link to either FFMPEG or X264 and you can gut the plugins and only define
the PluginCodec_Definitions,  Plugin_Codec_Implementation() and
PLUGIN_CODEC_GET_CODEC_FN. These are the signaling parts of the codec. The
Encoder/Decoder contexts can be removed. There is some changes in the CVS to
also allow you to load these plugins statically see the
openh323buildopt.h.in.

 

To filter capabilities on a call by call basis you can do this by overriding
H323Capabilities::OnSetLocalCapabilities() and use the
localCapabilities.Remove() function to remove the capabilities not used on
the SIP side.

 

Simon

 

From: h323plus-bounces at lists.packetizer.com
[mailto:h323plus-bounces at lists.packetizer.com] On Behalf Of Diego Carvalho
Sent: 23 March 2012 22:44
To: h323plus at lists.packetizer.com


Subject: Re: [h323plus] H323-SIP Gateway with H264 Support

 

Hi Simon and "chr_cb". First of all, thanks for your help. Today I was able
to establish an audio only call between H323 and SIP using the gateway I'm
developing. This is great but I still have some problems and I appreciate
any help on this:
1) Like I said, it was an audio only call. I was able to compile the plugins
with the packages from Ubuntu repositories (libx264-dev, libavcodec-dev and
libavutil-dev) but my project also uses ffmpeg and x264 so I would like to
compile with the latest source code from git we use. The config.log shows
some errors and on the internet I saw somebody saying that only a specific
version of ffmpeg allows the compilation. Is that true? If so, what would be
the version of ffmpeg and x264 I should use? Again, I would like to
reiterate that I only want to have H264 on my capabilities list (I don't
want to capture/render video). Do I indeed need the plugin? Is there another
way?
2) If I set the gateway capabilities in the beginning it works but I want so
set them in a later time. Specifically, I receive the call and send an
invite on hold to SIP. Then it will answer with 200 OK with SDP. In this
moment, when I have the SIP SDP, I want to set the gateway capabilities
based on what the SIP side supports. How can I do this? If I try to add in
this moment it simply doesn't add them.
Thanks in advance.

2012/3/13 Simon Horne <s.horne at packetizer.com>

Diego

The plugins load default capability instances into the H323Endpoint.
When the H323Connection is created these capabilities are cloned
In H323Connection::OnSetLocalCapabilities()
Simply remove the unmatched capabilities
localCapabilities.Remove("H.264*");

The H323_ExternalRTPChannel does not handle RTP but can be used to not use
the internal RTP system. You can have your own external RTP stack or not
have one at all.
You needed to read and populate H245_H2250LogicalChannelParameters in the
send and receive message of the class with those of the SIP Client.

I do have serious doubts what you are planning will work not because it
can't technically work but because of the differences in H.323 and SIP with
Video. H.323 is very strict on rules while SIP is very loose on
interpretations.
Here are the problems
1. RTP packetization H.323 says strictly single NAL SIP is undefined 2
options (Single NAL/Fragmented units) . You will get video on the H.323 side
just fine but your SIP side with some devices may not be able to decode.
2. Payload Type for H.264 is specified as being flexible but a lot of SIP
implementations have them fixed (usually 96 or 97) so H.323 requests 103
SIP always ends 97  no video on the H.323 side. There is no way you can fix
this with signaling as SIP tells the other party what it is going to send
and H.323 tells the party what it wants to receive. You have to proxy the
media to fix the payload type number.

Good luck.

Simon

============================================================================
=============================================

From: Diego Carvalho [mailto:diego.cdomingos2010 at gmail.com]
Sent: 14 March 2012 06:09
To: Simon Horne
Subject: Re: [h323plus] H323-SIP Gateway with H264 Support


Hi Simon, thanks for answering but I still have some doubts:
You said that this plugin will add the capability automatically. Actually,
as I said, I'm building a H323-SIP gateway so, for instance, when the SIP
endpoint is making a call I want to add the H264 capability only if the SIP
endpoint offers it. Will I be able to add the capability manually? For
instance, using localCapabilities.Add(new H323_H264Capability()). To
sumarize, I want to be able to add (or remove if it was automatically added
and the current call does not offer it) manualy the H264 capability.
Also I don't know if the H323_ExternalRTPChannel applies to my situation.
It's used to pass the RTP to another device. I don't want to handle the RTP
at all (to be clear: I don't want RTP arriving on the gateway's network
card). I want to send to h323 the RTP address/port SIP offered and
vice-versa, so the RTP will flow directly between the endpoints. Any
thoughts? Thanks in advance.
2012/3/13 Simon Horne <s.horne at packetizer.com>
Diego
 
H.264 is a video plugin in the plugin/video directory. You will need X264
and FFMPEG.  For Ubuntu they are libx264-dev  libavcodec-dev and
libavutil-dev.
 
You build the plugin .so and the helper (in the gpl subdirectory) and place
them both in the same directory as you app. The application will load them
at startup and automatically add the capability to the capabilityset etc
 
If you don't want to use the plugin for RTP then have a look at the
H323_ExternalRTPChannel. This will bypass the RTP handling in the codec to
whatever you want.
http://www.voxgratia.org/docs/external_rtp.html
(its from 2004 but still current)
 
Simon
 
 
From: h323plus-bounces at lists.packetizer.com
[mailto:h323plus-bounces at lists.packetizer.com] On Behalf Of Diego Carvalho
Sent: 14 March 2012 03:05
To: h323plus at lists.packetizer.com
Subject: [h323plus] H323-SIP Gateway with H264 Support
 
Hi all,
I'm working on a h323-sip gateway with video (H264) support and I'm facing
some problems. I'm new with H323plus and with h323 protocol itself (I'm
learning as I go) so excuse me if I say something stupid.
First of all, I believe that the stack can be used to build a gateway but it
seems that it's more focused on terminals. Am I right? So is it possible or
not to build a gateway using it?
Second, there is no native support for H264. The documentation shows the
class hierarchy. For audio we have, for instance, H323Cabability ->
H323RealTimeCapability -> H323AudioCapability -> H323_G711Cabability but we
don't have H323Cabability -> H323RealTimeCapability -> H323VideoCapability
-> H323_H264Cabability. I tried to create this one, extending from
H323Cabability -> H323RealTimeCapability -> H323VideoCapability ->
H323GenericVideoCabability and then I discovered that I would need to
override a function called CreateCodec to return a codec that handles the
video. But I don't want to handle the RTP media. I just want to put H264 in
the terminal capability set and establish a connection in a way that the
H323 and SIP terminals can exchange the media directly. I've heard about a
H264 plugin but it seems that it is for handling the media, so I don't know
if it fits my purpose. How can I achieve this? Is there any plan to support
H264 natively on H323plus? Also I need to get the remote RTP port. The only
way I found to do this is trough H323Connection::OnStartLocicalChannel but
this is called after a channel to handle the data is created and again, I
don't want to handle the RTP data. I appreciate any help. Thanks.

 

 

 

 

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


More information about the h323plus mailing list