rtp 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +5 -0
- data/lib/rtp/receiver.rb +10 -6
- data/lib/rtp/version.rb +1 -1
- data/spec/rtp/receiver_spec.rb +4 -2
- metadata +2 -2
data/History.rdoc
CHANGED
data/lib/rtp/receiver.rb
CHANGED
@@ -245,12 +245,16 @@ module RTP
|
|
245
245
|
|
246
246
|
Thread.start(socket) do
|
247
247
|
loop do
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
248
|
+
begin
|
249
|
+
msg = socket.recvmsg_nonblock(MAX_BYTES_TO_RECEIVE)
|
250
|
+
data = msg.first
|
251
|
+
log "Received data at size: #{data.size}"
|
252
|
+
|
253
|
+
log "RTP timestamp from socket info: #{msg.last.timestamp}"
|
254
|
+
@packets << [data, msg.last.timestamp]
|
255
|
+
rescue Errno::EAGAIN
|
256
|
+
# Waiting for data on the socket...
|
257
|
+
end
|
254
258
|
end
|
255
259
|
end
|
256
260
|
end
|
data/lib/rtp/version.rb
CHANGED
data/spec/rtp/receiver_spec.rb
CHANGED
@@ -318,7 +318,7 @@ describe RTP::Receiver do
|
|
318
318
|
let(:data) { double "socket data", size: 10 }
|
319
319
|
let(:socket_info) { double "socket info", timestamp: '12345' }
|
320
320
|
let(:message) { [data, socket_info] }
|
321
|
-
let(:socket) { double "Socket",
|
321
|
+
let(:socket) { double "Socket", recvmsg_nonblock: message }
|
322
322
|
|
323
323
|
it "starts a new Thread and returns that" do
|
324
324
|
Thread.should_receive(:start).with(socket).and_return listener
|
@@ -329,7 +329,7 @@ describe RTP::Receiver do
|
|
329
329
|
Thread.stub(:start).and_yield
|
330
330
|
subject.stub(:loop).and_yield
|
331
331
|
|
332
|
-
socket.should_receive(:
|
332
|
+
socket.should_receive(:recvmsg_nonblock).with(1500).and_return message
|
333
333
|
|
334
334
|
subject.send(:start_listener, socket)
|
335
335
|
|
@@ -376,8 +376,10 @@ describe RTP::Receiver do
|
|
376
376
|
|
377
377
|
describe "#stop_packet_writer" do
|
378
378
|
let(:packet_writer) { double "@packet_writer" }
|
379
|
+
before { subject.instance_variable_set(:@packet_writer, packet_writer) }
|
379
380
|
|
380
381
|
it "closes the @capture_file" do
|
382
|
+
subject.stub(:writing_packets?)
|
381
383
|
subject.instance_variable_get(:@capture_file).should_receive(:close)
|
382
384
|
subject.send(:stop_packet_writer)
|
383
385
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rtp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-12-
|
13
|
+
date: 2012-12-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bindata
|