\doxysection{com.\+tritondigital.\+net.\+streaming.\+proxy.\+server.\+rtsp.\+Rtsp\+Server Class Reference}
\hypertarget{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1rtsp_1_1RtspServer}{}\label{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1rtsp_1_1RtspServer}\index{com.tritondigital.net.streaming.proxy.server.rtsp.RtspServer@{com.tritondigital.net.streaming.proxy.server.rtsp.RtspServer}}
Inheritance diagram for com.\+tritondigital.\+net.\+streaming.\+proxy.\+server.\+rtsp.\+Rtsp\+Server\+:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=2.000000cm]{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1rtsp_1_1RtspServer}
\end{center}
\end{figure}
\doxysubsubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1rtsp_1_1RtspServer_a9ebee3a83d19282d61349093c62059a6}{Rtsp\+Server}} ()
\begin{DoxyCompactList}\small\item\em Constructs a RTSP Server that streams the data from the given provider. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1rtsp_1_1RtspServer_af8ab7d858923fbe7cc4a0faf8aada55a}{bind\+And\+Listen}} (final int port)
\item 
URI \mbox{\hyperlink{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1rtsp_1_1RtspServer_a4fba601e1329879e4362320bca572f95}{get\+Uri}} ()
\item 
void \mbox{\hyperlink{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1rtsp_1_1RtspServer_ad079a99fb70e867a30f3bcdff83eae72}{set\+Data\+Provider}} (Data\+Provider rtp\+Packet\+Provider)
\begin{DoxyCompactList}\small\item\em Sets the RTSP Server to streams the data from the given provider. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Public Member Functions inherited from \mbox{\hyperlink{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1Server}{com.\+tritondigital.\+net.\+streaming.\+proxy.\+server.\+Server}}}
\begin{DoxyCompactItemize}
\item 
void \mbox{\hyperlink{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1Server_ae8db3873d9eb41d642b7e1e695e38bfc}{listen}} (int port)
\begin{DoxyCompactList}\small\item\em Starts listening and accepting connections on the given port. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1Server_aa7a7241d0ac7c44f2faeade1d2779b9f}{stop}} ()
\begin{DoxyCompactList}\small\item\em Stops the server. \end{DoxyCompactList}\item 
boolean \mbox{\hyperlink{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1Server_a5d97bdce69a5aa3a79c7393bcf85215f}{block\+Until\+Ready}} ()
\item 
void {\bfseries stop\+Blocking\+Until\+Ready} ()
\begin{DoxyCompactList}\small\item\em Unblock the thread waiting on a call to block\+Until\+Ready. \end{DoxyCompactList}\item 
void {\bfseries set\+State\+Changed\+Listener} (\mbox{\hyperlink{interfacecom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1Server_1_1StateChangedListener}{State\+Changed\+Listener}} state\+Changed\+Listener)
\begin{DoxyCompactList}\small\item\em Sets the listener to be notified about the various state change on the server. \end{DoxyCompactList}\item 
\mbox{\hyperlink{enumcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1Server_1_1State}{State}} {\bfseries get\+State} ()
\begin{DoxyCompactList}\small\item\em Gets the current state of the server. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsubsection*{Static Public Attributes}
\begin{DoxyCompactItemize}
\item 
\Hypertarget{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1rtsp_1_1RtspServer_a064211d622d5425e8c27fc7c55ff599a}\label{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1rtsp_1_1RtspServer_a064211d622d5425e8c27fc7c55ff599a} 
static final String {\bfseries SERVER\+\_\+\+NAME} = "{}Triton Digital RTSP Proxy"{}
\end{DoxyCompactItemize}
\doxysubsubsection*{Protected Member Functions}
\begin{DoxyCompactItemize}
\item 
void \mbox{\hyperlink{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1rtsp_1_1RtspServer_a5a47106cab3145a101635fe9fd11931c}{disconnect\+And\+Unbind}} ()
\item 
void \mbox{\hyperlink{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1rtsp_1_1RtspServer_a0efdcbec8e26c5e4a3401d75a4d7d63c}{on\+Process\+Message}} (Object user\+Info)
\end{DoxyCompactItemize}
\doxysubsection*{Protected Member Functions inherited from \mbox{\hyperlink{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1Server}{com.\+tritondigital.\+net.\+streaming.\+proxy.\+server.\+Server}}}
\begin{DoxyCompactItemize}
\item 
void \mbox{\hyperlink{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1Server_a885045fad07e6c0720f915a4ebaa24b4}{on\+Connected}} ()
\begin{DoxyCompactList}\small\item\em Called when the child class accepts a connection. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1Server_a8ab3706180ba9430b836221ee03a2efa}{on\+Disconnected}} ()
\begin{DoxyCompactList}\small\item\em Called when the child class disconnected. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1Server_a563494b875cba3c8cec7da487227db0e}{on\+Error}} (Error\+Detail error\+Detail)
\begin{DoxyCompactList}\small\item\em Called when the child class encounters an error. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1Server_a8dfcd48c3da623f89c41b3da190685b8}{on\+Message\+Received}} (Object user\+Info)
\begin{DoxyCompactList}\small\item\em Called when the child class receives data. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1Server_a0e9cba38c009f83f1e1112d3e157f49f}{set\+State\+Not\+Ready}} ()
\begin{DoxyCompactList}\small\item\em Sets the internal state to not ready state and notify listener about it. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1Server_ad4566ec1b00a1bde8a343bc71e723dd4}{set\+State\+Ready}} ()
\begin{DoxyCompactList}\small\item\em Sets the internal state to ready state and notify listener about it. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1Server_a4f705f88274c5619a98bd56eb1fcd701}{set\+State\+Listening}} ()
\begin{DoxyCompactList}\small\item\em Sets the internal state to listening state and notify listener about it. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1Server_a6435d16c082d6518f11473720e2eb44f}{set\+State\+Connected}} ()
\begin{DoxyCompactList}\small\item\em Sets the internal state to connected state and notify listener about it. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1Server_ab156a0ada638e89f94d35f457ba1a252}{set\+State\+Stopping}} ()
\begin{DoxyCompactList}\small\item\em Sets the internal state to stopping state and notify listener about it. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1Server_a272fe8f787f6f7e50551245c26b2cb55}{set\+State\+Error}} (Error\+Detail error\+Detail)
\begin{DoxyCompactList}\small\item\em Sets the internal state to error state and notify listener about it. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsubsection*{Additional Inherited Members}
\doxysubsection*{Public Attributes inherited from \mbox{\hyperlink{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1Server}{com.\+tritondigital.\+net.\+streaming.\+proxy.\+server.\+Server}}}
\begin{DoxyCompactItemize}
\item 
final String {\bfseries TAG} = "{}Server"{}
\end{DoxyCompactItemize}
\doxysubsection*{Static Protected Attributes inherited from \mbox{\hyperlink{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1Server}{com.\+tritondigital.\+net.\+streaming.\+proxy.\+server.\+Server}}}
\begin{DoxyCompactItemize}
\item 
static final String {\bfseries LOCALHOST} = "{}127.\+0.\+0.\+1"{}
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Implementation of a Server that responds to Rtsp requests. The Server uses a socket to listen and negotiate the connection. It then streams using the already established TCP connection, or by sending UDP datagrams.

