Exemple #1
0
        /// <summary>
        /// 应用程序回调
        /// </summary>
        private static void AddAppCallbackF(IntPtr appHandle, IntPtr appNamePtr)
        {
            var appName = IntPtrHelper.IntPtrTostring(appNamePtr);

            log.Info("AddAppCallbackF: appHandle:" + appHandle + "  appName:" + appName);
            var app = new QLApp(appHandle, appName);

            callView.Invoke(new Action(() =>
            {
                QLManager.GetInstance().apps.Add(app);
            }));
        }
Exemple #2
0
 public static QLManager GetInstance()
 {
     if (instance == null)
     {
         lock (lockObj)
         {
             if (instance == null)
             {
                 instance = new QLManager();
             }
         }
     }
     return(instance);
 }
Exemple #3
0
        /// <summary>
        /// 统计信息回调
        /// </summary>
        private static void DisplayMediaStatisticsCallbackF(IntPtr channelNamePtr, IntPtr participantNamePtr, IntPtr remoteSystemIdPtr, IntPtr callRatePtr, IntPtr packetsLostPtr, IntPtr packetLossPtr,
                                                            IntPtr videoProtocolPtr, IntPtr videoRatePtr, IntPtr videoRateUsedPtr, IntPtr videoFrameRatePtr, IntPtr videoPacketsLostPtr, IntPtr videoJitterPtr,
                                                            IntPtr videoFormatPtr, IntPtr errorConcealmentPtr, IntPtr audioProtocolPtr, IntPtr audioRatePtr, IntPtr audioPacketsLostPtr, IntPtr audioJitterPtr,
                                                            IntPtr audioEncryptPtr, IntPtr videoEncryptPtr, IntPtr feccEncryptPtr, IntPtr audioReceivedPacketPtr, IntPtr roundTripTimePtr,
                                                            IntPtr fullIntraFrameRequestPtr, IntPtr intraFrameSentPtr, IntPtr packetsCountPtr, IntPtr overallCPULoadPtr, IntPtr channelNumPtr)
        {
            var channelName           = IntPtrHelper.IntPtrTostring(channelNamePtr);
            var participantName       = IntPtrHelper.IntPtrTostring(participantNamePtr);
            var remoteSystemId        = IntPtrHelper.IntPtrTostring(remoteSystemIdPtr);
            var callRate              = IntPtrHelper.IntPtrTostring(callRatePtr);
            var packetsLost           = IntPtrHelper.IntPtrTostring(packetsLostPtr);
            var packetLoss            = IntPtrHelper.IntPtrTostring(packetLossPtr);
            var videoProtocol         = IntPtrHelper.IntPtrTostring(videoProtocolPtr);
            var videoRate             = IntPtrHelper.IntPtrTostring(videoRatePtr);
            var videoRateUsed         = IntPtrHelper.IntPtrTostring(videoRateUsedPtr);
            var videoFrameRate        = IntPtrHelper.IntPtrTostring(videoFrameRatePtr);
            var videoPacketsLost      = IntPtrHelper.IntPtrTostring(videoPacketsLostPtr);
            var videoJitter           = IntPtrHelper.IntPtrTostring(videoJitterPtr);
            var videoFormat           = IntPtrHelper.IntPtrTostring(videoFormatPtr);
            var errorConcealment      = IntPtrHelper.IntPtrTostring(errorConcealmentPtr);
            var audioProtocol         = IntPtrHelper.IntPtrTostring(audioProtocolPtr);
            var audioRate             = IntPtrHelper.IntPtrTostring(audioRatePtr);
            var audioPacketsLost      = IntPtrHelper.IntPtrTostring(audioPacketsLostPtr);
            var audioJitter           = IntPtrHelper.IntPtrTostring(audioJitterPtr);
            var audioEncrypt          = IntPtrHelper.IntPtrTostring(audioEncryptPtr);
            var videoEncrypt          = IntPtrHelper.IntPtrTostring(videoEncryptPtr);
            var feccEncrypt           = IntPtrHelper.IntPtrTostring(feccEncryptPtr);
            var audioReceivedPacket   = IntPtrHelper.IntPtrTostring(audioReceivedPacketPtr);
            var roundTripTime         = IntPtrHelper.IntPtrTostring(roundTripTimePtr);
            var fullIntraFrameRequest = IntPtrHelper.IntPtrTostring(fullIntraFrameRequestPtr);
            var intraFrameSent        = IntPtrHelper.IntPtrTostring(intraFrameSentPtr);
            var packetsCount          = IntPtrHelper.IntPtrTostring(packetsCountPtr);
            var overallCPULoad        = IntPtrHelper.IntPtrTostring(overallCPULoadPtr);
            int channelNo             = 0;

            if (int.TryParse(IntPtrHelper.IntPtrTostring(channelNumPtr), out channelNo))
            {
                var statistics = new QLMediaStatistics()
                {
                    ChannelName           = channelName == "(null)"?string.Empty:channelName,
                    ParticipantName       = participantName == "(null)" ? string.Empty : participantName,
                    RemoteSystemId        = remoteSystemId == "(null)" ? string.Empty : remoteSystemId,
                    CallRate              = callRate == "(null)" ? string.Empty : callRate,
                    PacketsLost           = packetsLost == "(null)" ? string.Empty : packetsLost,
                    PacketLoss            = packetLoss == "(null)" ? string.Empty : packetLoss,
                    VideoProtocol         = videoProtocol == "(null)" ? string.Empty : videoProtocol,
                    VideoRate             = videoRate == "(null)" ? string.Empty : videoRate,
                    VideoRateUsed         = videoRateUsed == "(null)" ? string.Empty : videoRateUsed,
                    VideoFrameRate        = videoFrameRate == "(null)" ? string.Empty : videoFrameRate,
                    VideoPacketsLost      = videoPacketsLost == "(null)" ? string.Empty : videoPacketsLost,
                    VideoJitter           = videoJitter == "(null)" ? string.Empty : videoJitter,
                    VideoFormat           = videoFormat == "(null)" ? string.Empty : videoFormat,
                    ErrorConcealment      = errorConcealment == "(null)" ? string.Empty : errorConcealment,
                    AudioProtocol         = audioProtocol == "(null)" ? string.Empty : audioProtocol,
                    AudioRate             = audioRate == "(null)" ? string.Empty : audioRate,
                    AudioPacketsLost      = audioPacketsLost == "(null)" ? string.Empty : audioPacketsLost,
                    AudioJitter           = audioJitter == "(null)" ? string.Empty : audioJitter,
                    AudioEncrypt          = audioEncrypt == "(null)" ? string.Empty : audioEncrypt,
                    VideoEncrypt          = videoEncrypt == "(null)" ? string.Empty : videoEncrypt,
                    FeccEncrypt           = feccEncrypt == "(null)" ? string.Empty : feccEncrypt,
                    AudioReceivedPacket   = audioReceivedPacket == "(null)" ? string.Empty : audioReceivedPacket,
                    RoundTripTime         = roundTripTime == "(null)" ? string.Empty : roundTripTime,
                    FullIntraFrameRequest = fullIntraFrameRequest == "(null)" ? string.Empty : fullIntraFrameRequest,
                    IntraFrameSent        = intraFrameSent == "(null)" ? string.Empty : intraFrameSent,
                    PacketsCount          = packetsCount == "(null)" ? string.Empty : packetsCount,
                    OverallCPULoad        = overallCPULoad == "(null)" ? string.Empty : overallCPULoad,
                    ChannelNum            = channelNo
                };
                callView.Invoke(new Action(() =>
                {
                    QLManager.GetInstance().mediaStatistics.Add(statistics);
                }));
            }
        }
