void GetRemoteTrackEvents(MessagePrefixesPair <Message> msgPfx, Queue <Event> buffer, string loggableId)
        {
            Match m;
            var   msg = msgPfx.Message;

            if ((m = remoteTrackCtrRegex.Match(msg.Text)).Success)
            {
                buffer.Enqueue(new ObjectCreation(msg, loggableId, remoteTrackObjectType));
                var webRtcStreamId = m.Groups["webRtcStreamId"].Value;
                var remoteTracksId = m.Groups["remoteTracksId"].Value;
                buffer.Enqueue(new PropertyChange(msg, loggableId, remoteTrackObjectType, "WebRTC stream id", webRtcStreamId));
                buffer.Enqueue(new PropertyChange(msg, loggableId, remoteTrackObjectType, "type", m.Groups["type"].Value));
                buffer.Enqueue(new ParentChildRelationChange(msg, loggableId, remoteTrackObjectType, remoteTracksId));
                if (remoteTracksIdToParticipantsId.TryGetValue(remoteTracksId, out var participantsId) &&
                    participantsIdToSessionId.TryGetValue(participantsId, out var sessionId))
                {
                    buffer.Enqueue(new PropertyChange(
                                       msg, loggableId, remoteTrackObjectType,
                                       "stream", RemoteWebRTCStreamInfo.MakeStateInspectorObjectId(webRtcStreamId, sessionId),
                                       Postprocessing.StateInspector.ValueType.Reference));
                }
                var remoteTracksIdAndMediaType = $"{remoteTracksId}.{m.Groups["type"].Value}";
                if (remoteTracksIdAndMediaTypeToRemoteTrackId.TryGetValue(remoteTracksIdAndMediaType, out var oldRemoteTrackId))
                {
                    buffer.Enqueue(new ObjectDeletion(msg, oldRemoteTrackId, remoteTrackObjectType));
                }
                remoteTracksIdAndMediaTypeToRemoteTrackId[remoteTracksIdAndMediaType] = loggableId;
            }
        }
Esempio n. 2
0
        void GetProtocolEvents(MessagePrefixesPair <Message> msgPfx, Queue <Event> buffer, string loggableId)
        {
            var   msg = msgPfx.Message;
            Match m;

            if ((m = protocolCSUrlRegex.Match(msg.Text)).Success)
            {
                var env = m.Groups["value"].Value;
                if (env != reportedEnv)
                {
                    EnsureRootReported(msg, buffer);
                    reportedEnv = env;
                    buffer.Enqueue(new PropertyChange(msg, rootObjectId, rootTypeInfo, "environment", env));
                }
            }

            if (!protocolSessionData.TryGetValue(loggableId, out var sessionData))
            {
                protocolSessionData[loggableId] = sessionData = new ProtocolSessionData();
            }
            if (sessionData.meetingSessionId == null)
            {
                sessionData.pendingMessages.Add(msgPfx);
                return;
            }

            if ((m = protocolSessionIdAllocated.Match(msg.Text)).Success)
            {
                buffer.Enqueue(new PropertyChange(msg, sessionData.meetingSessionId, meetingSessionTypeInfo, "session id", m.Groups["value"].Value));
            }
        }
Esempio n. 3
0
        void GetInvitationsEvents(MessagePrefixesPair <Message> msgPfx, Queue <Event> buffer, string loggableId)
        {
            Match m;

            if ((m = invitationCtrRegex.Match(msgPfx.Message.Text)).Success)
            {
                buffer.Enqueue(new ObjectCreation(msgPfx.Message, loggableId, invitationTypeInfo));
                buffer.Enqueue(new ParentChildRelationChange(msgPfx.Message, loggableId, invitationTypeInfo, EnsureInvitationsReport(msgPfx.Message, buffer)));
                buffer.Enqueue(new PropertyChange(msgPfx.Message, loggableId, invitationTypeInfo, "meeting id", m.Groups["meetingId"].Value));
            }
            else if ((m = invitationPropsRegex.Match(msgPfx.Message.Text)).Success)
            {
                buffer.Enqueue(new PropertyChange(msgPfx.Message, loggableId, invitationTypeInfo, "state", "aggressive"));
                buffer.Enqueue(new PropertyChange(msgPfx.Message, loggableId, invitationTypeInfo, "stream id", m.Groups["streamId"].Value));
                buffer.Enqueue(new PropertyChange(msgPfx.Message, loggableId, invitationTypeInfo, "initiator", m.Groups["initiator"].Value));
                buffer.Enqueue(new PropertyChange(msgPfx.Message, loggableId, invitationTypeInfo, "SS only", m.Groups["ss"].Value));
            }
            else if ((m = invitationPassiveRegex.Match(msgPfx.Message.Text)).Success)
            {
                buffer.Enqueue(new PropertyChange(msgPfx.Message, loggableId, invitationTypeInfo, "state", "passive"));
            }
            else if ((m = invitationTotalRegex.Match(msgPfx.Message.Text)).Success)
            {
                buffer.Enqueue(new PropertyChange(msgPfx.Message, loggableId, invitationTypeInfo, "participants count", m.Groups["value"].Value));
            }
            else if ((m = invitationDtrRegex.Match(msgPfx.Message.Text)).Success)
            {
                buffer.Enqueue(new ObjectDeletion(msgPfx.Message, loggableId, meetingRemotePartTypeInfo));
            }
        }
        void GetEvents(MessagePrefixesPair msgPfx, Queue <Event> buffer)
        {
            string id, type;

            if (logableIdUtils.TryParseLogableId(msgPfx.Message.Logger.Value, out type, out id))
            {
                switch (type)
                {
                case "meeting":
                    GetMeetingEvents(msgPfx, buffer, id);
                    break;

                case "session":
                    GetSessionEvents(msgPfx, buffer, id);
                    break;

                case "protocol":
                    GetProtocolEvents(msgPfx, buffer, id);
                    break;

                case "remotePart":
                    GetRemotePartEvents(msgPfx, buffer, id);
                    break;

                case "participants":
                    GetParticipantsEvents(msgPfx, buffer, id);
                    break;
                }
            }
        }
