about h.264 streaming cache support
wupeng at openv.cn
Wed Oct 8 06:57:16 MSD 2008
I have implemented an H.264 pseudo streaming module. And now I want to add cache feature to this module.
My situation is that we have some data centers across country, and each data center has some servers to provide video clips to our users. Because we want to simplify the management of the storage and video files synchronization problem, we maintain only one central storage. The servers on edge data centers should cache the most visited video clips based on LRU algorithm.
I read the ngx_httpd_proxy_module.c file, and I think it is a good starting point. I know a simplified module capable of this cache feature should work like this:
Step 1.if the requested file has been found on local disk, return the file
Step 2.if the requested file has not been found on local disk, proxy this request to original server and send the response to user and save the file to local disk.
I know I can implement Step 1 on ngx_http_proxy_handler function. For Step 2 I know I should create the proxy request on ngx_http_proxy_create_request function, but I do NOT know on which function I can save the response file to local disk and how. Should I implement this feature on ngx_http_proxy_finalize_request function? And which data structure contains the returned file data, is it u->buffering?
Thank you very much!
You can download the H.264 pseudo streaming module from http://126.96.36.199:8081/mp4.tar.bz2
compile & intall
1. wget http://188.8.131.52:8081/mp4.tar.bz2
2. tar xfj mp4.tar.bz2
3. mv mp4 your_path/nginx-0.7.17/src/http/modules
4. cd your_path/nginx-0.7.17
5. ./configure --with-http_flv_module --add-module=src/http/modules/mp4
7. make install
8. kill -HUP `cat /usr/local/nginx/logs/nginx.pid`
a simple demo
26th Floor, Block 16, jianwai SOHO,
No.39 Middle East Third Ring Rd
Chaoyang District Beijing 100022
Tel: (010)5878 7828
Fax: (010)5878 7900
Email : wupeng at openv.cn
More information about the nginx