Introduction to the WEBRTC audio processing process

Source: Internet
Author: User

This article provides an overview of the WEBRTC audio processing flow, as shown in the following diagram:


WebRTC an audio session is abstracted into a channel, such as A and b for audio calls, a needs to establish a channel and b for audio data transmission. The figure above has three channel, each channel contains codec and real-time Transport protocol (real-time Transport Protocol,RTP)/ The real-time Transport Control Protocol (real-time control PROTOCOL,RTCP) sends the function .

In the case of a channel, the application will contain three active threads, a recording thread, an audio receive thread, and a playback thread .

1) Recording thread : responsible for the microphone audio collection, see the Red path in the picture, after the acquisition of audio, cache to a certain length, audio processing, mainly including aEC,AGC and NS . Then sent to the channel, after the audio codec module encoding, encapsulated into RTP packets, sent through the socket;

2) receive thread : see Blue Path, responsible for receiving the remote sent over the audio packet, unpack the RTP packet, decode the audio data, fed into the Neteq module cache.

3) Play thread : responsible for headphone sound playback, see green Path. The playback thread goes to the outmixer to get the audio data to play, first obtains the audio frame Neteq stored in the channel that participates in the session, can do the AGC and NS processing, then mixes the audio signal of multiple channel, obtains the mixed audio, Passed to the Audioprocessing module for remote analysis. Finally play it out.

The following is a local loopback recording and playback code:

[CPP]   View plain  copy voiceengine* ve = voiceengine::create ();    Voebase* base = voebase::getinterface (VE);   base->init ();   Int chid = base->createchannel ();   base->setsenddestination (chId,3000, " 127.0.0.1 ", 4000);   Base->setlocalreceiver (chid,3000,3001," 127.0.0.1 ");   base-> Startplayout (chId);   base->startreceive (chId);   base->startsend (chId);              //....sleep...wait.....      Base->stopsend (chId);      base->stopreveive (chId);      base-> Stopplayout (chId);      base->terminate ();  

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.