private void OnJitterBufferServerDataAvailable(Object sender, WinSound.RTPPacket rtp)
        {
            try
            {
                if (IsServerRunning)
                {
                    if (m_IsFormMain)
                    {
                        //RTP Packet in Bytes umwandeln
                        Byte[] rtpBytes = rtp.ToBytes();

                        //Für alle Clients
                        List <NF.ServerThread> list = new List <NF.ServerThread>(m_Server.Clients);
                        foreach (NF.ServerThread client in list)
                        {
                            //Wenn nicht Mute
                            if (client.IsMute == false)
                            {
                                try
                                {
                                    //Absenden
                                    client.Send(m_PrototolClient.ToBytes(rtpBytes));
                                }
                                catch (Exception)
                                {
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
        }
Example #2
0
 /// <summary>
 /// ToRTPData
 /// </summary>
 /// <param name="linearData"></param>
 /// <param name="bitsPerSample"></param>
 /// <param name="channels"></param>
 /// <returns></returns>
 private Byte[] ToRTPData(Byte[] data, int bitsPerSample, int channels)
 {
     //Neues RTP Packet erstellen
     WinSound.RTPPacket rtp = ToRTPPacket(data, bitsPerSample, channels);
     //RTPHeader in Bytes erstellen
     Byte[] rtpBytes = rtp.ToBytes();
     //Fertig
     return(rtpBytes);
 }
Example #3
0
        /// <summary>
        /// OnTimerStream
        /// </summary>
        /// <param name="lpParameter"></param>
        /// <param name="TimerOrWaitFired"></param>
        private void OnTimerStream()
        {
            try
            {
                //Wenn noch aktiv
                if (m_IsTimerStreamRunning)
                {
                    if ((m_CurrentRTPBufferPos + m_RTPPartsLength) <= m_FilePayloadBuffer.Length)
                    {
                        //Bytes senden
                        Array.Copy(m_FilePayloadBuffer, m_CurrentRTPBufferPos, m_PartByte, 0, m_RTPPartsLength);
                        m_CurrentRTPBufferPos += m_RTPPartsLength;
                        WinSound.RTPPacket rtp = ToRTPPacket(m_PartByte, m_FileHeader.BitsPerSample, m_FileHeader.Channels);
                        _send(_room, rtp.ToBytes());
                    }
                    else
                    {
                        //Rest-Bytes senden
                        int    rest      = m_FilePayloadBuffer.Length - m_CurrentRTPBufferPos;
                        Byte[] restBytes = new Byte[m_PartByte.Length];
                        Array.Copy(m_FilePayloadBuffer, m_CurrentRTPBufferPos, restBytes, 0, rest);
                        WinSound.RTPPacket rtp = ToRTPPacket(restBytes, m_FileHeader.BitsPerSample, m_FileHeader.Channels);
                        _send(_room, rtp.ToBytes());

                        if (m_Loop == false)
                        {
                            //QueueTimer beenden
                            StopTimerStream();
                        }
                        else
                        {
                            //Von vorne beginnen
                            m_CurrentRTPBufferPos = 0;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                StopTimerStream();
            }
        }
Example #4
0
 /// <summary>
 /// OnDataAvailable
 /// </summary>
 /// <param name="packet"></param>
 private void OnDataAvailable(Object sender, WinSound.RTPPacket rtp)
 {
     try
     {
         if (_send != null)
         {
             if (m_IsFormMain)
             {
                 //RTP Packet in Bytes umwandeln
                 Byte[] rtpBytes = rtp.ToBytes();
                 //Absenden
                 _send(_room, rtpBytes);
             }
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
Example #5
0
 /// <summary>
 /// OnJitterBufferDataAvailable
 /// </summary>
 /// <param name="rtp"></param>
 private void OnJitterBufferDataAvailable(Object sender, WinSound.RTPPacket rtp)
 {
     try
     {
         if (IsServerRunning)
         {
             if (m_IsFormMain)
             {
                 //RTP Packet in Bytes umwandeln
                 Byte[] rtpBytes = rtp.ToBytes();
                 //Absenden
                 m_Server.Send(m_PrototolClient.ToBytes(rtpBytes));
             }
         }
     }
     catch (Exception ex)
     {
         ShowError(ex.Message);
     }
 }
 private void OnJitterBufferClientDataAvailableRecording(Object sender, WinSound.RTPPacket rtp)
 {
     try
     {
         //Prüfen
         if (rtp != null && m_Client != null && rtp.Data != null && rtp.Data.Length > 0)
         {
             if (IsClientConnected)
             {
                 if (m_IsFormMain)
                 {
                     //RTP Packet in Bytes umwandeln
                     Byte[] rtpBytes = rtp.ToBytes();
                     //Absenden
                     m_Client.Send(m_PrototolClient.ToBytes(rtpBytes));
                 }
             }
         }
     }
     catch (Exception)
     {
         System.Diagnostics.StackFrame sf = new System.Diagnostics.StackFrame(true);
     }
 }