コード例 #1
0
 /// <summary>
 /// This method is called when RTP session gets new receive stream.
 /// </summary>
 /// <param name="sender">Sender.</param>
 /// <param name="e">Event data.</param>
 private void m_pRtpSession_NewReceiveStream(object sender, RTP_ReceiveStreamEventArgs e)
 {
     this.BeginInvoke(new MethodInvoker(delegate(){
         wfrm_Receive frm = new wfrm_Receive(e.Stream, m_pAudioCodecs);
         frm.Show();
     }));
 }
コード例 #2
0
 /// <summary>
 /// This method is called when RTP session gets new receive stream.
 /// </summary>
 /// <param name="sender">Sender.</param>
 /// <param name="e">Event data.</param>
 private void m_pRtpSession_NewReceiveStream(object sender, RTP_ReceiveStreamEventArgs e)
 {
     d_RecieveStream = Dispatcher.BeginInvoke(new Action(delegate()
     {
         /*wfrm_Receive frm = new wfrm_Receive(e.Stream, m_pAudioCodecs);
          * frm.Show();*/
         var selectedOutDevice = cbAudioOutDevices.SelectedItem as AudioOutDevice;
         m_pAudioOut           = new AudioOut_RTP(selectedOutDevice, e.Stream, m_pAudioCodecs);
         m_pAudioOut.Start();
     }));
 }
コード例 #3
0
        static int payload = 0;//8;

        static private void m_pRtpSession_NewReceiveStream(object sender, RTP_ReceiveStreamEventArgs e)
        {
            //if(e.Stream.Session.StunPublicEndPoints)
            //e.Stream.Session.Stop();
            foreach (AudioOutDevice device in AudioOut.Devices)
            {
                //WavePlayer wp = new WavePlayer(device);
                //wp.Play(,)
                ao = new AudioOut_RTP(
                    device,
                    e.Stream,
                    new Dictionary <int, AudioCodec> {
                    { payload, new PCMA() }
                }
                    );
                ao.Start();
                break;
            }
        }
コード例 #4
0
 static private void m_pRtpSession_NewReceiveStream(object sender, RTP_ReceiveStreamEventArgs e)
 {
     try
     {
         //for unicast make sure that the stream is from the expected source ip
         if (!multicast && !e.Stream.SSRC.RtpEP.Address.Equals(source_ip))
         {
             return;
         }
         session.Sessions[0].NewReceiveStream -= NewReceiveStream;
         AudioOutDevice device = AudioOut.Devices.Where(d => d.Name == Settings.Default.AudioDeviceName).FirstOrDefault();
         if (device == null)
         {
             Message.Error("Could not find audio device: " + Settings.Default.AudioDeviceName);
             return;
         }
         AudioCodec ac = new PCMU();
         ao = new AudioOut_RTP(
             device,
             e.Stream,
             new Dictionary <int, AudioCodec> {
             { payload, ac }
         }
             );
         Dictionary <AudioCodec, string> acs2of = new Dictionary <AudioCodec, string>();
         if (Settings.Default.RecordIncomingRtpStreams)
         {
             string wav_file = PathRoutines.CreateDirectory(Settings.Default.RtpStreamStorageFolder) + "\\" + e.Stream.SSRC.RtpEP.Address.ToString() + DateTime.Now.ToString("_yyyy-MM-dd_HH-mm-ss") + ".wav";
             acs2of[ac] = wav_file;
             if (execute != null)
             {
                 execute.Record = wav_file;
             }
         }
         ao.Start(volume100, acs2of);
     }
     catch (Exception ex)
     {
         Message.Error(ex);
     }
 }