Exemple #4
0
        private static void DoEvent(object state)
        {
            var evt = state as QLEvent;

            if (null == evt)
            {
                return;
            }
            log.Info(string.Format("EventType:{0},CallHandle:{1}", evt.EventType, evt.CallHandle));
            switch (evt.EventType)
            {
                #region QLDevice
            case EventType.DEVICE_VIDEOINPUTCHANGED:
            {
                string deviceName   = evt.PlugDeviceName;
                string deviceHandle = evt.DeviceHandle;
                if (string.IsNullOrWhiteSpace(deviceName) ||
                    string.IsNullOrWhiteSpace(deviceHandle))
                {
                    return;
                }
                if (true == evt.PlugDeviceStatus)
                {           /*plug in a device*/
                    var device = new QLDevice(DeviceType.VIDEOINPUT, deviceHandle, deviceName);
                    deviceManager.AddDevice(device);
                }
                else
                {
                    deviceManager.RemoveDevice(deviceHandle);
                }
            }
            break;           /* from MP */

            case EventType.DEVICE_AUDIOINPUTCHANGED:
            {
                string deviceName   = evt.PlugDeviceName;
                string deviceHandle = evt.DeviceHandle;
                if (string.IsNullOrWhiteSpace(deviceName) ||
                    string.IsNullOrWhiteSpace(deviceHandle))
                {
                    return;
                }
                if (true == evt.PlugDeviceStatus)
                {           /*plug in a device*/
                    var device = new QLDevice(DeviceType.AUDIOINPUT, deviceHandle, deviceName);
                    deviceManager.AddDevice(device);
                }
                else
                {
                    deviceManager.RemoveDevice(deviceHandle);
                }
            }
            break;          /* from MP */

            case EventType.DEVICE_AUDIOOUTPUTCHANGED:
            {
                string deviceName   = evt.PlugDeviceName;
                string deviceHandle = evt.DeviceHandle;
                if (string.IsNullOrWhiteSpace(deviceName) ||
                    string.IsNullOrWhiteSpace(deviceHandle))
                {
                    return;
                }
                if (true == evt.PlugDeviceStatus)
                {           /*plug in a device*/
                    var device = new QLDevice(DeviceType.AUDIOOUTPUT, deviceHandle, deviceName);
                    deviceManager.AddDevice(device);
                }
                else
                {
                    deviceManager.RemoveDevice(deviceHandle);
                }
            }
            break;                                      /* from MP */

            case EventType.DEVICE_VOLUMECHANGED: break; /* from MP */

            case EventType.DEVICE_MONITORINPUTSCHANGED:
            {
                string deviceName   = evt.PlugDeviceName;
                string deviceHandle = evt.DeviceHandle;
                if (string.IsNullOrWhiteSpace(deviceName) ||
                    string.IsNullOrWhiteSpace(deviceHandle))
                {
                    return;
                }
                if (true == evt.PlugDeviceStatus)
                {           /*plug in a device*/
                    var device = new QLDevice(DeviceType.MONITOR, deviceHandle, deviceName);
                    deviceManager.AddDevice(device);
                }
                else
                {
                    deviceManager.RemoveDevice(deviceHandle);
                }
            }
            break;          /* from MP */
                #endregion

                #region Register
            case EventType.UNKNOWN: break;

            case EventType.SIP_REGISTER_SUCCESS:
            {
                QLManager.GetInstance().isRegisted = true;
            }
            break;

            case EventType.SIP_REGISTER_FAILURE:
            {
                QLManager.GetInstance().isRegisted = false;
            }
            break;

            case EventType.SIP_REGISTER_UNREGISTERED: break;
                #endregion
                #region  处理

                /*
                 #region Call
                 * case EventType.SIP_CALL_INCOMING: break;
                 * case EventType.SIP_CALL_TRYING:break;
                 * case EventType.SIP_CALL_RINGING:break;
                 * case EventType.SIP_CALL_FAILURE:break;
                 * case EventType.SIP_CALL_CLOSED:break;
                 * case EventType.SIP_CALL_HOLD:break;
                 * case EventType.SIP_CALL_HELD:break;
                 * case EventType.SIP_CALL_DOUBLE_HOLD:break;
                 * case EventType.SIP_CALL_UAS_CONNECTED:break;
                 * case EventType.SIP_CALL_UAC_CONNECTED:break;
                 #endregion
                 #region Content
                 * case EventType.SIP_CONTENT_INCOMING:break;
                 * case EventType.SIP_CONTENT_CLOSED:break;
                 * case EventType.SIP_CONTENT_SENDING:break;
                 * case EventType.SIP_CONTENT_IDLE:break;
                 * case EventType.SIP_CONTENT_UNSUPPORTED:break;
                 #endregion
                 *
                 *
                 *
                 #region Stream
                 * case EventType.STREAM_VIDEO_LOCAL_RESOLUTIONCHANGED:break;
                 * case EventType.STREAM_VIDEO_REMOTE_RESOLUTIONCHANGED:break;
                 #endregion
                 *
                 * case EventType.NETWORK_CHANGED: break;
                 * case EventType.MFW_INTERNAL_TIME_OUT: break;
                 *
                 * case EventType.REFRESH_ACTIVE_SPEAKER:break;
                 * case EventType.REMOTE_VIDEO_REFRESH:break;
                 * case EventType.REMOTE_VIDEO_CHANNELSTATUS_CHANGED:break;
                 * case EventType.REMOTE_VIDEO_DISPLAYNAME_UPDATE:break;
                 * case EventType.SIP_CALL_MODE_CHANGED:break;
                 *
                 * case EventType.SIP_CALL_MODE_UPGRADE_REQ:break;
                 * case EventType.IS_TALKING_STATUS_CHANGED:break;
                 * case EventType.CERTIFICATE_VERIFY:break;
                 * case EventType.TRANSCODER_FINISH:break;
                 * case EventType.ICE_STATUS_CHANGED:break;
                 * case EventType.SUTLITE_INCOMING_CALL:break;
                 * case EventType.SUTLITE_TERMINATE_CALL:break;
                 * case EventType.NOT_SUPPORT_VIDEOCODEC:break;
                 *
                 * case EventType.BANDWIDTH_LIMITATION:break;
                 * case EventType.MEDIA_ADDRESS_UPDATED:break;
                 * case EventType.AUTODISCOVERY_STATUS_CHANGED:break;
                 */
                #endregion
            }
            QLManager.GetInstance().InternalQLEvent?.Invoke(evt);
            QLManager.GetInstance().QLEvent?.Invoke(evt);
        }