Esempio n. 5
0
        void GetSessionEvents(MessagePrefixesPair <Message> msgPfx, Queue <Event> buffer, string loggableId)
        {
            var   msg = msgPfx.Message;
            Match m;

            if ((m = sessionCtrRegex.Match(msg.Text)).Success)
            {
                buffer.Enqueue(new ObjectCreation(msg, loggableId, meetingSessionTypeInfo));
            }
            else if ((m = sessionJoinedRegex.Match(msg.Text)).Success)
            {
                string meetingLoggableId;
                if (sessionToMeeting.TryGetValue(loggableId, out meetingLoggableId))
                {
                    buffer.Enqueue(new PropertyChange(msg, meetingLoggableId,
                                                      meetingTypeInfo, "meeting ID", m.Groups["meetingId"].Value));
                    buffer.Enqueue(new PropertyChange(msg, meetingLoggableId,
                                                      meetingTypeInfo, "meeting initiator",
                                                      string.Format("{0}{1}", m.Groups["initiator"], m.Groups["isInitator"].Value == "true" ? " (local user)" : "")));
                }
                buffer.Enqueue(new PropertyChange(msg, loggableId,
                                                  meetingSessionTypeInfo, "status", "joined"));
            }
            else if ((m = sessionPropChangeRegex.Match(msg.Text)).Success)
            {
                buffer.Enqueue(new PropertyChange(
                                   msg, loggableId, meetingSessionTypeInfo,
                                   m.Groups["prop"].Value, m.Groups["value"].Value));
            }
            else if (msg.Text == "disposed")
            {
                buffer.Enqueue(new ObjectDeletion(msg, loggableId, meetingSessionTypeInfo));
                foreach (var i in sessionUserIdToRemotePartId.Where(i => i.Key.StartsWith(loggableId, StringComparison.InvariantCulture)).ToArray())
                {
                    buffer.Enqueue(new ObjectDeletion(msgPfx.Message, i.Value, meetingRemotePartTypeInfo));
                    sessionUserIdToRemotePartId.Remove(i.Key);
                }
            }
            else if ((m = sessionStartedProtocolSession.Match(msg.Text)).Success)
            {
                var protocolSessionId = m.Groups["value"].Value;
                ProtocolSessionData sessionData;
                if (protocolSessionData.TryGetValue(protocolSessionId, out sessionData))
                {
                    sessionData.meetingSessionId = loggableId;
                    sessionData.pendingMessages.ForEach(pmsg => GetProtocolEvents(pmsg, buffer, protocolSessionId));
                }
            }
            else if ((m = sessionLocalMediaRegex.Match(msg.Text)).Success)
            {
                buffer.Enqueue(new ParentChildRelationChange(
                                   msg, m.Groups["value"].Value, MediaStateInspector.LocalMediaTypeInfo, loggableId));
            }
            else if ((m = sessionParticipantsRegex.Match(msg.Text)).Success)
            {
                participantsLoggableIdToSessionLoggableId[m.Groups["value"].Value] = loggableId;
            }
        }
Esempio n. 6
0
        void GetFlowInitiatorEvents(MessagePrefixesPair msgPfx, Queue <Event> buffer, string loggableId)
        {
            var msg = msgPfx.Message;

            if (msg.Text == "leave flow")
            {
                buffer.Enqueue(new UserActionEvent(msg, "leave"));
            }
        }
Esempio n. 7
0
        void GetUsersEvents(MessagePrefixesPair <Message> msgPfx, Queue <Event> buffer, string loggableId)
        {
            Match m;

            if ((m = localUserRegex.Match(msgPfx.Message.Text)).Success)
            {
                ReportLocalUserProps(m.Groups["id"].Value, m.Groups["name"].Value, msgPfx.Message, buffer);
            }
        }
Esempio n. 8
0
        void GetLocalMediaUIEvents(MessagePrefixesPair msgPfx, Queue <Event> buffer, string loggableId)
        {
            Match m;
            var   msg = msgPfx.Message;

            if ((m = localMediaUIButtonRegex.Match(msg.Text)).Success)
            {
                buffer.Enqueue(new UserActionEvent(msg, m.Groups["btn"].Value));
            }
        }
