-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME
204 lines (138 loc) · 6.86 KB
/
README
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
PIXTREAM P2P Streaming System.
Introduction
==============================================================================
Pixtream is a P2P program similar to Bittorrent designed to be used with live
streaming content. Pixtream takes a live stream from a source and splits it
into several chunks that are then sent to different peers in the network. A
peer can download and upload chunks from several other peers, the program takes
the chunks and reconstruct them into a stream.
The goal of Pixtream is to distribute the upload bandwidth usage among all the
peers in the network. Avoiding the bandwidth bottleneck commonly found in
client-server streaming systems.
Currently, Pixtream is in an early stage of development. Pixtream can create a
very simple P2P network and transmit a stream over it, but a lot of features
are missing right now. Pixtream is a work in progress.
How it works
==============================================================================
A Pixtream system has various separated components:
- Streaming source
- Tracker
- Source peer
- Regular peer
The streaming source can be any streaming server or multimedia file. Currently
PIXTREAM only supports HTTP streams, TCP streams and file sources. In the
future more stream soucers will be supported.
The Tracker is very similar to a Bittorrent tracker. It's used to bootstrap
the P2P network. Peers connect to the tracker to get information about the
stream distributed and a list of other peers to exchange information with. The
Pixtream tracker is based on the HTTP protocol and uses JSON as its
information exchange format.
The source peer is a special type of peer that receives a media stream
directly from the streaming source. The source peer takes that stream and
splits it into chunks to be distributed among the p2p network.
A regular peer creates connections with other peers and requests chunks of
data from them. The chunks can be requested to the source peer or any other
peer. A peer takes the chunks and organize them to reconstruct the original
stream as received by the source peer. The original reconstructed stream is
streamed again by the peer so that a media player could be used to reproduce
the media.
Usage
==============================================================================
To create a Pixtream P2P network you need to have at least a streaming source,
a tracker and a source peer.
Streaming source
------------------------------------------------------------------------------
Pixtream currently supports three types of streaming source: HTTP, TCP and
File.
An HTTP streaming source could be any HTTP streaming server.
You can also create simple TCP streams using netcat. For example:
$ nc -l -p 3000 < mediafile.ogg
Tracker
------------------------------------------------------------------------------
The tracker program can be found in the bin directory of the Pixtream source
distribution.
Usage: tracker [options]
Options:
-h, --help show this help message and exit -p PORT, --port=PORT
-p PORT, --port=PORT Listening Port
-i INTERVAL, --interval=INTERVAL
Interval in seconds for peers to make requests
Example:
$ tracker -p 8080 -i 10
Source peer
------------------------------------------------------------------------------
A source peer should connect to the tracker and the streaming source. The
source peer program can be found in the bin directory of the Pixtream source
distribution:
Usage: peersource [options] tracker_url source_type source
Options:
-h, --help show this help message and exit
-i ADDRESS, --ip=ADDRESS
IP Address to use
-p PORT, --port=PORT Listening Port
-s PORT, --streaming-port=PORT
Listening Port for the streaming output
Examples:
Using a HTTP streaming server as a streaming source:
$ peersource http://tracker.com http http://source.com:8080
Using a file a streaming source:
$ peersource http://tracker.com file /var/song.mp3
Using a TCP stream as a streaming source:
$ peersource http://tracker.com tcp 192.168.1.10:30000
Regular peer
------------------------------------------------------------------------------
A regular peer should connect to the tracker. There should be at least one
source peer in the network currently.
Usage: usage: peer [options] tracker_url
Options:
-h, --help show this help message and exit
-i ADDRESS, --ip=ADDRESS
IP Address to use
-p PORT, --port=PORT Listening Port
-s PORT, --streaming-port=PORT
Listening Port for the streaming output
Example:
$ peer -p 60001 -s 30001 http://localhost:8080
Playing the media
-------------------------------------------------------------------------------
Each peer provides a streaming port where the reconstructed stream can be
accessed by a media player. You can play the media with any media player with
server support.
Simple example with gstreamer:
$ gst-launch-0.10 tcpclientsrc host=127.0.0.1 port=30001 ! decodebin !
audioconvert ! alsasink
Using the launcher script
------------------------------------------------------------------------------
The Pixtream source distribution has a launcher script used for testing
purposes. The script can used to launch a streaming source, tracker, source
peer and several regular peers. The script is located in
tests/manualtests/launchpeers.py in the Pixtream source distribution.
The launcher requires Netcat and Trickle
(http://monkey.org/~marius/pages/?page=trickle)
Usage: Usage: launchpeers.py [options] numpeers mediafile
Options:
-h, --help show this help message and exit
-t PORT, --tracker-port=PORT
Port to use with the tracker
-i INTERVAL, --tracker-interval=INTERVAL
Interval of the tracker checks in seconds
-p PORT, --start-peer-port=PORT
Starting listening port for the peers
-s PORT, --start-streaming-port=PORT
Starting listening port for streaming
-r RATE, --media-server-rate=RATE
Media server upload rate in KB/s
-m PORT, --media-server-port=PORT
Media server listening port
Example:
$ ./launchpeers.py -t 8080 -i 30 -p 60000 -s 30000 -r 50 -m 3000 10 test.ogg
This will launch a Netcat streaming server on port 3000 sending information at
50 KB/s maximum. It will launch a tracker listening on port 8080 with an
interval of 30 seconds. It will launch a source peer listening on port 60000
for peer communication and retransmitting the reconstructed stream on port
30000. It will launch 10 peers listening on ports from 60001 to 60010 and
retransmitting from 30001 to 30010.
The script has some default values. Other way to call it would be:
$ ./launchpeers.py 10 test.ogg
The outputs of each process would be saved in a file *.output. For example the
output for first peer would be peer0.output.