[Live-devel] Read from device file problem

Gordon Smith spider.karma+live555.com at gmail.com
Tue Mar 31 13:10:51 PDT 2009


Hello -

After modification for input of filename, testMPEG2TransportStreamer
can read from pipe, but not read directly from device file.
The fread() in ByteStreamFileSource returns EIO and reads zero bytes
for direct read.

Device file /dev/video2 is saa7134-empress device on Linux debian
2.6.26-1-686, live-2009-03-22, latest v4l-dvb modules.


Using cat redirected to file and live555MediaServer works perfectly
for at least 12 minutes (the longest test so far).

  $ cat /dev/video2 > test-video2.ts
  $ ./live555MediaServer

  VLC: rtsp://debian:8554/test-video2.ts


Reading /dev/video2 directly results in EIO and zero bytes read.

  $ sudo ./testMPEG2TransportStreamer /dev/video2
  Play this stream using the URL "rtsp://192.168.168.24/testStream"
  Beginning streaming...
  Beginning to read from file...
  ByteStreamFileSource::doReadFromFile: fread returned 0
  ByteStreamFileSource::doReadFromFile: ferror = 5 (Input/output error)


FYI, using cat piped to testMPEG2TransportStreamer starts well, but
begins to continuously lose data after about 2 to 4 minutes.
Using setvbuf to increase buffer to 32k or 64k did not help.

  $ cat /dev/video2 | sudo ./testMPEG2TransportStreamer stdin

  VLC: rtsp://debian/testStream


Any thoughts as to why using fread on device file could fail?

A v4l2 example capture program uses read() on a device file
successfully. Would writing a replacement for ByteStreamFileSource
that mimics v4l2 code be useful?

Thank you,
Gordon


More information about the live-devel mailing list