rtp 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,8 @@
1
+ === 0.1.5 / 2012-12-7
2
+
3
+ * gh-7: Receiver now uses non-blocking socket for receiving data. Fixes
4
+ receiving data on Linux, which stopped working at 0.1.0.
5
+
1
6
  === 0.1.4 / 2012-12-06
2
7
 
3
8
  === Bug Fixes:
@@ -245,12 +245,16 @@ module RTP
245
245
 
246
246
  Thread.start(socket) do
247
247
  loop do
248
- msg = socket.recvmsg(MAX_BYTES_TO_RECEIVE)
249
- data = msg.first
250
- log "Received data at size: #{data.size}"
251
-
252
- log "RTP timestamp from socket info: #{msg.last.timestamp}"
253
- @packets << [data, msg.last.timestamp]
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
@@ -1,3 +1,3 @@
1
1
  module RTP
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.5'
3
3
  end
@@ -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", recvmsg: message }
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(:recvmsg).with(1500).and_return message
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
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-06 00:00:00.000000000 Z
13
+ date: 2012-12-07 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bindata