亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? main.cxx

?? mcu for video conference test
?? CXX
?? 第 1 頁 / 共 4 頁
字號:
  return FALSE;
}

#endif

BOOL MyH323EndPoint::WriteAudio(const PString & thisToken, const void * buffer, PINDEX amount, PString roomID)
{
  PWaitAndSignal mutex(memberMutex);

  // Check that the room still exists
  if (memberListDict.Contains(roomID) == FALSE) {
    cout << "ROOM HAS BEEN REMOVED (WriteAudio)" << endl;
    return FALSE;
  }

  //The spokenList construct is required to determine who were the last
  //to speak, which is needed for determining which four videoimages are displayed.
  //spokenList contains a sorted list of when the last packet was received from
  //which connection. Thus, when an audio packet is received from a connection,
  //the name of the connection is moved to the end of the list.

  // If someone new comes along, everyone moves down.
#ifndef NO_VIDEO
  if ( DetectNoise(buffer,amount) ) {
    PStringList & spokenList = spokenListDict[roomID];
    PINDEX keyIndex = spokenList.GetStringsIndex(thisToken);
    if (keyIndex != P_MAX_INDEX)
      spokenList.RemoveAt(keyIndex);
    spokenList.AppendString(thisToken);  
    if (FindTokensVideoPosn(thisToken,roomID) != P_MAX_INDEX)
      goto processAudio;

    if (AddVideoPosnToken(thisToken,roomID))
      goto processAudio;
    
    keyIndex = spokenList.GetSize() - 1;
    PStringList & videoPosnList = videoPosnDict[roomID];
    if (keyIndex >= videoPosnList.GetSize()) {
      PString tokenToWipe = spokenList[keyIndex-videoPosnList.GetSize()];
      keyIndex = FindTokensVideoPosn(tokenToWipe,roomID);
    }
    if(keyIndex != P_MAX_INDEX)
      videoPosnList[keyIndex] = thisToken;
  }

    processAudio:
#endif

  PStringList & memberList = memberListDict[roomID];

  PINDEX i;
  for (i = 0; i < memberList.GetSize(); i++) {
    PString token = memberList[i];
    if (token != thisToken) {
      MyH323Connection * conn = (MyH323Connection *)FindConnectionWithLock(token);
      if (conn != NULL) { 
	conn->WriteAudio(thisToken, buffer, amount);
        conn->Unlock();
      }
    } else {
      // Do not lock as we are looking for our own connection.
      // This should only happen in audio loopback mode as we do not
      // normally want to add our own voice to the audio we hear from the MCU.
      MyH323Connection * conn = (MyH323Connection *)FindConnectionWithoutLocks(thisToken);
      if (conn != NULL) { 
        conn->WriteAudio(thisToken, buffer, amount);
      }
    }
  }

  return TRUE;
}

BOOL MyH323EndPoint::ReadAudio(const PString & thisToken, void * buffer, PINDEX amount, PString roomID)
{
  PWaitAndSignal mutex(memberMutex);

  // Check that the room still exists
  if (memberListDict.Contains(roomID) == FALSE) {
    cout << "ROOM HAS BEEN REMOVED (ReadAudio)" << endl;
    return FALSE;
  }

  PStringList & memberList = memberListDict[roomID];

  PINDEX i;
  for (i = 0; i < memberList.GetSize(); i++) {
    PString token = memberList[i];
    if (token == thisToken) {
      MyH323Connection * conn = (MyH323Connection *)FindConnectionWithLock(token);
      if (conn != NULL) {
        conn->ReadAudio(thisToken, buffer, amount);
        conn->Unlock();
      }
    }
  }

  return TRUE;
}

#ifndef NO_VIDEO
BOOL MyH323EndPoint::DetectNoise(const void * buffer, PINDEX amount)
{
  short *start = (short *)buffer;
  short *end   = start + (amount/2);
  int sum;
  
  sum=0;
  while (start != end) 
    if(*start<0)
      sum -= *start++;
    else
      sum += *start++;

  return (sum/amount) > 50;
}