Esempio n. 9
0
        void TryLinkRemotePartToRemoteTracks(MessagePrefixesPair msgPfx, Queue <Event> buffer, string remotePartLoggableId)
        {
            Match m;

            if ((m = remotePartCreationRegex.Match(msgPfx.Message.Text)).Success)
            {
                buffer.Enqueue(new ParentChildRelationChange(
                                   msgPfx.Message, m.Groups["remoteTracksId"].Value, remoteTracksObjectType, remotePartLoggableId));
                remoteTracksIdToParticipantsId[m.Groups["remoteTracksId"].Value] = m.Groups["participantsId"].Value;
            }
        }
Esempio n. 10
0
        void GetEvents(MessagePrefixesPair msgPfx, Queue <Event> buffer)
        {
            string id, type;

            if (logableIdUtils.TryParseLogableId(msgPfx.Message.Logger.Value, out type, out id))
            {
                switch (type)
                {
                case "localMedia":
                    GetLocalMediaEvents(msgPfx, buffer, id);
                    break;

                case "localScreen":
                    GetLocalScreenEvents(msgPfx, buffer, id);
                    break;

                case "localAudio":
                    GetLocalAudioVideoEvents(msgPfx, buffer, id, localAudioObjectType);
                    break;

                case "localVideo":
                    GetLocalAudioVideoEvents(msgPfx, buffer, id, localVideoObjectType);
                    break;

                case "remotePart":
                    TryLinkRemotePartToRemoteTracks(msgPfx, buffer, id);
                    break;

                case "session":
                    GetSessionEvents(msgPfx, buffer, id);
                    break;

                case "remoteTrack":
                    GetRemoteTrackEvents(msgPfx, buffer, id);
                    break;

                case "remoteTracks":
                    GetRemoteTracksEvents(msgPfx, buffer, id);
                    break;

                case "remoteMedia":
                    GetRemoteMediaEvents(msgPfx, buffer, id);
                    break;

                case "stats":
                    GetStatsEvents(msgPfx, buffer, id);
                    break;

                case "tsession":
                    GetTestSessionEvents(msgPfx, buffer, id);
                    break;
                }
            }
        }
Esempio n. 11
0
        void GetEvents(MessagePrefixesPair msgPfx, Queue <Event> buffer)
        {
            string id, type;

            if (logableIdUtils.TryParseLogableId(msgPfx.Message.Logger.Value, out type, out id))
            {
                if (type == "meeting")
                {
                }
            }
        }
Esempio n. 12
0
        void GetStatsEvents(MessagePrefixesPair msgPfx, Queue <Event> buffer, string loggableId)
        {
            Match m;
            var   msg = msgPfx.Message;

            if ((m = statsConnQualityRegex.Match(msg.Text)).Success)
            {
                string sessionId;
                if (statsIdToSessionId.TryGetValue(loggableId, out sessionId))
                {
                    buffer.Enqueue(new PropertyChange(
                                       msg, sessionId, MeetingsStateInspector.MeetingSessionTypeInfo, "connection quality", m.Groups["value"].Value));
                }
            }
            else if ((m = statsObjectPropRegex.Match(msg.Text)).Success ||
                     (m = statsObjectGoneRegex.Match(msg.Text)).Success)
            {
                var id   = m.Groups["id"].Value;
                var prop = m.Groups["prop"].Value;
                if (prop.Length > 0 && !webRtcStatsObjectAllAllowedProps.Contains(prop))
                {
                    return;
                }
                string sessionId;
                if (!statsIdToSessionId.TryGetValue(loggableId, out sessionId))
                {
                    sessionId = "(no session)";
                }
                Dictionary <string, WebRtcStatsObjectInfo> sessionStatsObjects;
                if (!webRtcStatsObjects.TryGetValue(sessionId, out sessionStatsObjects))
                {
                    webRtcStatsObjects[sessionId] = sessionStatsObjects = new Dictionary <string, WebRtcStatsObjectInfo>();
                }
                WebRtcStatsObjectInfo objInfo;
                if (!sessionStatsObjects.TryGetValue(id, out objInfo))
                {
                    sessionStatsObjects[id] = objInfo = new WebRtcStatsObjectInfo()
                    {
                        stateInspectorObjectId = WebRtcStatsObjectInfo.MakeStateInspectorObjectId(id, loggableId),
                        statsId = loggableId,
                        cluster = new HashSet <string> {
                            id
                        }
                    };
                }
                objInfo.messages.Add(msg);
                if (prop == "type")
                {
                    objInfo.type = m.Groups["value"].Value;
                }
            }
        }
