WEBRTC use of audio and video engines

Source: Internet
Author: User
WEBRTC use of audio and video engines
At the request of the group of brothers, now how to use WEBRTC audio and video demo put out. Code format is very bad, you look at the spectators do not bother to tidy up.

#include <iostream> #include <Windows.h> #include <tchar.h> #include <WinSock.h> #include < process.h> #include "voe_base.h" #include "voe_network.h" #include "voe_codec.h" #include "voe_network.h" #include " Voe_rtp_rtcp.h "#include" voe_errors.h "#include" voe_audio_processing.h "#include" vie_base.h "#include" vie_ Network.h "#include" vie_codec.h "#include" vie_network.h "#include" vie_rtp_rtcp.h "#include" vie_image_process.h "# Include "Vie_capture.h" #include "webrtc/modules/video_capture/include/video_capture_factory.h" #include "vie_ Render.h "#include <list> #pragma comment (lib," Ws2_32.lib ")//* #pragma comment (lib," Audio_coding_module.lib ") # pragma comment (lib, "Audio_conference_mixer.lib") #pragma comment (lib, "Audio_device.lib") #pragma comment (lib, "audio _processing.lib ") #pragma comment (lib," Audio_processing_sse2.lib ") #pragma comment (lib," Audioproc_debug_proto.lib ") ) #pragma comment (lib, "Bitrate_controller.lib")//#pragma comment (lib, "Call.liB ") #pragma comment (lib," CNG.lib ") #pragma comment (lib," Common_video.lib ") #pragma comment (lib," Crnspr.lib ") #pragma Comment (lib, "Crnss.lib") #pragma comment (lib, "Directshow_baseclasses.lib") #pragma comment (lib, "Expat.lib") #pragma Comment (lib, "G711.lib") #pragma comment (lib, "G722.lib") #pragma comment (lib, "Genperf_libs.lib") #pragma comment (lib, "Gunit.lib") #pragma comment (lib, "Icui18n.lib") #pragma comment (lib, "Icuuc.lib") #pragma comment (lib, "ILBC.lib") # pragma comment (lib, "ISAC.lib") #pragma comment (lib, "ISACFix.lib") #pragma comment (lib, "Jsoncpp.lib") #pragma comment ( LIB, "Libjingle.lib") #pragma comment (lib, "Libjingle_media.lib") #pragma comment (lib, "Libjingle_p2p.lib") #pragma Comment (lib, "Libjingle_peerconnection.lib") #pragma comment (lib, "Libjingle_sound.lib")//#pragma comment (lib, " Libjingle_unittest_main.lib ") #pragma comment (lib," Libjingle_xmpphelp.lib ") #pragma comment (lib," Libjpeg.lib ") # pragma comment (lib, "Libsrtp.lib") #pragma comment (lib, "Libvpx.lib") #pragma comment (lIB, "Libvpx_asm_offsets.lib") #pragma comment (lib, "Libvpx_asm_offsets_vp9.lib") #pragma comment (lib, "Libvpx_ Intrinsics.lib ") #pragma comment (lib," Libyuv.lib ") #pragma comment (lib," Media_file.lib ") #pragma comment (lib," NetEq.lib ") #pragma comment (lib," Nss_static.lib ") #pragma comment (lib," Opus.lib ") #pragma comment (lib," Paced_ Sender.lib ") #pragma comment (lib," PCM16B.lib ")//#pragma comment (lib," Peerconnection_client.lib ") #pragma comment ( LIB, "Protobuf_full_do_not_use.lib") #pragma comment (lib, "Protobuf_lite.lib") #pragma comment (lib, "Remote_bitrate_ Estimator.lib ") #pragma comment (lib," Resampler.lib ") #pragma comment (lib," Rtp_rtcp.lib ") #pragma comment (lib," signal _processing.lib ") #pragma comment (lib," Sqlite3.lib ") #pragma comment (lib," System_wrappers.lib ") #pragma comment (lib, "Udp_transport.lib") #pragma comment (lib, "Vad.lib") #pragma comment (lib, "Video_capture_module.lib") #pragma comment ( LIB, "Video_coding_utility.lib") #pragma comment (lib, "Video_engine_core.lib") #pragma comment (lib, "VIdeo_processing.lib ") #pragma comment (lib," Video_processing_sse2.lib ") #pragma comment (lib," Video_render_ Module.lib ") #pragma comment (lib," Voice_engine_core.lib ") #pragma comment (lib," Webrtc_i420.lib ") #pragma comment (lib , "Webrtc_opus.lib") #pragma comment (lib, "Webrtc_utility.lib") #pragma comment (lib, "Webrtc_video_coding.lib") # pragma comment (lib, "Webrtc_vp8.lib")//*/using namespace WebRTC; int Viecreatewindow (HWND &hwndmain, int xPos, int yPos, int width, int height, tchar* className); LRESULT CALLBACK Vieautotestwinproc (HWND hwnd, UINT umsg, WPARAM WPARAM, LPARAM LPARAM); unsigned __stdcall Servicerun (void* trans); unsigned __stdcall Servicertcprun (void* trans); Class My_transportation:public Transport {public:my_transportation (voenetwork* vo): Netw (VO) {} int sendpacket (int ch annel,const void *data,int len); int sendrtcppacket (int channel, const void *data, int len); Private:voenetwork* NETW; }; int my_transportation::sendpacket (int channel,const void *data,int len){Netw->receivedrtppacket (channel, data, Len); return Len;} int my_transportation::sendrtcppacket (int channel, const void *data, int len) {Netw->receivedrtcppacket (channel, data, Len); return Len; } class Myobserver:public Voiceengineobserver {public:virtual void callbackonerror (const int channel, const int ERR_CO DE); }; void Myobserver::callbackonerror (const int channel, const int err_code) {//ADD printf for other error codes here if (err _code = = ve_typing_noise_warning) {printf ("TYPING NOISE detected \ n");} else if (Err_code = = ve_receive_packet_timeout) {printf ("RECEIVE PACKET TIMEOUT \ n"),} else if (Err_code = = ve_packet_receipt_restarted) {printf ("PACKET RECEIPT RES tarted \ n "); } else if (Err_code = = ve_runtime_play_warning) {printf ("RUNTIME PLAY WARNING \ n");} else if (Err_code = = Ve_runtime_re c_warning) {printf ("RUNTIME RECORD WARNING \ n"),} else if (Err_code = = ve_saturation_warning) {printf ("Saturation WAR NING \ n "); } else if (Err_code = = Ve_runtiMe_play_error) {printf ("Runtime PLAY ERROR \ n"),} else if (Err_code = = Ve_runtime_rec_error) {printf ("Runtime RECORD ERROR \ n "); } else if (Err_code = = ve_rec_device_removed) {printf ("RECORD DEVICE removed \ n");}} int Voicetest () {voiceengine* _voiceengine; Voebase* _vebase; Voenetwork* _venetwork; voecodec* _vecodec; voertp_rtcp* _vertcp; voeaudioprocessing* _veapmptr; _voiceengine = Voiceengine::create (); _vebase = Voebase::getinterface (_voiceengine); _venetwork = Voenetwork::getinterface (_voiceengine); _vecodec = Voecodec::

Related Article

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.