BOOL MyH323EndPoint::WriteVideo(const PString & thisToken, const void * buffer, PINDEX amount, PString roomID)
{
  PWaitAndSignal mutex(memberMutex);

  // Check that the room still exists
  if (videoBufferDict.Contains(roomID) == FALSE) {
    cout << "ROOM HAS BEEN REMOVED (WriteVideo)" << endl;
    return FALSE;
  }

  VideoBuffer & videoBuffer = videoBufferDict[roomID];

  // The last four elements of spokenList indicate the last
  // four connections from which audio was received.
  PINDEX keyIndex = FindTokensVideoPosn(thisToken,roomID);
  if (keyIndex != P_MAX_INDEX)
    videoBuffer.Write((BYTE *)buffer, amount, keyIndex);

  return TRUE;
}


BOOL MyH323EndPoint::ReadVideo(const PString & /*thisToken*/, void * buffer, PINDEX amount, PString roomID)
{
  PWaitAndSignal mutex(memberMutex);

  // Check that the room still exists
  if (videoBufferDict.Contains(roomID) == FALSE) {
    cout << "ROOM HAS BEEN REMOVED (ReadVideo)" << endl;
    return FALSE;
  }

  VideoBuffer & videoBuffer = videoBufferDict[roomID];
  videoBuffer.Read((BYTE *)buffer,amount);
 
  return TRUE;
}
#endif

///////////////////////////////////////////////////////////////

MyH323Connection::MyH323Connection(MyH323EndPoint & _ep, unsigned callReference)
  : H323Connection(_ep, callReference), ep(_ep), connected(FALSE)
{
  incomingAudio = NULL;
  outgoingAudio = NULL;
  audioReceiveCodecName = audioTransmitCodecName = "none";

#ifndef NO_VIDEO
  incomingVideo = NULL;
  outgoingVideo = NULL;
  videoReceiveCodecName = videoTransmitCodecName = "none";
#endif

	aborted = FALSE;

  cout << "Opening connection" << endl;
}

MyH323Connection::~MyH323Connection()
{
  cout << "Closing connection" << endl; 

#ifdef LOGGING
	LogCall(*this);
#endif

    delete incomingAudio;
    delete outgoingAudio;

#ifndef NO_VIDEO
    delete incomingVideo;
    delete outgoingVideo;
#endif
}

void MyH323Connection::CleanUpOnCallEnd()
{
  if (incomingAudio)
    incomingAudio->Close();
  if (outgoingAudio)
    outgoingAudio->Close();

#ifndef NO_VIDEO
  if (incomingVideo)
    incomingVideo->Close();
  if (outgoingVideo)
    outgoingVideo->Close();
#endif

  if (!aborted && connected)
    ep.RemoveMember(this);

  H323Connection::CleanUpOnCallEnd();
}