Esempio n. 13
0
        void GetLocalMediaEvents(MessagePrefixesPair msgPfx, Queue <Event> buffer, string loggableId)
        {
            Match m;
            var   msg = msgPfx.Message;

            if ((m = localMediaOfferRegex.Match(msg.Text)).Success)
            {
                var action = m.Groups["action"].Value;
                var offer  = m.Groups["offerId"].Value;
                buffer.Enqueue(new ProcedureEvent(
                                   msg, offer, offer, action == "processing" ? ActivityEventType.Begin : ActivityEventType.End));
            }
        }
        void GetLocalMediaEvents(MessagePrefixesPair <Message> msgPfx, Queue <Event> buffer, string loggableId)
        {
            Match m;
            var   msg = msgPfx.Message;

            if ((m = localMediaOfferRegex.Match(msg.Text)).Success)
            {
                var action = m.Groups["action"].Value;
                var offer  = m.Groups["offerId"].Value;
                buffer.Enqueue(new ProcedureEvent(
                                   msg, offer, offer, action == "processing" ? ActivityEventType.Begin : ActivityEventType.End,
                                   status: action.Contains("failed") ? ActivityStatus.Error : ActivityStatus.Unspecified
                                   ).SetTags(new HashSet <string>(new[] { "media" })));
            }
        }
 void GetEvents(MessagePrefixesPair <CD.Message> msg, Queue <Event> buffer)
 {
     if (msg.Prefixes.Contains(devToolsConsoleEventPrefix))
     {
         var parsed = CD.DevTools.Events.LogMessage.Parse(msg.Message.Text);
         if (parsed != null)
         {
             var payload = parsed.ParsePayload <CD.DevTools.Events.Runtime.LogAPICalled>();
             if (payload != null && payload.args.Length == 1 && payload.args[0].type == "string")
             {
                 GetCIEvents((string)payload.args[0].value, msg.Message, buffer);
             }
         }
     }
 }
Esempio n. 16
0
        void GetLocalAudioVideoEvents(MessagePrefixesPair msgPfx, Queue <Event> buffer, string loggableId, ObjectTypeInfo typeInfo)
        {
            var   msg = msgPfx.Message;
            Match m;

            if ((m = localAudioVideoCtrRegex.Match(msg.Text)).Success)
            {
                buffer.Enqueue(new ObjectCreation(msg, loggableId, typeInfo));
                buffer.Enqueue(new PropertyChange(
                                   msg, loggableId, typeInfo, "device", m.Groups["device"].Value));
                if (typeInfo == localAudioObjectType || typeInfo == localVideoObjectType)
                {
                    buffer.Enqueue(new PropertyChange(msg, loggableId, typeInfo, "state", "unmuted"));
                }
            }
            else if (msg.Text == "dispose")
            {
                buffer.Enqueue(new ObjectDeletion(msg, loggableId, typeInfo));
            }
            else if ((m = localAudioVideoPropRegex.Match(msg.Text)).Success)
            {
                var value = m.Groups["value"].Value;
                buffer.Enqueue(new PropertyChange(
                                   msg, loggableId, typeInfo,
                                   m.Groups["stream"].Success ? "WebRTC stream id" :
                                   m.Groups["tracks"].Success ? "WebRTC track id" :
                                   "?", value));
                if (m.Groups["stream"].Success)
                {
                    localWebRtcStreamIdToInfo[value] = new LocalWebRTCStreamInfo()
                    {
                        symTrackId = loggableId
                    };
                }
            }
            else if (msg.Text == "mute")
            {
                buffer.Enqueue(new PropertyChange(msg, loggableId, typeInfo, "state", "muted"));
            }
            else if ((typeInfo == localAudioObjectType) && msg.Text == "unmute")
            {
                buffer.Enqueue(new PropertyChange(msg, loggableId, typeInfo, "state", "unmuted"));
            }
            else if ((typeInfo == localVideoObjectType) && msg.Text == "unmuted")
            {
                buffer.Enqueue(new PropertyChange(msg, loggableId, typeInfo, "state", "unmuted"));
            }
        }
        void GetParticipantsEvents(MessagePrefixesPair msgPfx, Queue <Event> buffer, string loggableId)
        {
            Match m;

            if ((m = participantsUserLeftRegex.Match(msgPfx.Message.Text)).Success)
            {
                string sessionLoggableId;
                string remotePartId;
                if (participantsLoggableIdToSessionLoggableId.TryGetValue(loggableId, out sessionLoggableId) &&
                    sessionUserIdToRemotePartId.TryGetValue(MakeSessionUserId(sessionLoggableId, m.Groups["userId"].Value), out remotePartId))
                {
                    buffer.Enqueue(new ObjectDeletion(msgPfx.Message, remotePartId, meetingRemotePartTypeInfo));
                    sessionUserIdToRemotePartId.Remove(MakeSessionUserId(sessionLoggableId, m.Groups["userId"].Value));
                }
            }
        }
Esempio n. 18
0
        void GetRemotePartEvents(MessagePrefixesPair <Message> msgPfx, Queue <Event> buffer, string loggableId)
        {
            var   msg = msgPfx.Message;
            Match m;

            if ((m = remotePartCreationRegex.Match(msg.Text)).Success)
            {
                buffer.Enqueue(new ObjectCreation(msg, loggableId, meetingRemotePartTypeInfo));
                buffer.Enqueue(new PropertyChange(msg, loggableId, meetingRemotePartTypeInfo, "user name", m.Groups["userName"].Value));
                buffer.Enqueue(new PropertyChange(msg, loggableId, meetingRemotePartTypeInfo, "user id", m.Groups["userId"].Value));
                string sessionLoggableId;
                if (participantsLoggableIdToSessionLoggableId.TryGetValue(m.Groups["partsId"].Value, out sessionLoggableId))
                {
                    sessionUserIdToRemotePartId[MakeSessionUserId(sessionLoggableId, m.Groups["userId"].Value)] = loggableId;
                    buffer.Enqueue(new ParentChildRelationChange(msg, loggableId, meetingRemotePartTypeInfo, sessionLoggableId));
                }
            }
        }
