Project

General

Profile

can lighty do LIVE streaming ?

Added by sriramn about 16 years ago

Is there a plugin / module for lighttpd, that can do LIVE streaming ?
i,e a live capture feed (growing file size), needs to get streamed out over HTTP.
I know mod_flv_streaming, cannot handle this. It assumes the file size is fixed.
Basically, I have a live feed, that is dumped on to a file, an ever growing file, which needs to be streamed out using lighttpd.

I am ready to write/modify new/existing module. I need help in understanding how to do this.
In other words,
1. Is there a way to indicate from a module/plugin, to the network-backend to stream a file, till EOF, without specifying the chunk size ?
2. Do chunkqueue_append_file or http_chunk_append_file take special values in "offset or len" to indicate this ?

I have noticed that there is code under the network backends, to detect a file shrink
i.e (chunk->offset > stat_cache_entry->st.st_size)
But this is the opposite case, where in the file grows !

I havent seen support for this. Hope i havent overlooked something very obvious.

any assistance will be greatly appreciated.
Thanks in advance
Sriram Neelakandan


Replies (4)

RE: can lighty do LIVE streaming ? - Added by stbuehler about 16 years ago

No, there is not. I don't think we will add such a feature to the core, so you will have to code this in a module or a fastcgi backend.
But for real streaming (like video/audio) you should probably use a real streaming server.

RE: can lighty do LIVE streaming ? - Added by sriramn about 16 years ago

Thanks for you response..
If i do this in a module, then how do i override the default sendfile ?
Is there a defined way to do this ? I mean a plugin callback or such ?

RE: can lighty do LIVE streaming ? - Added by sriramn about 16 years ago

Here is a patch that will enable streaming on lighttpd.

http://pastebin.com/m2b43760e (also attached here)
I plan to update this in the wiki (shortly, after reviews if any)

The module that needs to use the streamer needs to call chunkqueue_append_file() with len as 1 to enable streaming for that file.
When a streaming chunk is detected,
Lighty will not send Content-Length
- Use stat (not stat cache) to find if there is more data to be sent out
Limitation:
- Its a big hack
- Implemented only for Linux sendfile network backend

RE: can lighty do LIVE streaming ? - Added by gyalp almost 16 years ago

Hi sriramn, that's a great work enabling the lighty to handle an ever growing file. Have you noticed any issue so far with your patch? I would also like to try it out. Thanks.

Ben

    (1-4/4)