示例#1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            mTimer          = new Timer(1000);
            mTimer.Elapsed += new ElapsedEventHandler(Stats_Timer);
            mTimer.Enabled  = true; // Enable it

            mConnLocal  = new MediaConnection();
            mConnRemote = new MediaConnection();

            mConnLocal.StartMediaLogging(1000);
            mConnLocal.SetSink(this);
            mConnRemote.SetSink(this);
            var rv = mConnLocal.AddMedia(WmeSessionType.WmeSessionType_Video,
                                         WmeDirection.WmeDirection_SendRecv, 0, "");

            rv = mConnRemote.AddMedia(WmeSessionType.WmeSessionType_Video,
                                      WmeDirection.WmeDirection_SendRecv, 1000, "");
            rv = mConnLocal.AddMedia(WmeSessionType.WmeSessionType_ScreenShare,
                                     WmeDirection.WmeDirection_SendRecv, 2, "");
            rv = mConnRemote.AddMedia(WmeSessionType.WmeSessionType_ScreenShare,
                                      WmeDirection.WmeDirection_SendRecv, 2000, "");

            //mConnLocal.GetAudioConfig(1).EnableEC(true);
            //mConnLocal.GetVideoConfig(0).SetSelectedCodec(WmeCodecType.WmeCodecType_AVC);
            mConnLocal.GetVideoConfig(0).SetEncodeParams(WmeCodecType.WmeCodecType_AVC, 0x42000c,
                                                         27600, 920, 200, 4000);
            mConnLocal.GetVideoConfig(0).SetEncodeParams(WmeCodecType.WmeCodecType_SVC, 0x42000c,
                                                         27600, 920, 200, 4000);
            //mConnLocal.GetGlobalConfig().EnableMultiStream(true);
            //mConnRemote.GetGlobalConfig().EnableMultiStream(true);
            mConnLocal.CreateOffer();
        }