Ejemplo n.º 1
0
        /// <summary>
        /// Video Receiver
        /// </summary>
        /// <param name="ptr"></param>
        internal VideoStreamTrack(IntPtr ptr) : base(ptr)
        {
            if (!s_tracks.TryAdd(self, new WeakReference <VideoStreamTrack>(this)))
            {
                throw new InvalidOperationException();
            }

            m_renderer = new UnityVideoRenderer(this, true);
        }
Ejemplo n.º 2
0
        public UnityEngine.RenderTexture InitializeReceiver(int width, int height)
        {
            if (IsDecoderInitialized)
            {
                throw new InvalidOperationException("Already initialized receiver");
            }

            m_needFlip = true;
            var format = WebRTC.GetSupportedRenderTextureFormat(UnityEngine.SystemInfo.graphicsDeviceType);

            m_sourceTexture = CreateRenderTexture(width, height, format);
            m_destTexture   = CreateRenderTexture(m_sourceTexture.width, m_sourceTexture.height, format);

            m_renderer = new UnityVideoRenderer(WebRTC.Context.CreateVideoRenderer(), this);

            return(m_destTexture);
        }
        public Texture InitializeReceiver(int width, int height)
        {
            if (IsDecoderInitialized)
            {
                throw new InvalidOperationException("Already initialized receiver, use Texture property");
            }

            m_needFlip = true;
            var format = WebRTC.GetSupportedGraphicsFormat(SystemInfo.graphicsDeviceType);

            m_sourceTexture = new Texture2D(width, height, format, TextureCreationFlags.None);
            var renderTextureFormat = WebRTC.GetSupportedGraphicsFormat(SystemInfo.graphicsDeviceType);

            m_destTexture = CreateRenderTexture(m_sourceTexture.width, m_sourceTexture.height, renderTextureFormat);

            m_renderer = new UnityVideoRenderer(WebRTC.Context.CreateVideoRenderer(), this);

            return(m_destTexture);
        }