Exemplo n.º 1
0
 private void Cleanup()
 {
     _session?.Dispose();
     _framePool?.Dispose();
     _swapChain?.Dispose();
     _d3dDevice?.Dispose();
 }
Exemplo n.º 2
0
 public void Dispose()
 {
     __session?.Dispose();
     __framePool?.Dispose();
     __swapChain?.Dispose();
     __d3dDevice?.Dispose();
 }
Exemplo n.º 3
0
 public void StopRecord()
 {
     field = null;
     framePool.Dispose();
     canvasDevice.Dispose();
     session.Dispose();
 }
 public void Dispose()
 {
     session?.Dispose();
     framePool?.Dispose();
     swapChain?.Dispose();
     d3dDevice?.Dispose();
 }
Exemplo n.º 5
0
        private async void _onFrameArraved()
        {
            TimeSpan _lastTimeStamp = _startTime;

            while (_capturing)
            {
                QueryPerformanceCounter(out long start);
                using (var frame = _framePool.TryGetNextFrame())
                {
                    if (frame == null)
                    {
                        continue;
                    }
                    using (var bitmap = await SoftwareBitmap.CreateCopyFromSurfaceAsync(frame.Surface, BitmapAlphaMode.Premultiplied))
                    {
                        _processBitmap(bitmap, frame.SystemRelativeTime - _lastTimeStamp);
                        _lastTimeStamp = frame.SystemRelativeTime;
                    }
                }
                QueryPerformanceCounter(out long end);
                var spendTime = TimeSpan.FromTicks(end - start);
                if (spendTime < TimeSpan.FromMilliseconds(41))
                {
                    await Task.Delay((TimeSpan.FromMilliseconds(41) - spendTime).Milliseconds);
                }
            }
            _seesion.Dispose();
            _framePool.Dispose();
            _mediaEncoder.CloseVideoWriter();
        }
Exemplo n.º 6
0
 public void Stop()
 {
     _captureItem = null;
     _framePool.Dispose();
     _framePool = null;
     _session.Dispose();
     _session = null;
 }
Exemplo n.º 7
0
 private void Cleanup()
 {
     _framePool?.Dispose();
     _session?.Dispose();
     if (_captureItem != null)
     {
         _captureItem.Closed -= OnClosed;
     }
     _captureItem = null;
     _device      = null;
     _d3dDevice   = null;
     _composeTexture?.Dispose();
     _composeTexture = null;
     _composeRenderTargetView?.Dispose();
     _composeRenderTargetView = null;
     _currentFrame?.Dispose();
 }
Exemplo n.º 8
0
 public void StopCapture()
 {
     _session?.Dispose();
     _framePool?.Dispose();
     _item      = null;
     _session   = null;
     _framePool = null;
 }
 public void StopCapture() // ...or release resources
 {
     _captureSession?.Dispose();
     _captureFramePool?.Dispose();
     _captureSession   = null;
     _captureFramePool = null;
     _captureItem      = null;
     IsCapturing       = false;
 }
Exemplo n.º 10
0
        public void Dispose()
        {
            _session?.Dispose();
            _framePool?.Dispose();
            _swapChain?.Dispose();

            _swapChain = null;
            _framePool = null;
            _session   = null;
            _item      = null;
        }
Exemplo n.º 11
0
 public void Dispose()
 {
     _disposing = true;
     _device?.Dispose();
     _sender?.Dispose();
     _session?.Dispose();
     _framePool?.Dispose();
     _d3dDevice?.Dispose();
     _factory?.Dispose();
     _ndiSender?.Abort();
 }
Exemplo n.º 12
0
 public void StopCapture()
 {
     foreach (var clip in ClipImages.Values)
     {
         clip.Stop();
     }
     renderTarget?.Dispose();
     _session?.Dispose();
     _framePool?.Dispose();
     _item        = null;
     _session     = null;
     _framePool   = null;
     renderTarget = null;
 }
Exemplo n.º 13
0
        public void cleanUpCam()
        {
            session?.Dispose();
            framePool?.Dispose();
            currentFrame?.Dispose();
            canvasDevice?.Dispose();

            session      = null;
            framePool    = null;
            currentFrame = null;

            canvasDevice = null;
            gcitem       = null;
        }
        public void cleanUpCam()
        {
            session?.Dispose();
            framePool?.Dispose();
            currentFrame?.Dispose();
            canvasDevice?.Dispose();

            session      = null;
            framePool    = null;
            currentFrame = null;

            canvasDevice = null;
            //gcitem = null; //cannot set to null until app has finished encoding
        }
Exemplo n.º 15
0
 public void StopCapture()
 {
     _session?.Dispose();
     _framePool?.Dispose();
     _item      = null;
     _session   = null;
     _framePool = null;
     for (int i = 0; i < lnd.Len * 3; i++)
     {
         res[i] = 0;
     }
     SendToA();
     IsRunning = false;
 }
Exemplo n.º 16
0
        private void DisposeCaptureItemDependentStuff()
        {
            if (_framePool != null)
            {
                _framePool.FrameArrived -= OnFrameArrived;
                _framePool.Dispose();
            }

            if (_session != null)
            {
                _session.Dispose();
            }

            if (_swapChain != null)
            {
                _swapChain.Dispose();
            }
        }
Exemplo n.º 17
0
        private async void CaptureStop_Click(object sender, RoutedEventArgs e)
        {
            _session.Dispose();
            _franePool.Dispose();

            _audioGraph?.Stop();
            if (_audioFile != null)
            {
                var audioTrack = await BackgroundAudioTrack.CreateFromFileAsync(_audioFile);

                mediaComposition.BackgroundAudioTracks.Add(audioTrack);
            }

            //await CreateClipFromImageFile();

            UpdateSource();

            btnCaptureStop.Visibility  = Visibility.Collapsed;
            btnCaptureStart.Visibility = Visibility.Visible;
        }
        public void Dispose()
        {
            _screenTexture?.Dispose();

            ScreenCaptureManager.Instance.MainThreadExecutor.Execute(() =>
            {
                _session?.Dispose();
                _session = null;
                if (_framePool != null)
                {
                    _framePool.FrameArrived -= OnFrameArrived;
                    _framePool.Dispose();
                    _framePool = null;
                }
                _d3dDevice?.Dispose();
                _d3dDevice = null;
                _device?.Dispose();
                _device = null;
                _frameAvailable.Dispose();
            }, false);
        }
Exemplo n.º 19
0
        public void StopCaptureInternal()
        {
            Logger.Debug("Screen", "StopCaptureInternal");

            if (item != null)
            {
                framePool.FrameArrived -= FramePool_FrameArrived;
            }

            if (null != screenCaptureTask)
            {
                screenCaptureQueue.Add(null);
                screenCaptureTask.Wait();
                screenCaptureTask = null;
            }

            session?.Dispose();
            framePool?.Dispose();
            item      = null;
            session   = null;
            framePool = null;
        }
Exemplo n.º 20
0
        private void CleanupSessionResources()
        {
            if (framePool != null)
            {
                framePool.FrameArrived -= OnFrameArrived;
                framePool.Dispose();
            }

            framePool = null !;

            session?.Dispose();
            session = null !;

            if (item != null)
            {
                item.Closed -= OnClosed;
            }

            item = null !;
            blankTexture?.Dispose();
            blankTexture = null !;
            currentFrame?.Dispose();
            currentFrame = null !;
        }
Exemplo n.º 21
0
 public void Dispose()
 {
     _session?.Dispose();
     _framePool?.Dispose();
     _d3dDevice?.Dispose();
 }