rtsp_server 0.0.4-universal-java → 0.0.6-universal-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c8464455a6f8c1a5620bdd8f05f83c4aa9bcf03a
4
- data.tar.gz: a88f157ece57f6fb1aa770793133efb97a9c8c71
3
+ metadata.gz: dd2d5c99eddc854cd00f3ca817f21529050cbaf7
4
+ data.tar.gz: 58fee6187fa1e578745723518ea2e0374b063d07
5
5
  SHA512:
6
- metadata.gz: 701117fc4639fcad9eaa92ac6313c380a0de1460ae69b0a0069df609dd191d9df337ac6db60a65ad3c6e397e06c2f80347529359e3ac6c90b583e72a4408ce7c
7
- data.tar.gz: 5e9d29de707b867ca7d9bbb1e73ac29e1f8eab8684d853d76c9d502752422f761a9e0326190087accabed553b0b0facd08cc393c5769a33f12424db623d0e4a5
6
+ metadata.gz: 301618d21974506325f60cd897ef5517fe2fa246d23e730c372055b897d014155481739458a13fcc7d4ab874866d8d2e45378734656498acd7a7afdbb3967079
7
+ data.tar.gz: 1a7d5cf9fdd8d644132ea64aa2aa63d58ef26bbf9427a82f98f6b7190e85851d360864b0a8c0c64420a7663471f39145d51c4395e674dc3579d677d5c37fae45
data/lib/rtsp/server.rb CHANGED
@@ -90,15 +90,22 @@ module RTSP
90
90
 
91
91
  begin
92
92
  request_str << io.read_nonblock(500)
93
- rescue Errno::EAGAIN
94
- return -1 if count > 50
93
+ rescue IO::WaitReadable
95
94
  count += 1
96
- sleep 0.01
97
- retry
95
+ sleep 0.001
96
+ sleep 1 if count > 10
97
+ count = 0 unless request_str == ""
98
+ retry if count < 50
99
+ return -1 if request_str == ""
98
100
  end
101
+
102
+ responses = []
99
103
 
100
- response = process_request(request_str, io)
101
- io.send(response, 0)
104
+ request_str.split("\r\n\r\n").each do |r|
105
+ responses << process_request(r, io)
106
+ end
107
+
108
+ io.send(responses.join, 0)
102
109
  end
103
110
 
104
111
  # Process an RTSP request
@@ -229,8 +236,10 @@ module RTSP
229
236
  RTSP::Server.log "Received TEARDOWN request from #{request.remote_host}"
230
237
  sid = request.session[:session_id]
231
238
  @stream_server.stop_streaming sid
239
+ response = []
240
+ response << "\r\n"
232
241
 
233
- [[]]
242
+ [response]
234
243
  end
235
244
 
236
245
  # Handles a pause request.
@@ -242,6 +251,7 @@ module RTSP
242
251
  response = []
243
252
  sid = request.session[:session_id]
244
253
  response << "Session: #{sid}"
254
+ response << "\r\n"
245
255
  @stream_server.disconnect sid
246
256
 
247
257
  [response]
@@ -297,8 +307,7 @@ module RTSP
297
307
  transport = request.transport.split(port_specifier)
298
308
  transport[1] = port_specifier + transport[1]
299
309
  else
300
- stream_port = RTSP::StreamServer.instance.source_port.first
301
- transport = [request.transport + ';', "port=#{stream_port}-#{stream_port + 1}"]
310
+ transport = [request.transport + ';', "port=#{server_port}-#{server_port + 1}"]
302
311
  end
303
312
 
304
313
  if request.transport.include?("unicast")
@@ -128,7 +128,7 @@ module RTSP
128
128
  #
129
129
  # @param[Boolean] multicast True if the description is for a multicast stream.
130
130
  # @param [Fixnum] stream_index Index of the stream type.
131
- def description multicast=false, stream_index=1
131
+ def description(multicast=false, stream_index=1)
132
132
  rtp_map = @rtp_map[stream_index - 1] || H264_RTP_MAP
133
133
  fmtp = @fmtp[stream_index - 1] || H264_FMTP
134
134
 
@@ -143,7 +143,7 @@ a=type:broadcast\r
143
143
  a=control:*\r
144
144
  a=range:npt=0-\r
145
145
  a=x-qt-text-nam:Session streamed by "Streaming Server"\r
146
- a=x-qt-text-inf:stream1#{multicast ? 'm' : ''}\r
146
+ a=x-qt-text-inf:stream#{stream_index}#{multicast ? 'm' : ''}\r
147
147
  m=video #{multicast ? @source_port[stream_index - 1] : 0} RTP/AVP 96\r
148
148
  c=IN IP4 #{multicast ? "#{multicast_ip(stream_index)}/10" : "0.0.0.0"}\r
149
149
  a=rtpmap:#{rtp_map}\r
data/lib/rtsp/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module RTSP
2
2
  # rtsp version
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.6"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rtsp_server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.6
5
5
  platform: universal-java
6
6
  authors:
7
7
  - Steve Loveless, Mike Kirby
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-12-20 00:00:00.000000000 Z
12
+ date: 2014-01-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: parslet