The RTSP contains the minimum to simply start streaming, based on the RFC 2326 (\href{http://www.ietf.org/rfc/rfc2326.txt}{\texttt{ http\+://www.\+ietf.\+org/rfc/rfc2326.\+txt}}). It responds to OPTIONS, DESCRIBE with the minimal SDP information, SETUP and PLAY. RTCP messages are ignored when received, and never generated. They are not needed for the type of work that the proxy does. If needed, they would be added later on.

It supports streaming RTP Packets through UDP or through TCP using interleaved mode. It is also possible to force the use of TCP by returning an UNSUPPORTED\+\_\+\+TRANSPORT message to a SETUP request with UDP ports. This works only if the client supports it. A client typically tries to SETUP using UDP, then TCP if UDP is not supported.

In the case of this server, used in a proxy, there are no chances of packets loss or misorder, so UDP is more efficient. However, for debugging purposes, it might be easier to monitor all the data (RTSP negociation + RTP Packets Stream) in a single connection. For this reason, it is supported to force RTP over TCP. This should typically used only for debugging.

The server listens and accepts a connection, the uses blocking sockets to read the requests. To be able to use a Buffered\+Reader, the data that is read from the non-\/blocking socket is pushed in the Queue\+Input\+Stream, on which the Buffered\+Reader reads. The read blocks until new data is read from the socket and pushed in the Queue\+Input\+Stream. This adds a new thread, but it simplifies the code and allows interrupting the reads.

Streaming works by having a background thread that continuously loops and get a packet from the packet provider and send this packet using the appropriate transport. If there are no packet ready, the thread blocks due to the provider blocking until a packet is available.

Therefore, this server uses 3 threads. One for the server (accept the connection, read from the non-\/blocking socket and push the new data in the Queue\+Input\+Stream), one for the Rtsp Request Reception (reads from the Queue\+Input\+Stream, process the received request and blocks when no more data to read) and one for the Rtp packets transfer (blocks when no packets available). 

\doxysubsection{Constructor \& Destructor Documentation}
\Hypertarget{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1rtsp_1_1RtspServer_a9ebee3a83d19282d61349093c62059a6}\label{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1rtsp_1_1RtspServer_a9ebee3a83d19282d61349093c62059a6} 
\index{com.tritondigital.net.streaming.proxy.server.rtsp.RtspServer@{com.tritondigital.net.streaming.proxy.server.rtsp.RtspServer}!RtspServer@{RtspServer}}
\index{RtspServer@{RtspServer}!com.tritondigital.net.streaming.proxy.server.rtsp.RtspServer@{com.tritondigital.net.streaming.proxy.server.rtsp.RtspServer}}
\doxysubsubsection{\texorpdfstring{RtspServer()}{RtspServer()}}
{\footnotesize\ttfamily com.\+tritondigital.\+net.\+streaming.\+proxy.\+server.\+rtsp.\+Rtsp\+Server.\+Rtsp\+Server (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Constructs a RTSP Server that streams the data from the given provider. 

The new instance needs to have a source set ({\ttfamily set\+Data\+Provider}) before it starts listening. Use {\ttfamily block\+Until\+Ready} before starting to listen to avoid delays in responses. 

\doxysubsection{Member Function Documentation}
\Hypertarget{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1rtsp_1_1RtspServer_af8ab7d858923fbe7cc4a0faf8aada55a}\label{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1rtsp_1_1RtspServer_af8ab7d858923fbe7cc4a0faf8aada55a} 
\index{com.tritondigital.net.streaming.proxy.server.rtsp.RtspServer@{com.tritondigital.net.streaming.proxy.server.rtsp.RtspServer}!bindAndListen@{bindAndListen}}
\index{bindAndListen@{bindAndListen}!com.tritondigital.net.streaming.proxy.server.rtsp.RtspServer@{com.tritondigital.net.streaming.proxy.server.rtsp.RtspServer}}
\doxysubsubsection{\texorpdfstring{bindAndListen()}{bindAndListen()}}
{\footnotesize\ttfamily void com.\+tritondigital.\+net.\+streaming.\+proxy.\+server.\+rtsp.\+Rtsp\+Server.\+bind\+And\+Listen (\begin{DoxyParamCaption}\item[{final int}]{port }\end{DoxyParamCaption})}



Reimplemented from \mbox{\hyperlink{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1Server_ace2fc1d27ef8854d9c87d099201fd612}{com.\+tritondigital.\+net.\+streaming.\+proxy.\+server.\+Server}}.

\Hypertarget{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1rtsp_1_1RtspServer_a5a47106cab3145a101635fe9fd11931c}\label{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1rtsp_1_1RtspServer_a5a47106cab3145a101635fe9fd11931c} 
\index{com.tritondigital.net.streaming.proxy.server.rtsp.RtspServer@{com.tritondigital.net.streaming.proxy.server.rtsp.RtspServer}!disconnectAndUnbind@{disconnectAndUnbind}}
\index{disconnectAndUnbind@{disconnectAndUnbind}!com.tritondigital.net.streaming.proxy.server.rtsp.RtspServer@{com.tritondigital.net.streaming.proxy.server.rtsp.RtspServer}}
\doxysubsubsection{\texorpdfstring{disconnectAndUnbind()}{disconnectAndUnbind()}}
{\footnotesize\ttfamily void com.\+tritondigital.\+net.\+streaming.\+proxy.\+server.\+rtsp.\+Rtsp\+Server.\+disconnect\+And\+Unbind (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [protected]}}



Reimplemented from \mbox{\hyperlink{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1Server_ac579f5c27926d9d59df1f3ee29a629b5}{com.\+tritondigital.\+net.\+streaming.\+proxy.\+server.\+Server}}.

\Hypertarget{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1rtsp_1_1RtspServer_a4fba601e1329879e4362320bca572f95}\label{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1rtsp_1_1RtspServer_a4fba601e1329879e4362320bca572f95} 
\index{com.tritondigital.net.streaming.proxy.server.rtsp.RtspServer@{com.tritondigital.net.streaming.proxy.server.rtsp.RtspServer}!getUri@{getUri}}
\index{getUri@{getUri}!com.tritondigital.net.streaming.proxy.server.rtsp.RtspServer@{com.tritondigital.net.streaming.proxy.server.rtsp.RtspServer}}
\doxysubsubsection{\texorpdfstring{getUri()}{getUri()}}
{\footnotesize\ttfamily URI com.\+tritondigital.\+net.\+streaming.\+proxy.\+server.\+rtsp.\+Rtsp\+Server.\+get\+Uri (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Reimplemented from \mbox{\hyperlink{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1Server_a2b270c42292328ae5289ccc529214812}{com.\+tritondigital.\+net.\+streaming.\+proxy.\+server.\+Server}}.

\Hypertarget{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1rtsp_1_1RtspServer_a0efdcbec8e26c5e4a3401d75a4d7d63c}\label{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1rtsp_1_1RtspServer_a0efdcbec8e26c5e4a3401d75a4d7d63c} 
\index{com.tritondigital.net.streaming.proxy.server.rtsp.RtspServer@{com.tritondigital.net.streaming.proxy.server.rtsp.RtspServer}!onProcessMessage@{onProcessMessage}}
\index{onProcessMessage@{onProcessMessage}!com.tritondigital.net.streaming.proxy.server.rtsp.RtspServer@{com.tritondigital.net.streaming.proxy.server.rtsp.RtspServer}}
\doxysubsubsection{\texorpdfstring{onProcessMessage()}{onProcessMessage()}}
{\footnotesize\ttfamily void com.\+tritondigital.\+net.\+streaming.\+proxy.\+server.\+rtsp.\+Rtsp\+Server.\+on\+Process\+Message (\begin{DoxyParamCaption}\item[{Object}]{user\+Info }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [protected]}}



Reimplemented from \mbox{\hyperlink{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1Server_ae11a46d44d621fdf7aa356c0fa0d6ff9}{com.\+tritondigital.\+net.\+streaming.\+proxy.\+server.\+Server}}.

\Hypertarget{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1rtsp_1_1RtspServer_ad079a99fb70e867a30f3bcdff83eae72}\label{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1rtsp_1_1RtspServer_ad079a99fb70e867a30f3bcdff83eae72} 
\index{com.tritondigital.net.streaming.proxy.server.rtsp.RtspServer@{com.tritondigital.net.streaming.proxy.server.rtsp.RtspServer}!setDataProvider@{setDataProvider}}
\index{setDataProvider@{setDataProvider}!com.tritondigital.net.streaming.proxy.server.rtsp.RtspServer@{com.tritondigital.net.streaming.proxy.server.rtsp.RtspServer}}
\doxysubsubsection{\texorpdfstring{setDataProvider()}{setDataProvider()}}
{\footnotesize\ttfamily void com.\+tritondigital.\+net.\+streaming.\+proxy.\+server.\+rtsp.\+Rtsp\+Server.\+set\+Data\+Provider (\begin{DoxyParamCaption}\item[{Data\+Provider}]{rtp\+Packet\+Provider }\end{DoxyParamCaption})}



Sets the RTSP Server to streams the data from the given provider. 

Ignored if the server is already listening or connected. Use {\ttfamily block\+Until\+Ready} or wait for the on\+Server\+Ready notification after the provider changes and before starting to listen to avoid delays in responses.


\begin{DoxyParams}{Parameters}
{\em rtp\+Packet\+Provider} & Source of the packets to transmit. \\
\hline
\end{DoxyParams}


Reimplemented from \mbox{\hyperlink{classcom_1_1tritondigital_1_1net_1_1streaming_1_1proxy_1_1server_1_1Server_a197ffbd6fcd89d42d9f35488cc5b91b2}{com.\+tritondigital.\+net.\+streaming.\+proxy.\+server.\+Server}}.



The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
streamingproxy/src/main/java/com/tritondigital/net/streaming/proxy/server/rtsp/Rtsp\+Server.\+java\end{DoxyCompactItemize}
