how to integrate OPENH264 to webrtc sdk
- how to integrate OPENH264 to webrtc sdk
- description
- step 1 compile openh264
- step 2 implement H264Encoder and H264Decoder of webrtc
- step 3 write a h264gypi to compile the h264 codec
- step 4 some modifications of code according to the webrtc code version and the change of directories
- step 5 compile the webrtc sdk
- step 6 peerconnection work on openh264
- step 7 recompile webrtc sdk
description
The webrtc sdk does not support h264 yet. But we can use open source h264 implementation such as openh264 and x264 to make it work. This document talk about integrate openh264 to webrtc sdk on ubuntu 14.04(64bits), the idea and the basic code is based on the blog
http://blog.csdn.net/liuhongxiangm/article/details/48523939 ,thanks to the author.
step 1: compile openh264
- the code of openh264 is here:https://github.com/cisco/openh264
- before compile openh264 you need to install nasm:http://www.nasm.us/
- go into the folder of openh264 run “make ARCH=x86_64” and “make install”, by default the lib is in /usr/local/lib
- the lib named libopenh264.a is what we need
step 2: implement H264Encoder and H264Decoder of webrtc
the implementation of the two classes is in the code of this blog http://blog.csdn.net/liuhongxiangm/article/details/48523939 , what we need is 4 files:h264.h, main.h, h264_impl.h and h264_impl.cc
put the h264.h to src/webrtc/modules/video_coding/codecs/h264/include folder
put the other 3 files to src/webrtc/modules/video_coding/codecs/h264/ folder
step 3: write a h264.gypi to compile the h264 codec
the gyp file is used to generate a .ninja file which is similar to a MakeFile.
you will need to install pkg-config if you use my version of h264.gypi
here is the h264.gypi I wrote:
# Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
{
'includes': [
'../../../../build/common.gypi',
],
'targets': [
{
'target_name': 'webrtc_h264',
'type': 'static_library',
'sources': [
'main.h',
'include/h264.h',
'h264_impl.cc',
'