gnolizuh / BLSS

NGINX-based Live Media Streaming Server
Other
196 stars 73 forks source link

RTMP Pull and Auto relay #120

Open DucTM31 opened 5 years ago

DucTM31 commented 5 years ago

Hi, I am trying to use your nginx module as an edge server.

Things work fine on single worker mode. When I try the multiple workers there is a problem with it: When a client connects and requests to play a stream, the stream is pulled from an origin server and push to other workers with ngx-local-relay. That part works as expected. But when a second client connects to another worker and requests the same stream, it also creates another pull from the origin and relays the stream to others worker. Here is how I config nginx: Multiple-worker

worker_processes 4;   # multi-worker process mode
relay_stream all;    # stream relay mode
relay_reconnect_time 1s;
auto_relay_socket_dir /tmp;

Edge-server - the callback return 300 with the rtmp stream url from origin

 application edgelive {
      live on;
      on_play http://host:port/v1/replay_pull;
 }

Stat from one worker: image Stat from another worker: image List tcp connection: - Origin server 10.240.152.180 - Edge 10.240.152.181 - Client 10.30.175.105 image

Is this a bug? or Do I need a different nginx config? Any help would be greatly appreciated!