private void RegisterRemoteTextures()
        {
            if (_nativeVideo != null && _textureY != null)
            {
                TextureDesc[] textures = new TextureDesc[3]
                {
                    new TextureDesc
                    {
                        texture = _textureY.GetNativeTexturePtr(),
                        width   = _textureY.width,
                        height  = _textureY.height,
                    },
                    new TextureDesc
                    {
                        texture = _textureU.GetNativeTexturePtr(),
                        width   = _textureU.width,
                        height  = _textureU.height,
                    },
                    new TextureDesc
                    {
                        texture = _textureV.GetNativeTexturePtr(),
                        width   = _textureV.width,
                        height  = _textureV.height,
                    },
                };
#if WEBRTC_DEBUGGING
                Debug.Log(string.Format("RegisteringRemoteTextures: {0:X16}, {1:X16}, {2:X16}", textures[0].texture.ToInt64(), textures[1].texture.ToInt64(), textures[2].texture.ToInt64()));
#endif
                _nativeVideo.EnableRemoteVideo(VideoKind.I420, textures);
            }
        }
Пример #2
0
        /// <summary>
        /// Start rendering the passed source.
        /// </summary>
        /// <remarks>
        /// Can be used to handle <see cref="VideoTrackSource.VideoStreamStarted"/> or <see cref="VideoReceiver.VideoStreamStarted"/>.
        /// </remarks>
        public void StartRendering(IVideoSource source)
        {
            _source = source as RemoteVideoTrack;
            Debug.Assert(_source != null, "NativeVideoRender currently only supports RemoteVideoTack");

            switch (source.FrameEncoding)
            {
            case VideoEncoding.I420A:
                _nativeVideo = new NativeVideo(_source.NativeHandle);
                _nativeVideo.TextureSizeChanged += TextureSizeChangeCallback;
                _nativeVideo.EnableRemoteVideo(VideoKind.I420, null);
                break;

            case VideoEncoding.Argb32:
                break;
            }
        }