Query Regarding H264 implementation in chromium

233 views
Skip to first unread message

venkatesh

unread,
Sep 19, 2016, 8:43:17 AM9/19/16
to discuss-webrtc
Hi All,

We are developing an application which requires H264 video codec support. We are using CEF3 as a base for our application.

So currently we are using chromium 47 (2526 80). So the recent requirement is to use the Cisco open H264 for the project.

 

I had been trying to implement it and facing some issues, can you please help to resolve or come out of the issue.

I am currently going with 2 approaches parallely, given the details below;

 

 

First approach:- Was to use the cisco openH264 API in my application;

 

In this I am downloaded the cisco binary into my application at run time and loading that library into the application.

Classes for encoder and decoder are written to use the API’s provided by cisco open H264.

 

class ExternalH264EncoderFactory : public cricket::WebRtcVideoEncoderFactory     (encoderFactoryObj)

class ExternalH264DecoderFactory : public cricket::WebRtcVideoDecoderFactory     (decoderFactoryObj)

 

I am creating the object of peer connection factory by calling  webrtc::CreatePeerConnectionFactory() with below details;

webrtc::CreatePeerConnectionFactory(worker, signalling, audioDeviceModule, encoderFactoryObj, decoderFactoryObj);

 

The above API interface is given below; (third_party\libjingle\source\talk\app\webrtc\peerconnectioninterface.h)

CreatePeerConnectionFactory(rtc::Thread* worker_thread, rtc::Thread* signaling_thread, AudioDeviceModule* default_adm, cricket::WebRtcVideoEncoderFactory* encoder_factory, cricket::WebRtcVideoDecoderFactory* decoder_factory);

 

Added the H264 codec by calling  VideoCodec() (third_party\libjingle\source\talk\media\webrtc\webrtcvideoencoderfactory.h)

 

I am able to do until this; now my job is to set the peerconnectionfactory object back into webRTC I got struck here;

When I searched the chromium where all this API is called CreatePeerConnectionFactory(), I did find it in following places;

       E:\chromium47_2526_with_deviceBinding\chromium47_2526\chromium\src\third_party\webrtc\examples\peerconnection\client\conductor.cc

       E:\chromium47_2526_with_deviceBinding\chromium47_2526\chromium\src\third_party\libjingle\source\talk\app\webrtc\test\peerconnectiontestwrapper.cc

       E:\chromium47_2526_with_deviceBinding\chromium47_2526\chromium\src\third_party\libjingle\source\talk\app\webrtc\java\jni\peerconnection_jni.cc

       E:\chromium47_2526_with_deviceBinding\chromium47_2526\chromium\src\third_party\libjingle\source\talk\app\webrtc\peerconnection_unittest.cc

       E:\chromium47_2526_with_deviceBinding\chromium47_2526\chromium\src\third_party\libjingle\source\talk\app\webrtc\peerconnectioninterface_unittest.cc

       E:\chromium47_2526_with_deviceBinding\chromium47_2526\chromium\src\third_party\libjingle\source\talk\app\webrtc\peerconnectionfactory_unittest.cc

       E:\chromium47_2526_with_deviceBinding\chromium47_2526\chromium\src\remoting\host\cast_extension_session.cc

       E:\chromium47_2526_with_deviceBinding\chromium47_2526\chromium\src\content\renderer\media\webrtc\peer_connection_dependency_factory.cc

Can you please let me know which is the proper place to set it or I am doing something wrong. Since I got struck here for long time I am also looking for the second approach.

 

 

Second Approach:- Using the chromium patch https://codereview.webrtc.org/1306813009

I initially tried some months back when the patches were not complete but was not successful to make H264 work. Since now the patch is completed I am thinking to use the same.

But as per the patch it uses the encoding of open H264 (compile time) and decoder of FFMpeg. So if I use the same in my application then we need to pay the license for the MPEGLA (encoding) and FFmpeg  for using decoding feature. Which in my current project is not expected.

 

