Пример #1
0
        override public void Dispose()
        {
            lock (oLockDispose)
            {
                if (bDisposed)
                {
                    return;
                }
                bDisposed = true;
            }
            try
            {
                if (null != _cCard)
                {
                    _cCard.Dispose();
                }
                if (null != _aCurrentFramesIDs)
                {
                    _aCurrentFramesIDs.Clear();
                }
            }
            catch (Exception ex)
            {
                (new Logger("Aja", sName)).WriteError(ex);
            }
            try
            {
                if (null != _cAudioBuffer)
                {
                    _cAudioBuffer.Dispose();
                }

                if (_AjaFramesAudioBuffer.nCount > 0)
                {
                    _AjaFramesAudioBuffer.Dequeue().Dispose();
                }
                if (_AjaFramesAudioToDispose.nCount > 0)
                {
                    _AjaFramesAudioToDispose.Dequeue().Dispose();
                }
                if (_AjaFramesVideoBuffer.nCount > 0)
                {
                    FrameBufferReleased(_AjaFramesVideoBuffer.Dequeue()); //TODO - not disposed in device...
                }
                if (_AjaFramesVideoToDispose.nCount > 0)
                {
                    FrameBufferReleased(_AjaFramesVideoToDispose.Dequeue());
                }

                base.Dispose();
            }
            catch (Exception ex)
            {
                (new Logger("Aja", sName)).WriteError(ex);
            }
        }
Пример #2
0
        static private void WorkerEvents()
        {
            Tuple <EventDelegate, Effect> cEvent;

            Logger.Timings cTimings = new Logger.Timings("effect_WorkerEvents");
            while (true)
            {
                try
                {
                    cEvent = _aqEvents.Dequeue();
                    cTimings.TotalRenew();
                    cEvent.Item1(cEvent.Item2);
                    (new Logger()).WriteDebug3("event sent e [hc = " + cEvent.Item2.nID + "][" + cEvent.Item1.Method.Name + "][events_queue=" + _aqEvents.nCount + "]");
                    //GC.Collect
                    cTimings.Stop("work too long", "", 5);
                }
                catch (System.Threading.ThreadAbortException)
                {
                    break;
                }
                catch (Exception ex)
                {
                    (new Logger()).WriteError(ex);
                }
            }
        }
Пример #3
0
        static private void WorkerEvents()
        {
            Tuple <EventDelegate, IPlugin> cEvent;

            System.Diagnostics.Stopwatch cWatch = new System.Diagnostics.Stopwatch();
            while (true)
            {
                try
                {
                    cEvent = _aqEvents.Dequeue();

                    cWatch.Reset();
                    cWatch.Restart();
                    cEvent.Item1(cEvent.Item2);
                    cWatch.Stop();
                    if (40 < cWatch.ElapsedMilliseconds)
                    {
                        (new Logger()).WriteDebug3("duration: " + cWatch.ElapsedMilliseconds + " queue: " + _aqEvents.nCount);
                    }
                    if (0 < _aqEvents.nCount)
                    {
                        (new Logger()).WriteDebug3(" queue: " + _aqEvents.nCount);
                    }
                }
                catch (System.Threading.ThreadAbortException)
                {
                    break;
                }
                catch (Exception ex)
                {
                    (new Logger()).WriteError(ex);
                }
            }
        }