H323Connection::AnswerCallResponse
     MyH323Connection::OnAnswerCall(const PString & caller,
                                    const H323SignalPDU & setupPDU,
                                    H323SignalPDU & /*connectPDU*/)
{
  if (!setupPDU.GetQ931().GetCalledPartyNumber(roomID)) {
    const H225_Setup_UUIE & setup = setupPDU.m_h323_uu_pdu.m_h323_message_body;
    PINDEX i;
    for (i = 0; i < setup.m_destinationAddress.GetSize(); i++) {
      roomID = H323GetAliasAddressString(setup.m_destinationAddress[i]);
      if (!roomID)
        break;
    }

    // If a room was not specified in the connection then use the default
    // room name.
    PString defaultRoomName = ep.GetDefaultRoomName();

    if ((roomID.IsEmpty()) && (defaultRoomName.IsEmpty()) ) {
      cout << "Incoming H.323 call from " << caller << " has not selected a room." << endl;
      cout << "No default room specified." << endl;
#ifdef LOGGING
      LogCall(*this, FALSE);
#endif
      aborted = TRUE;
      return AnswerCallDenied;
    }

    if ((roomID.IsEmpty()) && (!defaultRoomName.IsEmpty()) ) {
      cout << "Incoming H.323 call from " << caller << " has not selected a room." << endl;
      cout << "Using room " << defaultRoomName << " as the default." << endl;
      roomID = defaultRoomName;
    }
  }
  
  PString product = "Unknown";

  const H225_Setup_UUIE & setup = setupPDU.m_h323_uu_pdu.m_h323_message_body;
  const H225_EndpointType & epInfo = setup.m_sourceInfo;

  if (epInfo.HasOptionalField(H225_EndpointType::e_vendor)) {
    const H225_VendorIdentifier & vendorInfo = epInfo.m_vendor;
    if (vendorInfo.HasOptionalField(H225_VendorIdentifier::e_productId))
      product = vendorInfo.m_productId.AsString();
    if (vendorInfo.HasOptionalField(H225_VendorIdentifier::e_versionId))
      product = product + "/" + vendorInfo.m_versionId.AsString();
  }
  
  cout << "Accepting call from " << caller << " using " << product << " with room id " << roomID << endl;

  connected = TRUE;
  ep.AddMember(this);

  return AnswerCallNow;
}

BOOL
MyH323Connection::OnSendSignalSetup( H323SignalPDU & callProceedingPDU )
{
  // We are making a connection to a remote EP so add this connection to
  // the list of rooms and members.
  // We will add them to the default room as we have no method of
  // specifying which room our connection should join.
  connected = TRUE;
  roomID = ep.GetDefaultRoomName();
  cout << "Adding connection to room " << roomID << endl;
  ep.AddMember(this);
  return H323Connection::OnSendSignalSetup( callProceedingPDU );
}

BOOL MyH323Connection::OpenAudioChannel(BOOL isEncoding, unsigned /* bufferSize */, H323AudioCodec & codec)
{
  PStringStream codecName;
  codecName << codec;

  codec.SetSilenceDetectionMode( H323AudioCodec::NoSilenceDetection );

//  if (!codec.IsDescendant(H323_GSM0610Codec::Class()) &&
//      - need to add MS-GSM here along with any other codecs
//      !codec.IsDescendant(H323_muLawCodec::Class())) {
//    cerr << "Unknown codec \"" << codecName << endl;
//    return FALSE;
//  }

  PWaitAndSignal mutex(audioMutex);
  if (incomingAudio == NULL) {
    incomingAudio = new IncomingAudio(ep, *this);
  }

  if (outgoingAudio == NULL) {
    outgoingAudio = new OutgoingAudio(ep, *this);
  }

  if (isEncoding) {
    audioTransmitCodecName = codecName;
    codec.AttachChannel(outgoingAudio, FALSE);
  } else {
    audioReceiveCodecName = codecName;
    codec.AttachChannel(incomingAudio, FALSE);
  }

  return TRUE;
}

#ifndef NO_VIDEO
BOOL MyH323Connection::OpenVideoChannel(BOOL isEncoding,
                                        H323VideoCodec & codec)
{
    PStringStream codecName;
    codecName << codec;

    PWaitAndSignal mutex(videoMutex);

     if (isEncoding) {      
      if (outgoingVideo == NULL) {
        outgoingVideo = new OutgoingVideo(ep, *this, ep.videoFramesPS, ep.videoLarge);
        codec.AttachChannel(outgoingVideo,FALSE);
//       outgoingVideo->SetFrameSize(352>>1,288>>1);
      }

      /*At last. Modularity. The video codec is told the parameters of video compresion/decompression.
        The only thing the video codec knows about the ouside world is how to acquire/render data, which
	      is via the video channel, provided by the OutgoingVideo class.
	      
	      The codec does provide a second interface, through which ethernet packets enter (or leave) */
      codec.SetTxQualityLevel(ep.videoTxQuality);
      codec.SetBackgroundFill(ep.videoFill);
     
      videoTransmitCodecName = codecName;
    } else {
      if (incomingVideo == NULL) 
        incomingVideo = new IncomingVideo(ep, *this);
        codec.AttachChannel(incomingVideo,FALSE);
        videoReceiveCodecName = codecName;
    }
  
    return TRUE;
}
#endif

