//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        //ORIGINAL LINE: @Override public AudioFrame provide(long timeout, TimeUnit unit) throws TimeoutException, InterruptedException
        public AudioFrame provide(long timeout, TimeUnit unit)
        {
            AudioFrame frame = frameBuffer.provide(timeout, unit);

            processProvidedFrame(frame);
            return(frame);
        }
示例#2
0
        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        //ORIGINAL LINE: @Override public AudioFrame provide(long timeout, TimeUnit unit) throws TimeoutException, InterruptedException
        public AudioFrame provide(long timeout, TimeUnit unit)
        {
            AudioFrame frame = Poll(_audioFrames);

            if (frame == null)
            {
                AudioFrame terminator = fetchPendingTerminator();
                if (terminator != null)
                {
                    return(terminator);
                }

                if (timeout > 0)
                {
                    frame      = Poll(_audioFrames, timeout, unit);
                    terminator = fetchPendingTerminator();

                    if (terminator != null)
                    {
                        return(terminator);
                    }
                }
            }

            return(filterFrame(frame));
        }
        public AudioFrame provide()
        {
            AudioFrame frame = frameBuffer.provide();

            processProvidedFrame(frame);
            return(frame);
        }
示例#4
0
        public AudioFrame Poll(BlockingCollection <AudioFrame> audioFrame)
        {
            AudioFrame returnVal = audioFrame.FirstOrDefault <AudioFrame>();

            audioFrame.TryTake(out returnVal);
            return(returnVal);
        }
示例#5
0
        private AudioFrame filterFrame(AudioFrame frame)
        {
            if (frame != null && frame.volume == 0)
            {
                return(new AudioFrame(frame.timecode, format.silence, 0, format));
            }

            return(frame);
        }
示例#6
0
        public AudioFrame Poll(BlockingCollection <AudioFrame> audioFrame, long timeout, TimeUnit unit)
        {
            AudioFrame returnVal = audioFrame.FirstOrDefault <AudioFrame>();

            audioFrame.TryTake(out returnVal);
            return(returnVal);

            unit.wait(timeout);
            return(null);
        }
示例#7
0
        public AudioFrame provide()
        {
            AudioFrame frame = Poll(_audioFrames);

            if (frame == null)
            {
                return(fetchPendingTerminator());
            }

            return(filterFrame(frame));
        }
        private void processProvidedFrame(AudioFrame frame)
        {
            if (frame != null && !frame.Terminator)
            {
                if (!PerformingSeek)
                {
                    markerTracker.checkPlaybackTimecode(frame.timecode);
                }

                lastFrameTimecode.set(frame.timecode);
            }
        }
示例#9
0
        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        //ORIGINAL LINE: @Override public void consume(AudioFrame frame) throws InterruptedException
        public void consume(AudioFrame frame)
        {
            // If an interrupt sent along with setting the stopping status was silently consumed elsewhere, this check should
            // still trigger. Guarantees that stopped tracks cannot get stuck in this method. Possible performance improvement:
            // offer with timeout, check stopping if timed out, then put?
            if (stopping != null && stopping.get())
            {
                throw new InterruptedException();
            }

            if (!locked)
            {
                receivedFrames = true;

                if (clearOnInsert)
                {
                    Clear <AudioFrame>(_audioFrames);
                    clearOnInsert = false;
                }

                _audioFrames.Add(frame);
            }
        }