Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jitsi.impl.neomedia;
import java.io.*;
import java.net.*;
import org.jitsi.service.neomedia.*;
/**
* RTPConnector implementation for UDP.
*
* @author Sebastien Vincent
*/
public class RTPConnectorTCPImpl
extends AbstractRTPConnector
{
/**
* The TCP socket this instance uses to send and receive RTP packets.
*/
private Socket dataSocket;
/**
* The TCP socket this instance uses to send and receive RTCP packets.
*/
private Socket controlSocket;
/**
* Initializes a new <tt>RTPConnectorTCPImpl</tt> which is to use a given
* pair of sockets for RTP and RTCP traffic specified in the form
* of a <tt>StreamConnector</tt>.
*
* @param connector the pair of sockets for RTP and RTCP traffic
* the new instance is to use
*/
public RTPConnectorTCPImpl(StreamConnector connector)
{
super(connector);
}
/**
* Gets the TCP socket this instance uses to send and receive RTP packets.
*
* @return the TCP socket this instance uses to send and receive RTP packets
*/
public Socket getDataSocket()
{
if (dataSocket == null)
dataSocket = connector.getDataTCPSocket();
return dataSocket;
}
/**
* Gets the TCP Socket this instance uses to send and receive RTCP packets.
*
* @return the TCP Socket this instance uses to send and receive RTCP
* packets
*/
public Socket getControlSocket()
{
if (controlSocket == null)
controlSocket = connector.getControlTCPSocket();
return controlSocket;
}
/**
* Creates the RTCP packet input stream to be used by <tt>RTPManager</tt>.
*
* @return a new RTCP packet input stream to be used by <tt>RTPManager</tt>
* @throws IOException if an error occurs during the creation of the RTCP
* packet input stream
*/
protected RTPConnectorInputStream createControlInputStream()
throws IOException
{
return new RTPConnectorTCPInputStream(getControlSocket());
}
/**
* Creates the RTCP packet output stream to be used by <tt>RTPManager</tt>.
*
* @return a new RTCP packet output stream to be used by <tt>RTPManager</tt>
* @throws IOException if an error occurs during the creation of the RTCP
* packet output stream
*/
protected RTPConnectorOutputStream createControlOutputStream()
throws IOException
{
return new RTPConnectorTCPOutputStream(getControlSocket());
}
/**
* Creates the RTP packet input stream to be used by <tt>RTPManager</tt>.
*
* @return a new RTP packet input stream to be used by <tt>RTPManager</tt>
* @throws IOException if an error occurs during the creation of the RTP
* packet input stream
*/
protected RTPConnectorInputStream createDataInputStream()
throws IOException
{
return new RTPConnectorTCPInputStream(getDataSocket());
}
/**
* Creates the RTP packet output stream to be used by <tt>RTPManager</tt>.
*
* @return a new RTP packet output stream to be used by <tt>RTPManager</tt>
* @throws IOException if an error occurs during the creation of the RTP
* packet output stream
*/
protected RTPConnectorOutputStream createDataOutputStream()
throws IOException
{
return new RTPConnectorTCPOutputStream(getDataSocket());
}
}