Skip to content
This repository has been archived by the owner on May 17, 2023. It is now read-only.

Passing in stream file results in Bad file descriptor #5

Closed
turboladen opened this issue Sep 19, 2011 · 1 comment
Closed

Passing in stream file results in Bad file descriptor #5

turboladen opened this issue Sep 19, 2011 · 1 comment

Comments

@turboladen
Copy link
Owner

I have a cuke test that, when extracting from steps, looks something like:

def save_streamed_file(file_to_save, save_to_directory)
  capture_dir = File.expand_path(save_to_directory)

  unless File.directory? capture_dir
    FileUtils.mkdir capture_dir
  end

  FileUtils.cp(file_to_save, capture_dir)
end

@streamed_file = Tempfile.new("sarix_streamed_file")
rtsp_url = "#{@sarix.ip_address}#{@sarix.rtsp_stream_path}"

@rtsp_client = RTSP::Client.new(rtsp_url) do |connection, capturer|
  capturer.rtp_file = @streamed_file
end

@rtsp_client.describe
@rtsp_client.setup(@rtsp_client.media_control_tracks.first)

begin
  @rtsp_client.play(@rtsp_client.aggregate_control_track)
  @logger.debug "Starting stream capturing for #{duration} second(s)..."
  sleep duration.to_i
ensure
  @logger.debug "Tearing down RTSP stream..."
  @rtsp_client.teardown(@rtsp_client.aggregate_control_track)
end

if @config[:save_capture_to_file]
  save_streamed_file(@streamed_file, @config[:capture_directory])
end

Running this returns:

[Sep 19 13:14:06]:ERROR:       Bad file descriptor (Errno::EBADF)
[Sep 19 13:14:06]:ERROR:       /Users/sloveless/.rvm/gems/ruby-1.9.2-p290/gems/rtsp-0.1.2/lib/rtsp/capturer.rb:77:in `recvfrom'
[Sep 19 13:14:06]:ERROR:       /Users/sloveless/.rvm/gems/ruby-1.9.2-p290/gems/rtsp-0.1.2/lib/rtsp/capturer.rb:77:in `run'
[Sep 19 13:14:06]:ERROR:       /Users/sloveless/.rvm/gems/ruby-1.9.2-p290/gems/rtsp-0.1.2/lib/rtsp/client.rb:297:in `block (2 levels) in play'
@turboladen
Copy link
Owner Author

I can't recreate this. Also, it doesn't seem like this is the fault of rtsp, but rather the saving logic.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant