Welcome! Log In Create A New Profile

Advanced

Re: custom handler module - dynamic response with unknown content length

Yasser Zamani
March 01, 2014 09:58AM
On Sat 01 Mar 2014 03:01:42 PM IRST, Maxim Dounin wrote:
> Hello!
>
> The ngx_http_output_filter() function can be called more than
> once, but usually it doesn't make sense - instead, one should
> install r->write_event_handler and do subsequent calls once it's
> possible to write additional data to socket buffer. Working with
> event's isn't something trivial though.

Thanks a lot for write_event_handler.

> Quoting Winnie-the-Pooh, "You needn't shout so loud".
>
> Doing time-consuming transcoding in nginx worker isn't correct in
> any case, as it will block all connections in this worker process.
> So you have to do transcoding in some external process, and talk
> to this process to get transcoded data. This is basically what
> upstream module do (as used by proxy, fastcgi, etc.), and it
> can be used as an example of "how to do this in nginx".

The transcoding process already is doing by an external process,
ffmpeg, into an incomplete file. I just need to read from first of this
incomplete file one by one chunks and send them to client until seeing
a real EOF. I have following plan for nginx configuration:
location \*.mp4 { mymodule; }

So, did you mean if two clients get x.mp4 and y.mp4 in same time then
one of them is blocked until another one get complete file?! I don't
think so while web servers usually make new threads.

I saw './nginx-1.4.5/src/http/ngx_http_upstream.c' but was so complex
for me to understand.

However, I saw FastCGI is simple for me to understand. So, do you
advise me to `regularly read ffmpeg output file` in a FastCGI script
and then fasctcgi_pass the nginx to that?

Sorry for my questions...I think these are last ones ;)

Thank you so much!

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

custom handler module - dynamic response with unknown content length

Yasser Zamani February 28, 2014 02:16PM

Re: custom handler module - dynamic response with unknown content length

Maxim Dounin February 28, 2014 07:12PM

Re: custom handler module - dynamic response with unknown content length

Yasser Zamani March 01, 2014 04:20AM

Re: custom handler module - dynamic response with unknown content length

Maxim Dounin March 01, 2014 06:32AM

Re: custom handler module - dynamic response with unknown content length

Yasser Zamani March 01, 2014 09:58AM

Re: custom handler module - dynamic response with unknown content length

Yasser Zamani March 01, 2014 12:28PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 294
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready