Realization of real-time voice communication

Source: Internet
Author: User

Introduction

Although I have learned VC + + Yinianbanzai, still feel stretched, fortunately have vckbase help, did learn a lot of things, www.vckbase.com also became every time I go to the People's Network (you do not know, I accept the most stringent management, on the civil network is to apply). Recently in doing a communication program, real-time voice and video communication is of course everyone likes. This article will show you a solution for real time voice communication in LAN environment (video This piece is doing, estimated soon to be able to be released), WinXP Environment Test effect is good, and have network congestion processing mechanism, you may as well see.

This paper is based on the 26th issue of Mr. Yi Yiming's "audio recorder program based on API", which is deeply appreciated. The similarities will no longer be discussed and the following developments are mainly made:

(1) The use of multithreading mechanism to achieve recording, network transmission, playback at the same time.

(2) Network congestion processing to ensure that data is not lost.

Example Program run Screen:

Below and look at me carefully:

(i) first defines a sound data "block"

struct CAudioData
{
  PBYTE lpdata; //指向语音数据,注意这里内存区域是动态申请释放的
  DWORD dwLength;//语音数据长度
}
Next, declare two loops and related pointers.

//InBlocks,OutBlocks非别为两个常数
CAudioData m_AudioDataIn[InBlocks],m_AudioDataOut[OutBlocks];
int  nAudioIn, nSend, //录入、发送指针
   nAudioOut, nReceive;//接收、播放指针
For recording and playback both exist and network synchronization problem, mainly rely on these pointers to coordinate

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.