WebRTC is an open source technology that enables voice and video communication over web pages without the need to install any plug-ins in a browser. Today, WebRTC technology is more mature and integrates the best voice/video engine, which is widely used for video calls.
During the development of WebRTC, video data stream can be obtained after the remote SDP is set up. If it is on the JS side, then the operation is actually relatively simple. But the C++ side is a little trickier. Because WebRTC comes with a Javascript API layer at the top, you can use it in your browser. This makes it easier to develop and integrate real-time communications from anywhere. Internally, WebRTC is still implemented primarily in C/C ++.
Some developers are not quite sure how to get video stream data from WebRTC C++. Today we will share with you this development technique: how WebRTC get video stream data from C ++ terminal.
1. First, in WebRTC, SRC/API/create_PeerConnection_factory. h has a function to create a peerconnection factory and return an instance interface. The code is as follows:
SRC/API/peer_Connection_interface has a peer connection. Use the peer factory to create an instance of this connection. The code is as follows:
3. Seeing this, we only need to focus on the last parameter of the CreatePeerConnection function. This parameter needs to be overridden. There are more virtual functions that need to be overridden. Roughly rewritten are ICE, orbit, connection state, and so on.
4. At this point you should have figured out how to get the video data stream. The audio override method has an OnTrack function that listens for incoming video stream instances.
5, responsible for rewriting webrtc: : PeerConnectionObserver function inside the virtual function, can realize to monitor transmission to come over to the flow of information. To obtain video stream data, just pay attention to OnTrack function:
Webrtc: : RtpTransceiverInterface interface find receiver () method, from the receiver () method found in track () method, the track () method is to obtain the information of video streaming.
WebRTC is not limited to voice and video, it is powerful and versatile, which is why WebRTC technology is becoming more and more popular.
EasyRTC video conference cloud service developed based on open source WebRTC technology, widely used in education, finance, medical and health care, enterprise training, remote office and other scenarios, support the current technology of all browsers including Google Chrome, Mozilla Firefox, Apple Safari and Microsoft Edge. Not only limited to browser, EasyRTC can also support communication between wechat small program, H5 page, APP, PC client and other access methods, quickly build real-time audio and video communication from scratch; Support video calls between multiple people and one million people, meeting voice and video social networking requirements.