Esempio n. 19
0
        void GetTestSessionEvents(MessagePrefixesPair msgPfx, Queue <Event> buffer, string testSessionLoggableId)
        {
            Match m;
            var   msg = msgPfx.Message;

            if ((m = testSessionCtrRegex.Match(msg.Text)).Success)
            {
                buffer.Enqueue(new ObjectCreation(msg, testSessionLoggableId, testSessionObjectType));
            }
            else if ((m = testSessionRemoteMediaCtrRegex.Match(msg.Text)).Success)
            {
                buffer.Enqueue(new ParentChildRelationChange(msg, m.Groups["value"].Value, remoteMediaObjectType, testSessionLoggableId));
                remoteMediaIdToSessionId[m.Groups["value"].Value] = testSessionLoggableId;
            }
            else if ((m = testSessionStatsCtrRegex.Match(msg.Text)).Success)
            {
                statsIdToSessionId[m.Groups["value"].Value] = testSessionLoggableId;
            }
        }
Esempio n. 20
0
        void GetSessionEvents(MessagePrefixesPair msgPfx, Queue <Event> buffer, string loggableId)
        {
            var   msg = msgPfx.Message;
            Match m;

            if ((m = sessionCtrRegex.Match(msg.Text)).Success)
            {
                buffer.Enqueue(new ObjectCreation(msg, loggableId, meetingSessionTypeInfo));
            }
            else if ((m = sessionJoinedRegex.Match(msg.Text)).Success)
            {
                string meetingLoggableId;
                if (sessionToMeeting.TryGetValue(loggableId, out meetingLoggableId))
                {
                    buffer.Enqueue(new PropertyChange(msg, meetingLoggableId,
                                                      meetingTypeInfo, "meeting ID", m.Groups["meetingId"].Value));
                    buffer.Enqueue(new PropertyChange(msg, meetingLoggableId,
                                                      meetingTypeInfo, "meeting initiator",
                                                      string.Format("{0}{1}", m.Groups["initiator"], m.Groups["isInitator"].Value == "true" ? " (local user)" : "")));
                }
                buffer.Enqueue(new PropertyChange(msg, loggableId,
                                                  meetingSessionTypeInfo, "status", "joined"));
            }
            else if ((m = sessionIceStatusRegex.Match(msg.Text)).Success)
            {
                buffer.Enqueue(new PropertyChange(msg, loggableId, meetingSessionTypeInfo, "ice status", m.Groups["value"].Value));
            }
            else if (msg.Text == "disposed")
            {
                buffer.Enqueue(new ObjectDeletion(msg, loggableId, meetingSessionTypeInfo));
            }
            else if ((m = sessionStartedProtocolSession.Match(msg.Text)).Success)
            {
                var protocolSessionId = m.Groups["value"].Value;
                ProtocolSessionData sessionData;
                if (protocolSessionData.TryGetValue(protocolSessionId, out sessionData))
                {
                    sessionData.meetingSessionId = loggableId;
                    sessionData.pendingMessages.ForEach(pmsg => GetProtocolEvents(pmsg, buffer, protocolSessionId));
                }
            }
        }
Esempio n. 21
0
        void GetSessionEvents(MessagePrefixesPair msgPfx, Queue <Event> buffer, string sessionLoggableId)
        {
            Match m;

            if ((m = sessionStatsCtrRegex.Match(msgPfx.Message.Text)).Success)
            {
                statsIdToSessionId[m.Groups["value"].Value] = sessionLoggableId;
            }
            else if ((m = sessionRemoteMediaCtrRegex.Match(msgPfx.Message.Text)).Success)
            {
                var remoteMediaId = m.Groups["value"].Value;
                buffer.Enqueue(new ObjectCreation(msgPfx.Message, remoteMediaId, remoteMediaObjectType));
                buffer.Enqueue(new ParentChildRelationChange(msgPfx.Message, remoteMediaId, remoteMediaObjectType, sessionLoggableId));
                remoteMediaIdToSessionId[remoteMediaId] = sessionLoggableId;
            }
            else if ((m = sessionParticipantsRegex.Match(msgPfx.Message.Text)).Success)
            {
                participantsIdToSessionId[m.Groups["value"].Value] = sessionLoggableId;
            }
        }
        void GetRemoteTracksEvents(MessagePrefixesPair <Message> msgPfx, Queue <Event> buffer, string loggableId)
        {
            Match m;
            var   msg = msgPfx.Message;

            Action <bool> yieldAudioStatePropChange = (bool unmuted) =>
            {
                buffer.Enqueue(new PropertyChange(
                                   msg, loggableId, remoteTracksObjectType, "audio state", unmuted ? "unmuted" : "muted"));
            };

            if ((m = remoteTracksCtrRegex.Match(msg.Text)).Success)
            {
                buffer.Enqueue(new ObjectCreation(msg, loggableId, remoteTracksObjectType));
                yieldAudioStatePropChange(!(m.Groups["muted"].Success || m.Groups["audio"].Value == "undefined"));
                Action <string> yieldInitialStream = (type) =>
                {
                    buffer.Enqueue(new PropertyChange(msg, loggableId, remoteTracksObjectType,
                                                      type + " stream id", m.Groups[type].Value));
                };
                yieldInitialStream("audio");
                yieldInitialStream("video");
                yieldInitialStream("screen");
            }
            else if ((m = remoteTracksModalityStreamIdChangeRegex.Match(msg.Text)).Success)
            {
                var newStm = m.Groups["newWebRtcStreamId"].Value;
                var type   = m.Groups["type"].Value;
                buffer.Enqueue(new PropertyChange(msg, loggableId, remoteTracksObjectType,
                                                  type + " stream id", newStm));
            }
            else if ((m = remoteTracksMutedChangeRegex.Match(msg.Text)).Success)
            {
                yieldAudioStatePropChange(m.Groups["value"].Value == "false");
            }
            else if ((m = remoteTracksLastNChangeRegex.Match(msg.Text)).Success)
            {
                buffer.Enqueue(new PropertyChange(msg, loggableId, remoteTracksObjectType,
                                                  "particpant is lastN", m.Groups["value"].Value));
            }
        }
