The main reference in this document is [1], which takes the code from the reference article. But [1] did not upload the complete code. Environment configuration can refer to the previous article [2]
The main realization of the video in the local transmission. It took a day.
As for WEBRTC video capture, codec, please refer to the online blog, here is not mentioned.
Compile using CMake to generate makefile, step cmake. Note the points that follow, and make.
Add: Packets received should be timestamp-stamped, so the two functions in Mainwindow.cpp are modified:
void Mainwindow::recvrtpdata (char*data,int length)
{
Rtc::copyonwritebuffer packet (reinterpret_cast< Const uint8_t*> (data), length);
Videochannel_->onpacketreceived (&packet,rtc::createpackettime (0));
}
void Mainwindow::recvrtcpdata (char*data,int length)
{
Rtc::copyonwritebuffer packet (reinterpret_cast< Const uint8_t*> (data), length);
Videochannel_->onrtcpreceived (&packet,rtc::createpackettime (0));
}
Rtc::createpackettime (0) This function can create time information associated with a packet.
[1] WEBRTC Learning Ten: The simplest video chat (using WebRtcVideoEngine2)
[2]WEBRTC video capture and display via QT
[3] Baidu network disk download address