예제 #1
0
        /// <summary>
        /// Video Sender
        /// </summary>
        /// <param name="label"></param>
        /// <param name="source"></param>
        /// <param name="needFlip"></param>
        internal VideoStreamTrack(string label, VideoTrackSource source, bool needFlip)
            : base(WebRTC.Context.CreateVideoTrack(label, source.self))
        {
            if (!s_tracks.TryAdd(self, new WeakReference <VideoStreamTrack>(this)))
            {
                throw new InvalidOperationException();
            }

            m_needFlip = needFlip;
            m_source   = source;
        }
예제 #2
0
        internal VideoStreamTrack(Texture texture, RenderTexture dest, string label, VideoTrackSource source, bool needFlip)
            : base(WebRTC.Context.CreateVideoTrack(label, source.self))
        {
            var error = WebRTC.ValidateTextureSize(texture.width, texture.height, Application.platform);

            if (error.errorType != RTCErrorType.None)
            {
                throw new ArgumentException(error.message);
            }
            WebRTC.ValidateGraphicsFormat(texture.graphicsFormat);

            if (!s_tracks.TryAdd(self, new WeakReference <VideoStreamTrack>(this)))
            {
                throw new InvalidOperationException();
            }

            m_source = source;
            m_source.sourceTexture_ = texture;
            m_source.destTexture_   = dest;
            m_source.needFlip_      = needFlip;
        }
예제 #3
0
 internal VideoStreamTrack(string label, VideoTrackSource source)
     : this(WebRTC.Context.CreateVideoTrack(label, source.self))
 {
     _source = source;
 }