rtp 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,10 @@
1
+ === 0.1.3 / 2012-11-21
2
+
3
+ ==== Improvements:
4
+
5
+ * RTP::Receiver#start now also yields the timestamp from the packet as received
6
+ on the socket.
7
+
1
8
  === 0.1.2 / 2012-11-20
2
9
 
3
10
  ==== Bug Fixes:
@@ -83,13 +83,22 @@ module RTP
83
83
  #
84
84
  # If a block is given, this will yield each parsed packet as an RTP::Packet.
85
85
  # This lets you inspect packets as they come in:
86
- # @example
86
+ # @example Just the packet
87
87
  # receiver = RTP::Receiver.new
88
88
  # receiver.start do |packet|
89
- # puts packet["sequence_number"]
89
+ # puts packet.sequence_number
90
+ # end
91
+ #
92
+ # @example The packet and its timestamp
93
+ # receiver = RTP::Receiver.new
94
+ # receiver.start do |packet, timestamp|
95
+ # puts packet.sequence_number
96
+ # puts timestamp
90
97
  # end
91
98
  #
92
99
  # @yield [RTP::Packet] Each parsed packet that comes in over the wire.
100
+ # @yield [Time] The timestamp from the packet as it was received on the
101
+ # socket.
93
102
  #
94
103
  # @return [Boolean] true if started successfully.
95
104
  def start(&block)
@@ -167,10 +176,13 @@ module RTP
167
176
  # This starts a new Thread for reading packets off of the list of packets
168
177
  # that has been read in by the listener. If no block is given, this writes
169
178
  # all received packets (in the @packets Queue) to the +capture_file+. If a
170
- # block is given, it yields each packet, parsed as an RTP::Packet. If
179
+ # block is given, it yields each packet, parsed as an RTP::Packet as well as
180
+ # the timestamp from that packet as it was received on the socket. If
171
181
  # +strip_headers+ is set, it only writes/yields the RTP payload to the file.
172
182
  #
173
183
  # @yield [RTP::Packet] Each parsed packet that comes in over the wire.
184
+ # @yield [Time] The timestamp from the packet as it was received on the
185
+ # socket.
174
186
  # @return [Thread] The packet writer thread.
175
187
  def start_packet_writer
176
188
  return @packet_writer if @packet_writer
@@ -179,13 +191,16 @@ module RTP
179
191
  # some I/O ano not write the packet to file?
180
192
  Thread.start do
181
193
  loop do
182
- packet = RTP::Packet.read(@packets.pop)
194
+ msg, timestamp = @packets.pop
195
+ packet = RTP::Packet.read(msg)
196
+
183
197
  data_to_write = @strip_headers ? packet.rtp_payload : packet
184
198
 
185
199
  if block_given?
186
- yield data_to_write
200
+ yield data_to_write, timestamp
187
201
  else
188
202
  @capture_file.write(data_to_write)
203
+ @packet_timestamps << timestamp
189
204
  end
190
205
  end
191
206
  end
@@ -235,8 +250,7 @@ module RTP
235
250
  log "Received data at size: #{data.size}"
236
251
 
237
252
  log "RTP timestamp from socket info: #{msg.last.timestamp}"
238
- @packet_timestamps << msg.last.timestamp
239
- @packets << data
253
+ @packets << [data, msg.last.timestamp]
240
254
  end
241
255
  end
242
256
  end
@@ -1,3 +1,3 @@
1
1
  module RTP
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  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.2
4
+ version: 0.1.3
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-11-21 00:00:00.000000000 Z
13
+ date: 2012-11-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bindata