Can I use the encoding similar code and link the cisco provided binary at dynamic time to avoid the MPEGLA license.

Also when I was going through the link (https://bugs.chromium.org/p/chromium/issues/detail?id=500605hbos commented that if we want to use the open H264 decode we can use the patch set 16. Is this possible as to use the decoder of open H264 instead of FFmpeg decoder?

 

And for both of them can I use the dynamic linking instead of static linking to avoid the MPEGLA license?

 

 

Waiting for your valuable feedback.

 

Regards,

Venkatesh

Peter Boström

unread,
Sep 19, 2016, 10:03:42 AM9/19/16
to discuss-webrtc
FWIW I'd try building and using a later version than M47, I recall us fixing some pretty bad bugs with H264 support before rolling it out. Current stable is M53.

For hardware encoding Chromium injects an RTCVideoEncoderFactory here. It's possible you can modify RTCVideoEncoderFactory or replace it with an instance of an encoder factory that you provide. This is how I would get external encoder instances into the project if you cannot use the ones implemented internally. This is not an answer to the questions regarding license, which I'm not capable of answering.

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/e4020019-4267-42a0-a95c-7b58a056c575%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

venkatesh

unread,
Sep 21, 2016, 5:11:45 AM9/21/16
to discuss-webrtc

Thanks Peter for the quick response,  

I will try following your suggestion.

Initially before posting the query I did try to modify peer_connection_dependency_factory.cc and update the peerConnectionFactory object in

PeerConnectionDependencyFactory::InitializeSignalingThread. But was unable to link to the main library.

 

Also for second approach planning to use the chromium 51 as CEF is still in dev channel for 53. Forgot to mention it in the initial post.


Regards,

Venkatesh

venkatesh

unread,
Oct 10, 2016, 8:04:44 AM10/10/16
to discuss-webrtc
Hi Peter,

I did try by adding a global function in \content\renderer\media\webrtc\peer_connection_dependency_factory.cc and try to set the pc_factory(peer Connection Dependency object) in the PeerConnectionDependencyFactory::InitializeSignalingThread(). But When i run I am always getting NULL for the external encoder and decoder factory;

global function, which is called from my CEF3 application;
webrtc::PeerConnectionFactoryInterface *webrtcPeerConnectionFactory = NULL;

void updatePeerConnectionFactory(webrtc::PeerConnectionFactoryInterface **webrtcPeerConnectionFactory1)
{
webrtcPeerConnectionFactory = *webrtcPeerConnectionFactory1;
}

Am i missing anything in this. Or is it not the right process to do it. Please help me with this.


Regards,
Venkatesh


On Monday, September 19, 2016 at 7:33:42 PM UTC+5:30, Peter Boström wrote:

Peter Boström

unread,
Oct 10, 2016, 11:27:44 AM10/10/16
to discuss-webrtc
Don't know, sorry. I haven't actually done this and I'm not at all familiar with the snippet you posted.

I just thought you had to modify content/renderer/media/webrtc/peer_connection_dependency_factory.cc to inject your own encoder_factory implementation.

Best,
- Peter

venkatesh

unread,
Oct 12, 2016, 6:53:43 AM10/12/16
to discuss-webrtc
Thanks Peter for the information.
What i am doing is in my application i am creating a CreatePeerConnectionFactory object with external encoder and decoder (implemented for H264 support) objects.
Created object I am trying to set in the webrtc peer_connection_dependency_factory.cc. But its not working. As the object what i passed when it comes to chromium is null. Hence its not working. Is there any specific way we need to pass the object created in my application to chromium webrtc to reflect there?

Regards,
Venkatesh

venkatesh

unread,
Oct 13, 2016, 5:29:47 AM10/13/16
to discuss-webrtc
Hi All,

Is there any mechanism to communicate with different processes in chromium?

Regards,
Venkatesh
Reply all
Reply to author
Forward
0 new messages