Esempio n. 23
0
        void GetEvents(MessagePrefixesPair msgPfx, Queue <Event> buffer)
        {
            string id, type;

            if (logableIdUtils.TryParseLogableId(msgPfx.Message.Logger.Value, out type, out id))
            {
                switch (type)
                {
                case "ui.overlay":
                    GetFlowInitiatorEvents(msgPfx, buffer, id);
                    break;

                case "ui.localMedia":
                    GetLocalMediaUIEvents(msgPfx, buffer, id);
                    break;

                case "localMedia":
                    GetLocalMediaEvents(msgPfx, buffer, id);
                    break;
                }
            }
        }
Esempio n. 24
0
        void GetProtocolEvents(MessagePrefixesPair msgPfx, Queue <Event> buffer, string loggableId)
        {
            ProtocolSessionData sessionData;

            if (!protocolSessionData.TryGetValue(loggableId, out sessionData))
            {
                protocolSessionData[loggableId] = sessionData = new ProtocolSessionData();
            }
            if (sessionData.meetingSessionId == null)
            {
                sessionData.pendingMessages.Add(msgPfx);
                return;
            }

            var   msg = msgPfx.Message;
            Match m;

            if ((m = protocolSessionIdAllocated.Match(msg.Text)).Success)
            {
                buffer.Enqueue(new PropertyChange(msg, sessionData.meetingSessionId, meetingSessionTypeInfo, "session id", m.Groups["value"].Value));
            }
        }
Esempio n. 25
0
        void GetMeetingEvents(MessagePrefixesPair <Message> msgPfx, Queue <Event> buffer, string loggableId)
        {
            var   msg = msgPfx.Message;
            Match m;

            if ((m = meetingCtrRegex.Match(msg.Text)).Success)
            {
                EnsureRootReported(msg, buffer);
                buffer.Enqueue(new ObjectCreation(msg, loggableId, meetingTypeInfo));
                buffer.Enqueue(new ParentChildRelationChange(msg, loggableId, meetingTypeInfo, rootObjectId));
                buffer.Enqueue(new PropertyChange(msg, loggableId, meetingTypeInfo, "stream", m.Groups["stmId"].Value));
            }
            else if (msg.Text == "disposed")
            {
                buffer.Enqueue(new ObjectDeletion(msg, loggableId, meetingTypeInfo));
            }
            else if ((m = meetingStateRegex.Match(msg.Text)).Success)
            {
                var state = m.Groups["value"].Value;
                buffer.Enqueue(new PropertyChange(msg, loggableId, meetingTypeInfo, "state", state));
            }
            else if ((m = meetingRecoveryStartRegex.Match(msg.Text)).Success)
            {
                buffer.Enqueue(new PropertyChange(msg, loggableId, meetingTypeInfo, "recovery", "started"));
            }
            else if ((m = meetingRecoveryAttemptRegex.Match(msg.Text)).Success ||
                     (m = meetingRecoveryAttemptEndRegex.Match(msg.Text)).Success)
            {
                buffer.Enqueue(new PropertyChange(msg, loggableId, meetingTypeInfo, "recovery", m.Groups["value"].Value));
            }
            else if ((m = meetingSessionRegex.Match(msg.Text)).Success)
            {
                var sid = m.Groups["value"].Value;
                sessionToMeeting[sid] = loggableId;
                buffer.Enqueue(new ParentChildRelationChange(msg, sid, meetingSessionTypeInfo, loggableId));
            }
        }
Esempio n. 26
0
        void GetLocalScreenEvents(MessagePrefixesPair msgPfx, Queue <Event> buffer, string loggableId)
        {
            var   msg = msgPfx.Message;
            Match m;

            if ((m = localScreenCtrRegex.Match(msg.Text)).Success)
            {
                buffer.Enqueue(new ObjectCreation(msg, loggableId, localScreenObjectType));
            }
            else if (msg.Text == "dispose")
            {
                buffer.Enqueue(new ObjectDeletion(msg, loggableId, localScreenObjectType));
            }
            else if ((m = localScreenPropRegex.Match(msg.Text)).Success)
            {
                var value = m.Groups["value"].Value;
                buffer.Enqueue(new PropertyChange(
                                   msg, loggableId, localScreenObjectType,
                                   m.Groups["streamId"].Length > 0 ? "WebRTC stream id" :
                                   m.Groups["label"].Length > 0 ? "label" :
                                   m.Groups["trackId"].Length > 0 ? "WebRTC track id" :
                                   "?",
                                   value));
                if (m.Groups["isLabel"].Length > 0 && m.Groups["prefix"].Length > 0)
                {
                    buffer.Enqueue(new PropertyChange(
                                       msg, loggableId, localScreenObjectType, "type", m.Groups["prefix"].Value));
                }
                if (m.Groups["streamId"].Length > 0)
                {
                    localWebRtcStreamIdToInfo[value] = new LocalWebRTCStreamInfo()
                    {
                        symTrackId = loggableId
                    };
                }
            }
        }
