H323MCU Functionality

download H323MCU Functionality

of 30

Transcript of H323MCU Functionality

  • 8/8/2019 H323MCU Functionality

    1/30

    H323 MCU Functionality

  • 8/8/2019 H323MCU Functionality

    2/30

    Overv iew:

    Current version CDE allows single H323 End Point to join theaudio/video conference using H323CDEAdapter Release 1.7.4.The

    new version of CDE will allow creation/termination of an audio/videoconference room in which multiple H323 End Points are able to joinusing H323CDEAdapter. In both the cases H323CDEAdapter will beconsidered as a single logical Web Client by the CDE MCU.

  • 8/8/2019 H323MCU Functionality

    3/30

    Oper ational Conc ep ts and Sc e na r ios :

    The AV Cli e nt is re s p onsibl e fo r h andling audio and vid e o fo r a we bcli e nt. Communication b e twee n CDEMCU and H323CDEAda p ter is bas e d on a pr otocol pr o v id e d by NECS T. The p u rp os e of t h ispr otocol is to manag e communication b e twee n CDEMCU andH323CDEAda p ter . CDEMCU w ill s e nd multi p le audio buff er s in asingl e st re am; H323CDEAda p ter w ill d e te ct t he s pe ak er amongthe we b cli e nts. H323CDEAda p ter w ill also d e te ct t he s pe ak er among t he H323 End Points

    The v id e o dis p lay w ill d epe nd u p on t he ty pe of t he vid e o mod e . There

    a re basically t w o v id e o mod e s :a) Mix e d Vid e o Mod eb) Singl e Vid e o Mod e

  • 8/8/2019 H323MCU Functionality

    4/30

    a) Mixed Video ModeIn the mixed video mode the video display will be as :H323CDEAdapter will display quadrant image at the H323 End Point side. .

    F irstQuadrant

    SecondQuadrant

    ThirdQuadrant

    F ourthQuadrant

    y The image of the Web Client speaker will always be shown in the first quadrant.y The image of the speaker among the H323 End Points will be shown at thesecond quadrant.y The image of any two H323 end points other than the speaker will be switchedbetween third and fourth quadrants.y If H323 End Point, who was speaker and whose image was being displayed inthe second quadrant logs out, then any of the H323 End Point image will bedisplayed in the second quadrant.y In case there is no Web client present in the conference, the first quadrant willdisplay gray screen.y Same 4 quadrant image will be sent to CDE MCU server.

  • 8/8/2019 H323MCU Functionality

    5/30

    b) Singl e v id e o mod e

    Display the video of the speaker among the H323 EP atthe WC side.

    Display the video of the speaker among all the participants

    at the H323 EP side.If the H323 EP is itself the speaker among all theparticipants then display the video of the previous speaker among all the participants at that H323 EP.

  • 8/8/2019 H323MCU Functionality

    6/30

    The audio of the H323 End points will be sent to all other

    H323 End points except himself.H323CDEAdapter will mix the audio from the CDEMCU

    with the audio from all the H323 End Points and will send itback to CDE MCU.

    H323CDEAdapter will send the mixed audio of CDE MCUand the audio of all the H323 End Points except itself toeach H323 End Point.

  • 8/8/2019 H323MCU Functionality

    7/30

    F ollowing diagram describes the functional blocks for H323CDEAdapter andits interaction with CDEMCU:

    H323CDEAdapter

    CDEMCU

    Audio(Send/Receive)Video(Send/Receive)

    H323 MCU

    AV Client AV Client

    AV Client

    ProtocolEntities

    1

    2 3 4

    H323endpointH323endpoint

    H323endpoint

  • 8/8/2019 H323MCU Functionality

    8/30

    In the implementation each of the H323 EP will have a audio buffer dictionary in which itwill have audio buffer for each of the H323 EP except himself and an audio buffer for the

    CDE audio. We will also have a audio buffer dictionary for CDE MCU which will haveaudio buffer for every H323 EP.

    EP2EP3 EP4 EP5 EP6 CDE

    EP2 EP1EP3 EP4 EP5 EP6 CDE

    CDEMCUEP1

    EP2 EP3 EP4 EP5 EP6

    EP1

  • 8/8/2019 H323MCU Functionality

    9/30

    Im p le m e ntation

    The classes that incorporate changes for the implementation of this requirement are:

    H323CAConf ere nc e Manag er .c pp

    H323CAConn e ction.c ppH323CACDEConn e ction.c ppH323CAVid e oBuff er .c pp

  • 8/8/2019 H323MCU Functionality

    10/30

    H323Connection* H323CAConferenceManager::CreateConnection (unsigned callRefValue){

    //To check whether the no. of H323 EP logged in is less than six or not. If yes then// create a new connection for this H323 EPif( GetNoOfH323EP() < MAX_H323_EP ){

    iNoOfH323Login++;ssrc = dwH323SSRC & 0xff00ffff; // To generate the SSRC for thessrc |= DWORD(iNoOfH323Login

  • 8/8/2019 H323MCU Functionality

    11/30

    B OOL H323CAConferenceManager::WriteH323Audio (const void* buffer , PINDEXamount,const PString & thisToken,PString roomID, DWORD ssrc)

    {if ( DetectAudioLevel(buffer,amount) ) //If the audio packets coming are above audio

    // level{

    Check the SSRC for H323 EP speaker and Overall speaker if(CheckH323EPSpeaker(ssrc));if(CheckOverallSpeaker(ssrc));//Write the audio packet in the audio buffer of every connection(H323EP) except//this connection//Write the audio packet in the audio buffer in the audio buffer dictionary for CDE

    }}

  • 8/8/2019 H323MCU Functionality

    12/30

    B OOL H323CAConferenceManager::ReadH323Audio (const void* buffer , PINDEXamount,const PString & hisToken,PString roomID)

    {// Read the CDE audio and write in the audio buffer for CDE in every// connection(H323EP)

    // Call the ReadH323Audio method for this connection to read the mixed//audioconn->ReadH323Audio(thisToken, buffer, amount);

    }

  • 8/8/2019 H323MCU Functionality

    13/30

    B OOL H323CAConferenceManager::ReadCDEAudio (const void* buffer ,PINDEX amount)

    {//scan through the audio buffers in the audio buffer dictionary for CDE//and mix the signalsPINDEX i;for (i = 0; i < H323Audio B uffers.GetSize(); i++){

    PString key = H323Audio B uffers.GetKeyAt(i);H323Audio B uffers[key].ReadAndMix(( BY TE *)buffer, amount,

    H323Audio B uffers.GetSize());}

    }

  • 8/8/2019 H323MCU Functionality

    14/30

    B OOL H323CAConferenceManager::WriteCDEVideo ( const void * buffer,PINDEX amount, B OOL)

    {// If mixed video mode then write the video buffer in the CDE video//buffer oCDEVideo B uffer.Write(( BY TE *)buffer, amount);

    // If the video mode is set single then set the OverallSpeakerSSRC//and OverallPreviousSpeakerSSRC according to the video display//rules and write the video buffer in the corresponding buffer // i.e. in oOverallSpeakerVideo B uffer or in//OverallPrevSpeakerVideo B uffer

    }

  • 8/8/2019 H323MCU Functionality

    15/30

    void H323CAConferenceManager::UpdateUserList(DWORD SSRC, PString userName, PStringuserType , B OOL type)

    {if ( type ) // If user logs in{

    // If it is the first participant in the conference then set the//dOverallSpeakerSSRC and// dOverallPrevSpeakerSSRC as zero for proper video display.// Add the audio count object for the user in the overall audio count list as well.

    }else // user logs out{

    // remove the audio count object for the user from the overall audio count list// check if the user that logs out is Overall speaker and if yes then set the//dOverallSpeakerSSRC=0// check if the user that logs out is Overall Previous speaker and if yes then set// dOverallPrevSpeakerSSRC=0

    }}

  • 8/8/2019 H323MCU Functionality

    16/30

    int H323CAConferenceManager::AdapterLoginRequest(PString CallerName){

    // Check for pCDEConnection ptr and perform login functions only if it

    I //s Null}

  • 8/8/2019 H323MCU Functionality

    17/30

    void H323CAConferenceManager::AdapterLogoutRequest(){

    //Clear H323 EP list//Clear the H323 Audio count list and also the overall audio count list.// Clear the overall speaker video buffer and overall Previous Speaker // video buffer // Set the dOverallSpeakerSSRC and dOverallPrevSpeakerSSRC to zero.

    }

    void H323CAConferenceManager::SendReleaseComplete(){

    //Clear H323 EP list//Clear the H323 Audio count list and also the overall audio count list.

    }

  • 8/8/2019 H323MCU Functionality

    18/30

    void H323CAConferenceManager::AddH323Member(H323CAConnection * newMember, DWORD ssrc){

    // If this is the first entry in the room then create the room and video buffer and video position list// Add this H323 EP to the H323 EP list and add the audio count object for this end point in// H323AudioCountList and OverallAudioCountList.// Add the new member to every other H323 member // and every other H323 member to the new H323 member for (PINDEX i = 0; i < H323EPList.GetSize(); i++){

    PString token = H323EPList[i];if (token != newToken){ H323CAConnection * conn = (H323CAConnection *)

    F indConnectionWithLock(token);if (conn != NULL){ conn->AddH323Member(newToken);newMember->AddH323Member(token);

    conn->Unlock();}

    }}newMember->AddH323Member(CDEToken);// Add this H323 EP to the CDE

    }

  • 8/8/2019 H323MCU Functionality

    19/30

    void H323CAConferenceManager::RemoveH323Member(H323CAConnection *

    oldConn, DWORD ssrc){

    //Clear the corner of the video window that the connection just vacated.// Remove the member from the other members// Remove the member from the CDE//Remove the audio count for this H323 EP from OverallAudioCountList

    //and H323AudioCountList// Check if the H323 EP that logs out is Overall Previous speaker and if yes// then set the// dOverallPrevSpeakerSSRC=0// Remove the room if it becomes empty and call adapter logout request

    }

  • 8/8/2019 H323MCU Functionality

    20/30

    PINDEX H323CAConferenceManager:: F indTokensVideoPosn(const PString &thisToken, PString roomID)

    {

    // To return the video Position of the H323 EP}

    B OOL H323CAConferenceManager::CheckH323EPSpeaker(DWORD SSRC){

    // To check the H323 Audio Packet for the speaker detection among the//H323 EP}

    B OOL H323CAConferenceManager::CheckOverallSpeaker(DWORD SSRC){

    // to check the Audio Packet of either H323 EP or WC for the speaker //detection among the participants

    }

  • 8/8/2019 H323MCU Functionality

    21/30

    B OOL H323CAConferenceManager::WriteVideo(const PString & thisToken,const void * buffer, PINDEX amount, PString roomID, DWORD ssrc)

    {// This is called when video mode is set as mixed// get the video position of the H323 EP in the quadrant display// Check for H323 Speaker SSRC and set its value in accordance with

    //video display scenario and// write the video buffer in the corresponding video buffer

    }

  • 8/8/2019 H323MCU Functionality

    22/30

    B OOL H323CAConferenceManager::ReadVideo(const void * buffer, PINDEXamount, PString roomID )

    {// read the CDE videooCDEVideo B uffer.Read(( BY TE*)buffer, amount);// Write in the video buffer for the H323 EP at position 0 i.e. in the first//quadrantvideo B uffer.Write(( BY TE *)buffer, amount, 0);

    // Read the complete video buffer video B uffer.Read(( BY TE *)buffer,amount);// Write the same video buffer in the H323Video B uffer to be send to CDE//MCUoH323Video B uffer.Write(( BY TE *)buffer , amount);

    }

  • 8/8/2019 H323MCU Functionality

    23/30

    B OOL H323CAConferenceManager::WriteVideoSingleMode ( const PString &thisToken, const void * buffer, PINDEX amount ,PString roomID,

    DWORD ssrc ){

    //Check for H323 EP speaker and if 0 set the value to this SSRC

    // Now Check the value of H323 EP speaker and if equals this SSRC//then write the video in H323Video B uffer // Check the value of OverallSpeakerSSRC and//OverallPrevSpeakerSSRC and set their values in accordance with the//video display scenario and write the video in corres. Video buffer

    }

  • 8/8/2019 H323MCU Functionality

    24/30

    B OOL H323CAConferenceManager::ReadVideoSingleMode( const PString &thisToken, const void * buffer, PINDEX amount, PString roomID ,DWORD ssrc){

    // read OverAllSpeaker video if the SSRC is not of the H323EP Speaker if( ssrc != GetOverallSpeakerSSRC() ){

    oOverallSpeakerVideo B uffer.Read(( BY TE*)buffer, amount);}else // read the OverallPreviousSpeaker video{

    oOverallPrevSpeakerVideo B uffer.Read(( BY TE *)buffer , amount);}

    }

  • 8/8/2019 H323MCU Functionality

    25/30

    void H323CAConnection::CleanUpOnCallEnd(){

    // close all the audio video channels for incoming and outgoing audio///video transmission

    // Remove the member from the listrefCAConfManager.RemoveH323Member(this,SSRC);

    }

    H323Connection::AnswerCallResponse H323CAConnection::OnAnswerCall(constPString & caller, const H323SignalPDU & setupPDU, H323SignalPDU & )

    {..// Add the member in the listrefCAConfManager.AddH323Member(this,SSRC);

    }

  • 8/8/2019 H323MCU Functionality

    26/30

    void H323CAConnection::OnIncomingVideo(const void * buffer, PINDEX amount){

    // If video mode is mixed video mode then call corresponding functionrefCAConfManager.WriteVideo(GetCallToken(), buffer, amount, roomID,

    SSRC);//if video mode is single video mode then callrefCAConfManager.WriteVideoSingleMode(GetCallToken(), buffer,

    amount, roomID, SSRC);}

    void H323CAConnection::OnOutgoingVideo(const void * buffer, PINDEX amount){

    // If video mode is mixed video mode then call corresponding functionrefCAConfManager.ReadVideo(buffer, amount, roomID);

    //if video mode is single video mode then callrefCAConfManager.ReadVideoSingleMode(GetCallToken(), buffer,

    amount, roomID, SSRC);}

  • 8/8/2019 H323MCU Functionality

    27/30

    void H323CAConnection::AddH323Member(const PString & token){

    // Add the audio buffer for the specified token in this connectionaudio B uffer.SetAt(token, new H323CAAudio B uffer);

    }

    void H323CAConnection::RemoveH323Member(const PString & token){

    // Remove the audio buffer for the specified token from this connectionaudio B uffer.RemoveAt(token);

    }

  • 8/8/2019 H323MCU Functionality

    28/30

    B OOL H323CAConnection::WriteH323Audio(const PString & token, const void * buffer,PINDEX amount)

    { // Get the audio buffer for the specified token in this connectionH323CAAudio B uffer *audio B uff = audio B uffer.GetAt(token);// and write the audio in that audio buffer

    audio B uff->Write(( BY TE *)buffer, amount);}

    B OOL H323CAConnection::ReadH323Audio(const PString & /*token*/, const void *buffer, PINDEX amount)

    {// scan through the audio buffers and mix the signalsPINDEX i;for (i = 0; i < numChannels; i++)

    { PString key = audio B uffer.GetKeyAt(i);audio B uffer[key].ReadAndMix(( BY TE *)buffer, amount,

    numChannels);}

    }

  • 8/8/2019 H323MCU Functionality

    29/30

    void H323CACDEConnection::AudioVideoTimer(PTimer& , INT){

    //Start Read Audio timer by giving the notifier function and delay timetimerReadAudio.SetNotifier(PCREATE_NOTI F IER(OnReadAudioTime));timerReadAudio.RunContinuous(READ_AUDIO_TIMEOUT);

    }

    void H323CACDEConnection::OnWriteAudioTime F orH323(){

    -------------// Check for overall speaker also-------------

    }

    void H323CACDEConnection::OnReadAudioTime(PTimer &, INT){

    // Call this function at regular intervals to read audio for CDEReadAudio F orCDE();

    }

  • 8/8/2019 H323MCU Functionality

    30/30

    void H323CAVideo B uffer::Clear(PINDEX posn){

    // Clear the video buffer at the specified position for mixed video//mode

    }

    void H323CAVideo B uffer::Write( BY TE * data, PINDEX amount,PINDEX posn)

    {// Write the video buffer at the specified position for mixed video//mode

    }