Stop() 공개 메소드

Stops this instance.
public Stop ( ) : void
리턴 void
예제 #1
0
        public void Stop()
        {
            Rtsp.Messages.RtspRequest teardown_message = new Rtsp.Messages.RtspRequestTeardown();
            teardown_message.RtspUri = new Uri(url);
            teardown_message.Session = session;
            if (rtsp_client != null)
            {
                rtsp_client.SendMessage(teardown_message);
            }

            // clear up any UDP sockets
            if (udp_pair != null)
            {
                udp_pair.Stop();
            }

            // Stop the keepalive timer
            if (keepalive_timer != null)
            {
                keepalive_timer.Stop();
            }

            // Drop the RTSP session
            if (rtsp_client != null)
            {
                rtsp_client.Stop();
            }
        }
예제 #2
0
파일: RtspServer.cs 프로젝트: memedude56/rt
 protected void Dispose(bool managed)
 {
     if (!managed)
     {
         return;
     }
     foreach (var s in sessions)
     {
         s.Close();
     }
     listener?.Stop();
     listener?.Dispose();
 }
예제 #3
0
        private void ProcessTeardownResponse()
        {
            if (_rtpRtspCts == null || _rtpRtspCts.IsCancellationRequested == true)
            {
                return;
            }

            Logger.Info("");

            _rtpRtspCts.Cancel();

            if (_currentState != State.Idle)
            {
                rtspListener.Stop();
                udpSocketPair?.Stop();
                _currentState = State.Idle;
            }

            rtspSession = null;

            chunkReadySubject.OnCompleted();
            rtspErrorSubject.OnCompleted();
        }
예제 #4
0
        public void CloseConnection(string reason)
        {
            _logger.Info($"Connection {Id} closing. Reason: {reason}, _audioUdpPair.DataPort={_audioUdpPair?._dataPort}, _videoUdpPair.DataPort={_videoUdpPair?._dataPort}");
            try
            {
                Play = false; // stop sending data
                if (_audioUdpPair != null)
                {
                    ReleaseUDPSocket(_audioUdpPair);
                    _audioUdpPair = null;
                }

                if (_videoUdpPair != null)
                {
                    ReleaseUDPSocket(_videoUdpPair);
                    _videoUdpPair = null;
                }

                _logger.Info($"Connection {Id} closed. Reason: {reason}");
                _listener.MessageReceived       -= RTSP_Message_Received;
                _listener.SocketExceptionRaised -= RTSP_SocketException_Raised;
                _listener.Disconnected          -= RTSP_Disconnected;
                _listener.Stop();

                _listener.Dispose();
            }
            catch (Exception ex)
            {
                _logger.Warn($"{Id} error closing connection: {ex}");
            }
            finally
            {
                var handler = OnConnectionRemoved;
                handler?.Invoke(Id, _videoSource);
            }
        }