WebRTC Videoengine Ultra-Detailed tutorial (ii)--integrated OPENH264 codec

Source: Internet
Author: User

http://blog.csdn.net/nonmarking/article/details/47910043


This series is currently a total of three articles, follow up will also update

WebRTC Videoengine Ultra-Detailed tutorial (i)--the basic process of video Call

WebRTC Videoengine Ultra-Detailed tutorial (ii)--integrated OPENH264 codec

WebRTC Videoengine Ultra-Detailed tutorial (iii)-- Overview of Integrated X264 encoding and FFmpeg decoding

WEBRTC native support VP8 and VP9, but can also be self-integrated H264 codec, the more common is OPENH264 and X264 (X264 itself only encoding function, if you want to add decoding function, you can combine ffmpeg), overall, The process of integrating H264 codecs is similar to the process of using their libraries directly, but the corresponding functionality is repackaged in accordance with the encapsulation of the codec in WebRTC, and then used in the main process by registering an external codec.

Let's take a look at the WEBRTC of the codec in the package form, defined in the Webrtc\modules\video_coding\codecs\interface\video_codec_interface.h, as follows

Videoencoder

[CPP]  View plain copy class encodedimagecallback   {   public:        virtual ~encodedimagecallback ()  {};          //  callback function which is called when an image has been  encoded.       //       // Input:        //          -  encodedimage         : the encoded image        //       // Return value                     :  > 0,   signals to the caller that one or more  future frames       //                                            should be dropped to  keep bit rate or frame rate.       //                                     = 0,    if OK.       //                                     < 0,   on error.        virtual int32_t       encoded (encodedimage& encodedimage,               const CodecSpecificInfo*  codecspecificinfo = null,                const rtpfragmentationheader* fragmentation = null)  = 0;   };      class videoencoder   {   public:        virtual ~videoencoder ()  {};          //  initialize the encoder with the information from the videocodec.        //       // Input:        //          - codecSettings      :&nbSp codec settings       //           - numberofcores     : number of cores available  for the encoder       //           - maxPayloadSize    : The maximum size  each payload is allowed       //                                  to have. usually mtu - overhead .       //       // Return value                  : webrtc_ Video_codec_ok if ok, < 0 otherwise.       virtual int32_t  Initencode (const videocodec* codecsettings, int32_t numberofcores, uint32_t  maxpayloadsize)  = 0;          // encode an i420  image  (as a part of a video stream).  the encoded image        // will be returned to the user through  the encode complete callback.       //        // Input:       //           - inputimage        : image to  be encoded       //           - codecspecificinfo : pointer to codec specific data       //           - frame_types         : The frame type to encode       //   

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.