lib/rtsp/client.rb in rtsp-0.1.0 vs lib/rtsp/client.rb in rtsp-0.1.1
- old
+ new
@@ -290,12 +290,14 @@
end
if @play_thread.nil?
RTSP::Client.log "Capturing RTP data on port #{@transport[:client_port][:rtp]}"
- @play_thread = Thread.new do
- @capturer.run
+ unless @capturer.running?
+ @play_thread = Thread.new do
+ @capturer.run
+ end
end
end
@session_state = :playing
end
@@ -331,10 +333,12 @@
cseq: @cseq, session: @session })
message.add_headers additional_headers
request(message) do
reset_state
+
if @play_thread
+ @capturer.stop
@capturer.rtp_file.close
@play_thread.exit
end
end
end