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 //