[Live-devel] crapy sound when streaming from pipes
Ross Finlayson
finlayson at live.com
Fri Jun 11 09:29:43 PDT 2004
>I am trying to stream MPEG2 audio with modified
>testMPEG1or2AudioVideoStreamer.
>It works good with plain files, but when I try to stream from pipe (with
>mpeg2ts demuxer on the other side) it produced the following effect: for
>two or three seconds all is fine, then sound stops for quater or whole
>second and so on.
I suspect that the problem here is that the "ByteStreamFileSource" class -
which reads data from the input file (in your case, a pipe) - does
synchronous (blocking) reads. While this code is blocked reading on the
input file (or pipe), no other LIVE.COM library code runs. This is not
usually a problem when streaming from a file, but may be a problem when
streaming from a pipe.
You can overcome this, I think, in one of two ways:
1/ Have the class that reads from your pipe do asynchronous reads (using
"TaskScheduler::turnOnBackgroundReadHandling()"). (You can use
"liveMedia/DeviceSource.cpp" as a model for this.)
2/ Feed the output from your MPEG-2 Transport Stream demuxer directly into
the LIVE.COM data chain, thereby avoiding the need for a pipe (and a
"ByteStreamFileSource") at all. If you do this, though, your MPEG-2
Transport Stream demuxer will need to be rewritten using the event-driven
style of other LIVE.COM filters.
Ross Finlayson
LIVE.COM
<http://www.live.com/>
More information about the live-devel
mailing list