Esempio n. 27
0
        void GetProbeSessionEvents(MessagePrefixesPair <Message> msgPfx, Queue <Event> buffer, string loggableId)
        {
            Match m;

            if ((m = psessionCtrRegex.Match(msgPfx.Message.Text)).Success)
            {
                buffer.Enqueue(new ObjectCreation(msgPfx.Message, loggableId, psessionTypeInfo));
                EnsureRootReported(msgPfx.Message, buffer);
                buffer.Enqueue(new ParentChildRelationChange(msgPfx.Message, loggableId, psessionTypeInfo, rootObjectId));
                buffer.Enqueue(new PropertyChange(msgPfx.Message, loggableId, psessionTypeInfo, "region", m.Groups["region"].Value));
            }
            else if ((m = psessionDtrRegex.Match(msgPfx.Message.Text)).Success)
            {
                buffer.Enqueue(new ObjectDeletion(msgPfx.Message, loggableId, psessionTypeInfo));
            }
            else if ((m = psessionJoinedRegex.Match(msgPfx.Message.Text)).Success)
            {
                buffer.Enqueue(new PropertyChange(msgPfx.Message, loggableId, psessionTypeInfo, "session id", m.Groups["value"].Value));
            }
            else if ((m = psessionIceRegex.Match(msgPfx.Message.Text)).Success)
            {
                buffer.Enqueue(new PropertyChange(msgPfx.Message, loggableId, psessionTypeInfo, "ice status", m.Groups["value"].Value));
            }
        }
Esempio n. 28
0
        void GetRemoteTrackEvents(MessagePrefixesPair msgPfx, Queue <Event> buffer, string loggableId)
        {
            Match m;
            var   msg = msgPfx.Message;

            if ((m = remoteTrackCtrRegex.Match(msg.Text)).Success)
            {
                buffer.Enqueue(new ObjectCreation(msg, loggableId, remoteTrackObjectType));
                var webRtcStreamId = m.Groups["webRtcStreamId"].Value;
                var remoteTracksId = m.Groups["remoteTracksId"].Value;
                buffer.Enqueue(new PropertyChange(msg, loggableId, remoteTrackObjectType, "WebRTC stream id", webRtcStreamId));
                buffer.Enqueue(new PropertyChange(msg, loggableId, remoteTrackObjectType, "type", m.Groups["type"].Value));
                buffer.Enqueue(new ParentChildRelationChange(msg, loggableId, remoteTrackObjectType, remoteTracksId));
                string participantsId, sessionId;
                if (remoteTracksIdToParticipantsId.TryGetValue(remoteTracksId, out participantsId) &&
                    participantsIdToSessionId.TryGetValue(participantsId, out sessionId))
                {
                    buffer.Enqueue(new PropertyChange(
                                       msg, loggableId, remoteTrackObjectType,
                                       "stream", RemoteWebRTCStreamInfo.MakeStateInspectorObjectId(webRtcStreamId, sessionId),
                                       Analytics.StateInspector.ValueType.Reference));
                }
            }
        }
Esempio n. 29
0
        void GetLocalMediaEvents(MessagePrefixesPair msgPfx, Queue <Event> buffer, string loggableId)
        {
            var   msg = msgPfx.Message;
            Match m;


            Action <string, string> attachSymTrack = (trackType, symTrackId) =>
            {
                if (!string.IsNullOrEmpty(symTrackId))
                {
                    var trackObjectType =
                        trackType == "audio" ? localAudioObjectType :
                        trackType == "video" ? localVideoObjectType :
                        localScreenObjectType;
                    buffer.Enqueue(new ParentChildRelationChange(msg, symTrackId, trackObjectType, loggableId));
                    buffer.Enqueue(new PropertyChange(
                                       msg, loggableId, localMediaTypeInfo, trackType + " track", symTrackId, Analytics.StateInspector.ValueType.Reference));
                }
                else
                {
                    buffer.Enqueue(new PropertyChange(msg, loggableId, localMediaTypeInfo, trackType + " track", ""));
                }
            };

            if ((m = localMediaCtrRegex.Match(msg.Text)).Success)
            {
                buffer.Enqueue(new ObjectCreation(msg, loggableId, localMediaTypeInfo));
            }
            else if (msg.Text == "disposed")
            {
                buffer.Enqueue(new ObjectDeletion(msg, loggableId, localMediaTypeInfo));
            }
            else if ((m = localMediaScreenOnRegex.Match(msg.Text)).Success)
            {
                attachSymTrack("screen", m.Groups["value"].Value);
            }
            else if ((m = localMediaScreenOffRegex.Match(msg.Text)).Success)
            {
                attachSymTrack("screen", "");
            }
            else if ((m = localMediaAudioOnRegex.Match(msg.Text)).Success)
            {
                attachSymTrack("audio", m.Groups["value"].Value);
            }
            else if ((m = localMediaAudioOffRegex.Match(msg.Text)).Success)
            {
                attachSymTrack("audio", "");
            }
            else if ((m = localMediaVideoOnRegex.Match(msg.Text)).Success)
            {
                attachSymTrack("video", m.Groups["value"].Value);
            }
            else if ((m = localMediaVideoOffRegex.Match(msg.Text)).Success)
            {
                attachSymTrack("video", "");
            }
            else if ((m = localMediaInitialModalityRegex.Match(msg.Text)).Success)
            {
                var symTrackId = m.Groups["value"].Value;
                if (symTrackId != "undefined")
                {
                    attachSymTrack(m.Groups["modality"].Value, symTrackId);
                }
            }
        }