BOOL MyH323Connection::OnStartLogicalChannel(H323Channel & channel)
{
  if (!H323Connection::OnStartLogicalChannel(channel))
    return FALSE;

  cout << "Started logical channel: ";

  switch (channel.GetDirection()) {
    case H323Channel::IsTransmitter :
      cout << "sending ";
      break;

    case H323Channel::IsReceiver :
      cout << "receiving ";
      break;

    default :
      break;
  }

  cout << channel.GetCapability() << endl;

  return TRUE;
}

BOOL MyH323Connection::OnOutgoingAudio(void * buffer, PINDEX amount)
{
  return ep.ReadAudio(GetCallToken(), buffer, amount, roomID);  
}

BOOL MyH323Connection::OnIncomingAudio(const void * buffer, PINDEX amount)
{
  return ep.WriteAudio(GetCallToken(), buffer, amount, roomID);
}

#ifndef NO_VIDEO
BOOL MyH323Connection::OnOutgoingVideo(void * buffer, PINDEX & amount)
{
  return ep.ReadVideo(GetCallToken(), buffer, amount, roomID);
} 

BOOL MyH323Connection::OnIncomingVideo(const void * buffer, PINDEX amount)
{
  return ep.WriteVideo(GetCallToken(), buffer, amount, roomID);
}
#endif

void MyH323Connection::AddMember(const PString & token)
{
   audioMutex.Wait();

   cout << "Adding audio buffer for " << token 
        << " to connection " << GetCallToken() << endl;

   // Create a new audio buffer to hold audio between the connection
   // called 'token' and this connection.
   audioBuffers.SetAt(token, new AudioBuffer);
   
   audioMutex.Signal();
}


void MyH323Connection::RemoveMember(const PString & token)
{
  PWaitAndSignal mutex(audioMutex);

  cout << "Removing audio buffer for " << token 
       << " from connection " << GetCallToken() << endl;

  audioBuffers.RemoveAt(token);  
}


BOOL MyH323Connection::WriteAudio(const PString & token, const void * buffer, PINDEX amount)
{
  PWaitAndSignal mutex(audioMutex);
  AudioBuffer * audioBuffer = audioBuffers.GetAt(token);
  if (audioBuffer != NULL)
    audioBuffer->Write((BYTE *)buffer, amount);
  return TRUE;
}

BOOL MyH323Connection::ReadAudio(const PString & /*token*/, void * buffer, PINDEX amount)
{  
  PWaitAndSignal mutex(audioMutex);
  
  // First, set the buffer to empty.
  memset(buffer, 0, amount);

  // get number of channels to mix
  PINDEX numChannels = audioBuffers.GetSize();

  if (numChannels== 0) 
    return TRUE;

  // scan through the audio buffers and mix the signals
  PINDEX i;
  for (i = 0; i < numChannels; i++) {
    PString key = audioBuffers.GetKeyAt(i);
    audioBuffers[key].ReadAndMix((BYTE *)buffer, amount, numChannels);
  }

  return TRUE;
}

///////////////////////////////////////////////////////////////

OutgoingAudio::OutgoingAudio(MyH323EndPoint & _ep, MyH323Connection & _conn)
  : ep(_ep), conn(_conn)
{
  os_handle = 0;
}

void OutgoingAudio::CreateSilence(void * buffer, PINDEX amount)
{
  memset(buffer, 0, amount);
  lastReadCount = amount;
}

