These are chat archives for P2PSP/MediaSources-server

9th
Apr 2017
JP
@jpgarciaortiz
Apr 09 2017 08:16
well, for instance, in order to create a new "channel": which approach do you think would be best?
it's required to define a URL schema, used to call the media server
with that, it'd be necessary to check if there already is a channel with that name; if not, a new one is created, a new splitter is launched, and the connection information (to connect to this splitter) would be returned
Abhinav Gauniyal
@agauniyal
Apr 09 2017 12:09

well, for instance, in order to create a new "channel": which approach do you think would be best?

The choice of approach depends on where do we intend to put up mediaserver. Like if it's on the same machine as where you want to launch splitter processes, the first approach ie. 'mediaserver maintaining everything' works very well. It can monitor processes, relaunch them if they fail/close down etc.

However, if mediaserver can be put on entirely different machine than the one to be having new splitter processes, the mediaserver server here cannot launch new splitters by itself because they would be launched on this machine only. Note that we can always launch splitter on mediaserver machine but point them to source at other machine since splitters accept source's address as argument. What we can do is, change p2psp code so that it can communicate with mediasources server and launch/kill new splitters when asked to do so.

Abhinav Gauniyal
@agauniyal
Apr 09 2017 12:23

Let me provide pseudo examples -

cd bin
wget https://upload.wikimedia.org/wikipedia/commons/7/79/Big_Buck_Bunny_small.ogv
cvlc Big_Buck_Bunny_small.ogv --sout "#http{mux=ogg,dst=:8080/BBB.ogv}" :sout-keep &

^ Source is ready

node mediasources --src 'sourceIP:port' &

^ mediaserver launched and monitoring source, also reverse is possible too where mediasources is launched first and sources register themselves with it.

./monitor --splitter-url 'http://niceurl/abcd1234' > /dev/null &
vlc http://localhost:9999 &
./peer --splitter-url 'http://niceurl/abcd1234' --player_port 10000 &
vlc http://localhost:10000 &

Note that no splitter creation command is necessary, peers contact http url where they're provided with splitter's ip:port

^ This is for 1st case where mediaserver launches splitter on it's own machine only
Abhinav Gauniyal
@agauniyal
Apr 09 2017 12:29

For 2nd case, where mediaserver can be on entirely different server -

cd bin
wget https://upload.wikimedia.org/wikipedia/commons/7/79/Big_Buck_Bunny_small.ogv
cvlc Big_Buck_Bunny_small.ogv --sout "#http{mux=ogg,dst=:8080/BBB.ogv}" :sout-keep &

^ Source is ready

node mediasources --src 'sourceIP:port' &

^ mediaserver launched and monitoring source, also reverse is possible too where mediasources is launched first and sources register themselves with it.

./splitter-manager --mediasources-url 'http://someUrl.ToSendRequests/'
./splitter-manager --mediasources-url '127.0.0.1:3000'  # works locally too since address is valid
./monitor --splitter-url 'http://niceurl/abcd1234' > /dev/null &
vlc http://localhost:9999 &
./peer --splitter-url 'http://niceurl/abcd1234' --player_port 10000 &
vlc http://localhost:10000 &

Note that no splitter creation command is necessary, peers contact http url where they're provided with splitter's ip:port.
In this case, splitter-manager is launching/maintaining splitter processes since mediaserver might be on different machine

Infact ./splitter-manager doesn't need to be cpp program at all, it can be same mediaserver launched in client mode where it sits on required machine and contacts real mediaserver to get list of splitters/add new splitter/get address of all channels/ get address of particular channel etc.. and based on response it gets from server, launches and manages splitter processes.
Abhinav Gauniyal
@agauniyal
Apr 09 2017 12:46

it's required to define a URL schema, used to call the media server
with that, it'd be necessary to check if there already is a channel with that name; if not, a new one is created, a new splitter is launched, and the connection information (to connect to this splitter) would be returned

By URL schema, do you mean certain http endpoints fixed for either GETing responses or POSTing them?
In second line are you talking about a scenario where same channel name is created for new source too? Or where a new peer/client hits for a channel but the channel wasn't there so a new channel is created - new splitters launched for it and their address returned to peer/client. In this case, what if source for that channel doesn't exists or has been closed? Actually I was under the impression that a channel can only be created when a source is present for it, so there is always going to be a valid channel for valid source

if there already is a channel with that name; if not, a new one is created

so the 'if not' condition would never happen here because source would not be present for a non-existent channel name.

I might be speculating it wrong too, so feel free to correct me!