示例#1
0
 public void AdjustBitrate(uint bitrateInKbps)
 {
     if (isBoundToClient)
     {
         GL.IssuePluginEvent(onairvr_AdjustBitRate_RenderThread_Func(), AirVRServerPlugin.RenderEventArg((uint)playerID, bitrateInKbps));
     }
 }
示例#2
0
    internal void BindPlayer(int playerID)
    {
        Assert.IsFalse(isBoundToClient);
        Assert.IsNull(_config);

        this.playerID = playerID;
        _config       = AirVRServerPlugin.GetConfig(playerID);

        Assert.IsNotNull(_config);
    }
示例#3
0
    private void onAirVRMediaStreamStopped(AirVRServerMessage message)
    {
        onStopRender();
        disableCameras();

        _mediaStreamJustStopped = true; // StopCoroutine(_CallPluginEndOfFrame) executes the routine one more in the next frame after the call.
                                        // so use a flag to completely stop the routine.

        GL.IssuePluginEvent(onairvr_ResetStreams_RenderThread_Func(), AirVRServerPlugin.RenderEventArg((uint)playerID));

        inputStream.Stop();
    }
示例#4
0
    private void onAirVRMediaStreamInitialized(AirVRServerMessage message)
    {
        Assert.IsNull(mediaStream);

        initializeCamerasForMediaStream();
        onairvr_SendCameraClipPlanes(playerID, cameras[0].nearClipPlane, cameras[0].farClipPlane);

        mediaStream = new AirVRServerMediaStream(playerID, _config, cameras.Length);
        GL.IssuePluginEvent(onairvr_InitStreams_RenderThread_Func(), AirVRServerPlugin.RenderEventArg((uint)playerID));

        inputStream.Init();
    }
示例#5
0
    private void onAirVRMediaStreamCleanedUp(AirVRServerMessage message)
    {
        Assert.IsTrue(_mediaStreamJustStopped);
        Assert.IsNotNull(mediaStream);

        inputStream.Cleanup();

        GL.IssuePluginEvent(onairvr_CleanupStreams_RenderThread_Func(), AirVRServerPlugin.RenderEventArg((uint)playerID));

        mediaStream.Destroy();
        mediaStream = null;

        foreach (Camera cam in cameras)
        {
            cam.targetTexture = null;
        }
    }
    private AirVRCameraRig notifyCameraRigWillBeBound(int playerID)
    {
        AirVRClientConfig config = AirVRServerPlugin.GetConfig(playerID);

        List <AirVRCameraRig> cameraRigs = new List <AirVRCameraRig>();

        _cameraRigList.GetAvailableCameraRigs(config.type, cameraRigs);

        AirVRCameraRig selected = null;

        if (Delegate != null)
        {
            Delegate.AirVRCameraRigWillBeBound(playerID, config, cameraRigs, out selected);
            AirVRServerPlugin.SetConfig(playerID, config);
        }
        else if (cameraRigs.Count > 0)
        {
            selected = cameraRigs[0];
        }
        return(selected);
    }
示例#7
0
    private IEnumerator CallPluginEndOfFrame()
    {
        yield return(new WaitForEndOfFrame());

        Assert.IsNotNull(mediaStream);
        GL.IssuePluginEvent(onairvr_EncodeVideoFrame_RenderThread_Func(), AirVRServerPlugin.RenderEventArg((uint)playerID, (uint)_viewNumber, (uint)mediaStream.currentFramebufferIndex));    // the first render event

        while (_mediaStreamJustStopped == false)
        {
            yield return(new WaitForEndOfFrame());

            if (_mediaStreamJustStopped)
            {
                yield break;
            }
            else if (_encodeVideoFrameRequested)
            {
                Assert.IsNotNull(mediaStream);

                GL.IssuePluginEvent(onairvr_EncodeVideoFrame_RenderThread_Func(), AirVRServerPlugin.RenderEventArg((uint)playerID, (uint)_viewNumber, (uint)mediaStream.currentFramebufferIndex));
                _encodeVideoFrameRequested = false;
            }
        }
    }