Exemple #1
0
        private void recibirPaquetes_ServidorUdp(UdpPacket_eArgs e)
        {
            try
            {
                // Decompress data.
                byte[] decodedData = null;
                decodedData = G711.Decode_uLaw(e.Data, 0, e.Data.Length);

                // We just play received packet.
                waveOut.Play(decodedData, 0, decodedData.Length);
            }
            catch (Exception ex)
            {
                /*logger.WriteToEventLog("ERROR : " + ex.Message +
                                        Environment.NewLine +
                                        "STACK TRACE: " + ex.StackTrace,
                                        "Servicio de streaming (Recepcion)",
                                        EventLogEntryType.Error,
                                        "LogSucursalAudio");
                logger.WriteToErrorLog("ERROR: " + ex.Message,
                                        ex.StackTrace,
                                        "Streaming.cs");*/
                Console.WriteLine("Error [recibirPaquetes_ServidorUdp]: " + ex.Message);
                Console.WriteLine("StackTrace [recibirPaquetes_ServidorUdp]: " + ex.StackTrace);
            }
        }
        private void AudioServer_PacketReceived(UdpPacket_eArgs e)
        {
            // Decompress data.
            byte[] decodedData = null;
            if (m_Codec == 0)
            {
                decodedData = G711.Decode_aLaw(e.Data, 0, e.Data.Length);
            }
            else if (m_Codec == 1)
            {
                decodedData = G711.Decode_uLaw(e.Data, 0, e.Data.Length);
            }

            // just play received packet
            audioWaveOut.Play(decodedData, 0, decodedData.Length);
        }
 private void PacketRecieved(UdpPacket_eArgs e)
 {
     byte[] decodedData = G711.Decode_aLaw(e.Data, 0, e.Data.Length);
     _waveOut.Play(decodedData, 0, decodedData.Length);
 }
        private void AudioServer_PacketReceived(UdpPacket_eArgs e)
        {
            // Decompress data.
            byte[] decodedData = null;
            if (m_Codec == 0)
            {
                decodedData = G711.Decode_aLaw(e.Data, 0, e.Data.Length);
            }
            else if (m_Codec == 1)
            {
                decodedData = G711.Decode_uLaw(e.Data, 0, e.Data.Length);
            }

            // We just play received packet.
            try
            {
                audioWaveOut.Play(decodedData, 0, decodedData.Length);
            }
            catch (Exception ex)
            {
                ShowError("Could not play received audio.", ex.Message);
            }
        }