CCiMulticastSocket::~CCiMulticastSocket() { if( m_iSendSocket != NU_INVALID_SOCKET ) { StopSending(); m_iSendSocket = NU_INVALID_SOCKET; } if( m_iReceiveSocket != NU_INVALID_SOCKET ) { StopReceiving(); m_iReceiveSocket = NU_INVALID_SOCKET; } }
/*************************************** * End * Termina la conferencia activa ***************************************/ int AudioStream::End() { //Terminamos de enviar StopSending(); //Y de recivir StopReceiving(); // add for rtsp watcher by liuhong start m_Participant = NULL; //if(audioSubsession != NULL) // audioSubsession->End(); // add for rtsp watcher by liuhong end //Cerramos la session de rtp rtp.End(); return 1; }
/*************************************** * End * Termina la conferencia activa ***************************************/ int VideoStream::End() { Log(">End\n"); //Terminamos la recepcion if (sendingVideo) StopSending(); //Y el envio if(receivingVideo) StopReceiving(); //Close smoother smoother.End(); //Cerramos la session de rtp rtp.End(); Log("<End\n"); return 1; }
/*************************************** * StartSending * Comienza a mandar a la ip y puertos especificados ***************************************/ int AudioStream::StartSending(char *sendAudioIp,int sendAudioPort,AudioCodec::RTPMap& rtpMap) { Log(">StartSending audio [%s,%d]\n",sendAudioIp,sendAudioPort); //Si estabamos mandando tenemos que parar if (sendingAudio) //paramos StopSending(); //Si tenemos audio if (sendAudioPort==0) //Error return Error("Audio port 0\n"); //Y la de audio if(!rtp.SetRemotePort(sendAudioIp,sendAudioPort)) //Error return Error("Error en el SetRemotePort\n"); //Set sending map rtp.SetSendingAudioRTPMap(rtpMap); //Set audio codec if(!rtp.SetSendingAudioCodec(audioCodec)) //Error return Error("%s audio codec not supported by peer\n",AudioCodec::GetNameFor(audioCodec)); //Arrancamos el thread de envio sendingAudio=1; //Start thread createPriorityThread(&sendAudioThread,startSendingAudio,this,1); Log("<StartSending audio [%d]\n",sendingAudio); return 1; }
/*************************************** * StartSending * Comienza a mandar a la ip y puertos especificados ***************************************/ int VideoStream::StartSending(char *sendVideoIp,int sendVideoPort,const RTPMap& rtpMap,const RTPMap& aptMap) { Log(">StartSendingVideo [%s,%d]\n",sendVideoIp,sendVideoPort); //Si estabamos mandando tenemos que parar if (sendingVideo) //Y esperamos que salga StopSending(); //Si tenemos video if (sendVideoPort==0) return Error("No video\n"); //Iniciamos las sesiones rtp de envio if(!rtp.SetRemotePort(sendVideoIp,sendVideoPort)) return Error("Error abriendo puerto rtp\n"); //Set sending map rtp.SetSendingRTPMap(rtpMap,aptMap); //Set video codec if(!rtp.SetSendingCodec(videoCodec)) //Error return Error("%s video codec not supported by peer\n",VideoCodec::GetNameFor(videoCodec)); //Estamos mandando sendingVideo=1; //Arrancamos los procesos createPriorityThread(&sendVideoThread,startSendingVideo,this,0); //LOgeamos Log("<StartSending video [%d]\n",sendingVideo); return 1; }