Beispiel #1
0
    void Start()
    {
        CallPCL.callStart();

        Parallel.For(0, VERTICES_MAX / 6, j => {
            indicesMax[6 * j + 0] = 6 * j + 0;
            indicesMax[6 * j + 1] = 6 * j + 1;
            indicesMax[6 * j + 2] = 6 * j + 2;
            indicesMax[6 * j + 3] = 6 * j + 3;
            indicesMax[6 * j + 4] = 6 * j + 4;
            indicesMax[6 * j + 5] = 6 * j + 5;
            trisMax[12 * j + 0]   = 6 * j + 0;
            trisMax[12 * j + 1]   = 6 * j + 5;
            trisMax[12 * j + 2]   = 6 * j + 3;
            trisMax[12 * j + 3]   = 6 * j + 3;
            trisMax[12 * j + 4]   = 6 * j + 4;
            trisMax[12 * j + 5]   = 6 * j + 1;
            trisMax[12 * j + 6]   = 6 * j + 5;
            trisMax[12 * j + 7]   = 6 * j + 2;
            trisMax[12 * j + 8]   = 6 * j + 4;
            trisMax[12 * j + 9]   = 6 * j + 3;
            trisMax[12 * j + 10]  = 6 * j + 5;
            trisMax[12 * j + 11]  = 6 * j + 4;
        });

        thread = new Thread(subThread);
        thread.Start();
    }
Beispiel #2
0
        public void OnCall(CallArgs e)
        {
            StateOfCurrentCall = e.CallState;
            CurrentCall        = e.LCall;
            Debug.WriteLine("Call state changed: " + StateOfCurrentCall);

            call_status.Text = "Call state changed: " + StateOfCurrentCall;

            if (StateOfCurrentCall == CallStatePCL.IncomingReceived)
            {
                var page = new OnCallPage();
                page.RefuseCall += (s, args) =>
                {
                    LinphoneManager.TerminateAllCalls();
                };

                page.AcceptCall += (s, args) =>
                {
                    LinphoneManager.AcceptCall();
                };

                page.SetVideoView(CurrentCall, LinphoneManager);

                Navigation.PushAsync(page);
            }
            else if (StateOfCurrentCall == CallStatePCL.IncomingEarlyMedia)
            {
            }
            else if (StateOfCurrentCall == CallStatePCL.StreamsRunning)
            {
                if (isOutgoingCall)
                {
                    call.Text = "Terminate";
                    if (!CurrentCall.IsVideoEnabled)
                    {
                        LinphoneManager.SetViewCallOutgoing(CurrentCall);
                    }
                }
            }
            else if (StateOfCurrentCall == CallStatePCL.Error || StateOfCurrentCall == CallStatePCL.End)
            {
                call.Text = "Start Call";

                var stack = Navigation.NavigationStack; // remove on call page
                if (stack != null && stack.Count == 2)
                {
                    Navigation.PopAsync();
                }
                if (isOutgoingCall)
                {
                    isOutgoingCall             = false;
                    contentViewVideo.IsVisible = false;
                    contentViewVideo.Content   = null;
                }
            }
        }
Beispiel #3
0
 void OnDestroy()
 {
     thread.Abort();
     while (thread.IsAlive)
     {
         Thread.Sleep(1);
     }
     CallPCL.callStop();
     Debug.Log("Stop");
 }
Beispiel #4
0
 void Update()
 {
     CallPCL.getMesh(ref meshList, verticesMax);
     Generate();
     if (Input.GetKey(KeyCode.R))
     {
         CallPCL.callRegistration();
     }
     if (Input.GetKey(KeyCode.B))
     {
         CallPCL.callSetBackground();
     }
     if (Input.GetKey(KeyCode.S))
     {
         CallPCL.callSaveScene();
     }
 }
Beispiel #5
0
        private void OnCall(Core lc, Call lcall, CallState state, string message)
        {
            try
            {
                if (state == CallState.End || state == CallState.Error)
                {
                    LastCall = null;
                }
                if ((state == CallState.IncomingReceived || state == CallState.OutgoingInit) && LastCall != null)
                {
                    linphoneCore.TerminateCall(LastCall);
                    LastCall = null;
                }

                if ((state == CallState.IncomingReceived || state == CallState.OutgoingInit) && LastCall == null)
                {
                    LastCall = lcall;
                }

                CallPCL call = new CallPCL
                {
                    UsernameCaller = lcall.RemoteAddress.Username
                };
                CallParams param = linphoneCore.CreateCallParams(lcall);

                lock (LinphoneListeners)
                {
                    for (int i = 0; i < LinphoneListeners.Count; i++)
                    {
                        try
                        {
                            var listener = LinphoneListeners[i];
                            listener.OnCall(new CallArgs(call, (int)state, message, param.VideoEnabled));
                        }
                        catch (Exception ex)
                        {
                            Log("error with listenner, OnCall");
                        }
                    }
                }
            }
            catch (Exception ex) { }
        }
Beispiel #6
0
 void subThread()
 {
     while (true)
     {
         CallPCL.kernelUpdate();
         Voice.startTiming();
         if (turn == 0)
         {
             CallPCL.getMesh(ref meshList0, VERTICES_MAX);
             meshList = meshList0;
             turn     = 1;
         }
         else
         {
             CallPCL.getMesh(ref meshList1, VERTICES_MAX);
             meshList = meshList1;
             turn     = 0;
         }
         ShowFPS.udpateFrame();
     }
 }
Beispiel #7
0
 public void SetViewCallOutgoing(CallPCL call)
 {
     if (linphoneCore.CallsNb > 0)
     {
         Call currentCall = linphoneCore.Calls.Where(lcall => lcall.RemoteAddress.Username == call.UsernameCaller).FirstOrDefault();
         if (currentCall != null)
         {
             linphoneCore.VideoDisplayEnabled          = true;
             linphoneCore.VideoAdaptiveJittcompEnabled = true;
             CallParams param = linphoneCore.CreateCallParams(currentCall);
             param.VideoEnabled   = true;
             param.VideoDirection = MediaDirection.RecvOnly;
             param.AudioDirection = MediaDirection.SendRecv;
             linphoneCore.UpdateCall(currentCall, param);
         }
         else
         {
             Log($"SetViewCallOutgoing()_Android, call from: {call.UsernameCaller} is not call in linphoneCore");
         }
         //lc.UpdateCall(call, param);
     }
 }
Beispiel #8
0
 void OnDestroy()
 {
     CallPCL.callStop();
 }
Beispiel #9
0
 void Start()
 {
     CallPCL.callStart();
 }
Beispiel #10
0
 public void SetViewCallOutgoing(CallPCL call)
 {
     LinphoneEngine.SetViewCallOutgoing(call);
 }
Beispiel #11
0
 public void SetViewCall(CallPCL call)
 {
     LinphoneEngine.SetViewCall(call);
 }
Beispiel #12
0
 public void SetVideoView(CallPCL call, ILinphoneManager linphone)
 {
     contentViewVideo.IsVisible = true;
     contentViewVideo.Content   = new LinphoneVideoView();
     linphone.SetViewCall(call);
 }