Esempio n. 30
0
        void GetRemoteMediaEvents(MessagePrefixesPair msgPfx, Queue <Event> buffer, string loggableId)
        {
            Func <string, string, string, bool, RemoteWebRTCStreamInfo> handleChange = (stmId, a, v, allowCreate) =>
            {
                string sessionId;
                if (!remoteMediaIdToSessionId.TryGetValue(loggableId, out sessionId))
                {
                    return(null);
                }
                Dictionary <string, RemoteWebRTCStreamInfo> sessionStreams;
                if (!remoteWebRtcStreamIdToInfo.TryGetValue(sessionId, out sessionStreams))
                {
                    remoteWebRtcStreamIdToInfo[sessionId] = sessionStreams = new Dictionary <string, RemoteWebRTCStreamInfo>();
                }
                RemoteWebRTCStreamInfo stmInfo;
                if (!sessionStreams.TryGetValue(stmId, out stmInfo))
                {
                    if (!allowCreate)
                    {
                        return(null);
                    }
                    sessionStreams[stmId] = stmInfo = new RemoteWebRTCStreamInfo()
                    {
                        stateInspectorObjectId = RemoteWebRTCStreamInfo.MakeStateInspectorObjectId(stmId, sessionId),
                        remoteMediaId          = loggableId
                    };
                    buffer.Enqueue(new ObjectCreation(msgPfx.Message, stmInfo.stateInspectorObjectId, remoteWebRTCStreamObjectType));
                    buffer.Enqueue(new ParentChildRelationChange(msgPfx.Message, stmInfo.stateInspectorObjectId, remoteWebRTCStreamObjectType, loggableId));
                }
                Action <string, string, Dictionary <string, RemoteWebRTCStreamInfo.TrackInfo> > handleList = (list, modalityName, dict) =>
                {
                    HashSet <string> newTrackIds =
                        remoteMediaStreamReceivedTrackRegex
                        .Matches(list)
                        .OfType <Match>()
                        .Select(x => x.Groups["id"].Value)
                        .ToHashSet();
                    bool changed = false;
                    foreach (var newTrackId in newTrackIds.Except(dict.Keys.ToArray()))
                    {
                        dict[newTrackId] = new RemoteWebRTCStreamInfo.TrackInfo()
                        {
                            added = msgPfx.Message
                        };
                        changed = true;
                    }
                    foreach (var knownTrack in dict.Where(t => t.Value.removed == null).ToArray())
                    {
                        if (!newTrackIds.Contains(knownTrack.Key))
                        {
                            dict[knownTrack.Key].removed = msgPfx.Message;
                            changed = true;
                        }
                    }
                    if (changed)
                    {
                        buffer.Enqueue(new PropertyChange(
                                           msgPfx.Message, stmInfo.stateInspectorObjectId, remoteWebRTCStreamObjectType,
                                           modalityName + " WebRTC track ids", list));
                    }
                };
                handleList(a, "audio", stmInfo.audioWebRtcTracks);
                handleList(v, "video", stmInfo.videoWebRtcTracks);
                return(stmInfo);
            };

            Match m;

            if ((m = remoteMediaStreamReceivedRegex.Match(msgPfx.Message.Text)).Success)
            {
                handleChange(m.Groups["streamId"].Value,
                             m.Groups["audioTracks"].Value, m.Groups["videoTracks"].Value, true);
            }
            else if ((m = remoteMediaStreamRemovedRegex.Match(msgPfx.Message.Text)).Success)
            {
                var stmInfo = handleChange(m.Groups["streamId"].Value, "", "", false);
                if (stmInfo != null)
                {
                    buffer.Enqueue(new ObjectDeletion(
                                       msgPfx.Message, stmInfo.stateInspectorObjectId, remoteWebRTCStreamObjectType));
                    stmInfo.deleted = true;
                }
            }
            else if (msgPfx.Message.Text == "disposed")
            {
                buffer.Enqueue(new ObjectDeletion(
                                   msgPfx.Message, loggableId, remoteMediaObjectType));
                foreach (var sessionStreams in remoteWebRtcStreamIdToInfo.Values)
                {
                    foreach (var stmInfo in sessionStreams.Values.Where(
                                 stm => !stm.deleted && stm.remoteMediaId == loggableId))
                    {
                        buffer.Enqueue(new ObjectDeletion(
                                           msgPfx.Message, stmInfo.stateInspectorObjectId, remoteWebRTCStreamObjectType));
                        stmInfo.deleted = true;
                    }
                }
            }
        }