BOOL OutgoingAudio::Read(void * buffer, PINDEX amount)
{
  PWaitAndSignal mutexR(audioChanMutex);
  
  if (!IsOpen())
    return FALSE;

  if (!delay.Delay(amount / 16)) {

    // do the read call here, by calling conn.OnOutgoingAudio():
    BOOL doSilence = !conn.OnOutgoingAudio(buffer, amount);

    if (doSilence)
      CreateSilence(buffer, amount);
  }

  lastReadCount = amount;

  return TRUE;
}

BOOL OutgoingAudio::Close()
{
	if (!IsOpen()) 
		return FALSE;

	PWaitAndSignal mutexC(audioChanMutex);
	os_handle = -1;
  return TRUE;
}

///////////////////////////////////////////////////////////////////////////

IncomingAudio::IncomingAudio(MyH323EndPoint & _ep, MyH323Connection & _conn)
  : ep(_ep), conn(_conn)
{
  os_handle = 0;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产久卡久卡久卡久卡视频精品| 一区二区三区四区不卡视频| 蜜臀av性久久久久蜜臀aⅴ流畅| 91久久免费观看| 亚洲一区二区三区四区在线| 在线视频你懂得一区| 亚洲一区影音先锋| 欧美精品色综合| 午夜国产不卡在线观看视频| 91精品国产综合久久精品app| 免费久久99精品国产| 久久综合久久鬼色中文字| 国产suv精品一区二区三区| 中文字幕精品在线不卡| 97成人超碰视| 天天做天天摸天天爽国产一区| 日韩免费看的电影| 成人免费观看男女羞羞视频| 亚洲精品视频自拍| 在线国产电影不卡| 极品少妇xxxx精品少妇偷拍| 国产精品乱人伦中文| 欧美日韩黄视频| 久久不见久久见免费视频7| 欧美国产精品v| 欧美日韩在线一区二区| 国内外精品视频| 综合av第一页| 欧美一区二区三区在线| 成人毛片老司机大片| 午夜精品在线看| 欧美国产欧美综合| 欧美午夜一区二区| 国产伦精品一区二区三区视频青涩 | 久久成人免费网站| 亚洲欧洲99久久| 日韩精品中文字幕在线一区| 91小视频在线观看| 狠狠久久亚洲欧美| 亚洲与欧洲av电影| 国产亚洲精久久久久久| 7777女厕盗摄久久久| 成人av网址在线观看| 美女网站一区二区| 一区二区三区在线视频播放| 久久色中文字幕| 欧美精品一卡两卡| 91丝袜高跟美女视频| 国产精品综合久久| 日本成人在线看| 亚洲乱码国产乱码精品精小说| 26uuu另类欧美亚洲曰本| 欧美午夜精品一区二区蜜桃| 成人爱爱电影网址| 国产一区中文字幕| 日韩av电影天堂| 亚洲已满18点击进入久久| 亚洲777理论| 国产精品视频看| 久久久久久**毛片大全| 91精品久久久久久久91蜜桃| 色婷婷av一区| 99国产精品久久| 99视频在线观看一区三区| 国产精华液一区二区三区| 久久精品国产亚洲5555| 日韩电影在线观看电影| 午夜国产精品影院在线观看| 一区二区三区在线观看网站| 亚洲欧美韩国综合色| 中文字幕一区二区三区在线播放| 国产欧美一区二区精品性色| 久久蜜桃av一区精品变态类天堂| 日韩精品一区二区三区视频在线观看| 欧美日韩一区不卡| 欧美日韩国产高清一区二区 | 成人开心网精品视频| 国产精品一区在线观看乱码| 久久99九九99精品| 日本不卡中文字幕| 麻豆免费精品视频| 蜜桃视频一区二区三区在线观看| 日韩av在线播放中文字幕| 日韩在线a电影| 麻豆精品视频在线观看视频| 日本aⅴ精品一区二区三区| 日韩av中文在线观看| 麻豆精品视频在线| 精品一区二区影视| 国产精品亚洲第一| 成人国产免费视频| av在线不卡电影| 色成人在线视频| 欧美日韩精品高清| 日韩欧美精品三级| 国产欧美一区二区精品秋霞影院| 欧美国产国产综合| 亚洲毛片av在线| 五月婷婷激情综合| 欧美三级欧美一级| 欧美高清激情brazzers| 精品捆绑美女sm三区| 久久久国产精品麻豆| 国产精品乱人伦中文| 亚洲图片欧美色图| 久久se精品一区二区| 国产成人8x视频一区二区 | 91亚洲国产成人精品一区二三| 色婷婷久久99综合精品jk白丝 | 伊人夜夜躁av伊人久久| 三级不卡在线观看| 国产成人综合在线播放| 色欧美片视频在线观看在线视频| 51精品视频一区二区三区| 国产亚洲一区二区在线观看| 亚洲视频 欧洲视频| 免费高清在线一区| 成人激情视频网站| 91精品国产免费久久综合| 国产蜜臀av在线一区二区三区| 亚洲乱码国产乱码精品精98午夜| 青草av.久久免费一区| 国产91色综合久久免费分享| 欧美色倩网站大全免费| 久久久精品欧美丰满| 亚洲成人av免费| 成人一二三区视频| 欧美一区二区高清| 亚洲精品久久久蜜桃| 国产一区二区视频在线播放| 欧美性猛交xxxx乱大交退制版| 久久久天堂av| 爽好久久久欧美精品| 99久久久久久99| 精品国产一区二区三区不卡 | 91麻豆.com| 亚洲国产中文字幕在线视频综合| 国产一区999| 欧美巨大另类极品videosbest | 亚洲大片在线观看| 成人久久视频在线观看| 日韩欧美在线网站| 亚洲伊人色欲综合网| 成人网在线免费视频| 日韩欧美123| 日韩电影免费一区| 在线视频一区二区免费| 国产精品久久久久久户外露出 | 国产一区二区女| 欧美一区二区三区四区高清| 艳妇臀荡乳欲伦亚洲一区| 成人国产精品视频| 国产无遮挡一区二区三区毛片日本| 青草国产精品久久久久久| 欧美日本在线一区| 亚洲丰满少妇videoshd| 91日韩精品一区| 国产精品久久福利| 丁香亚洲综合激情啪啪综合| 精品国产电影一区二区| 美女精品一区二区| 69av一区二区三区| 图片区小说区国产精品视频| 欧美视频一区在线| 亚洲国产视频a| 欧美日韩国产另类一区| 亚洲精品国产一区二区三区四区在线| 91在线精品秘密一区二区| 国产精品美女久久福利网站| 成人性生交大片免费看视频在线 | 六月丁香婷婷久久| 欧美一级欧美三级| 麻豆国产精品777777在线| 欧美电视剧在线看免费| 久久99精品国产.久久久久久| 日韩欧美国产精品一区| 精品一区二区三区免费视频| 精品国产一区二区三区不卡| 国内欧美视频一区二区| 国产欧美一二三区| 99视频在线精品| 一区二区三区四区在线播放 | 狠狠色狠狠色综合日日91app| 久久综合丝袜日本网| 国产99一区视频免费| 亚洲欧洲日产国产综合网| 91黄色免费观看| 午夜久久福利影院| 精品国产第一区二区三区观看体验| 国产一区免费电影| 国产精品家庭影院| 欧美日韩亚洲高清一区二区| 日韩高清不卡一区二区三区| 久久午夜老司机| 99在线精品观看| 水野朝阳av一区二区三区| 久久综合视频网| 日本高清无吗v一区| 午夜精品久久久久久久| www国产成人|