예제 #1
0
        private void DisposeAudioDecoder(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            if (disposing)
            {
                _initialized = false;
                if (_mediaCodec != null)
                {
                    _mediaCodec.Stop();
                    _mediaCodec.Release();
                    _mediaCodec.Dispose();
                }

                if (_audioTrack != null)
                {
                    _audioTrack.Stop();
                    _audioTrack.Release();
                }
            }

            _initialized = false;
            _disposed    = true;

            _encoderThread.Interrupt();
            _decoderThread.Interrupt();
        }
예제 #2
0
        public bool StopDecoder()
        {
            try
            {
                if (_mediaCodec != null)
                {
                    _mediaCodec.Stop();
                    _mediaCodec.Release();
                }

                if (_audioTrack != null)
                {
                    _audioTrack.Stop();
                    _audioTrack.Release();
                }

                _encoderThread?.Interrupt();
                _decoderThread?.Interrupt();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }