Jump to content


Photo

streamproxy and seeking in file


  • Please log in to reply
79 replies to this topic

Re: streamproxy and seeking in file #21 anudanan

  • Senior Member
  • 995 posts

+14
Neutral

Posted 19 February 2019 - 11:17

Yesterday I´v2 changes the kill signal of the streaming childprocess to a methode to send SIGTERM signal and the streaming child process now polls in his main loop now if the signal was reached and if it is true he leaves the main loop. I have a feelding that is better to prevent driver crashes.


Receiver:2 x Uno4k SE (PLI 7.0 rel), 1 x ET9200 (PLI 4.0), NAS: 2 x QNAP 410, TV: LG 65C8llla, LG 47LB570V, LG 42LM615S, Sound: Yamaha RX-v663, Teufel System 5 THX

Re: streamproxy and seeking in file #22 anudanan

  • Senior Member
  • 995 posts

+14
Neutral

Posted 2 March 2019 - 14:43

I´ve made now same changes into my streamproxy for seek detection. Now the streamproxy  stores and compares the movie filename and the client IP address if a new request comes. It is not 100% sure, because if two clients behind the same NAT Router stream the same file they looks like one client, but for the normal world it is sure enough.

 

It works very good by using SIGTERM to the child.

 

I´m thinking about a methode (eriks idea)  to give the running client a seek command and the new socket to handle it after seeking, but I don´t now how to give the existing child process the control over a new socket connection ot the parent process.


Receiver:2 x Uno4k SE (PLI 7.0 rel), 1 x ET9200 (PLI 4.0), NAS: 2 x QNAP 410, TV: LG 65C8llla, LG 47LB570V, LG 42LM615S, Sound: Yamaha RX-v663, Teufel System 5 THX

Re: streamproxy and seeking in file #23 Pr2

  • PLi® Contributor
  • 3,611 posts

+156
Excellent

Posted 2 March 2019 - 14:49

Can't you also consider to keep the source TCP port, this will make then unique even if they are behind the same NAT router.


NO SUPPORT by PM, it is a forum make your question public so everybody can benefit from the question/answer.
If you think that my answer helps you, you can press the up arrow in bottom right of the answer.

Wanna help with OpenPLi Translation? Please read our Wiki Information for translators

Sat: Hotbird 13.0E, Astra 19.2E, Eutelsat5A 5.0W
VU+ Solo 4K: 2*DVB-S2 + 2*DVB-C/T/T2 (used in DVB-C) & Duo 4K: 2*DVB-S2X + DVB-C (FBC)
Edision OS Mio 4K: 1*DVB-S2X + 1*DVB-C/T/T2
 


Re: streamproxy and seeking in file #24 anudanan

  • Senior Member
  • 995 posts

+14
Neutral

Posted 2 March 2019 - 14:53

that is not possible because the seeking actions of the clients use not the old port. The clients create a new HTTP connection and the port is allways different especially by seekint


Receiver:2 x Uno4k SE (PLI 7.0 rel), 1 x ET9200 (PLI 4.0), NAS: 2 x QNAP 410, TV: LG 65C8llla, LG 47LB570V, LG 42LM615S, Sound: Yamaha RX-v663, Teufel System 5 THX

Re: streamproxy and seeking in file #25 Erik Slagter

  • PLi® Core member
  • 45,327 posts

+497
Excellent

Posted 2 March 2019 - 15:30

That is exactly the problem. HTTP clients can (and will) use several connections at the same time. If they weren't, there would no problem.

 

Anudanan can you share your patch, so I can have a look?


* Wavefrontier T90 with 28E/23E/19E/13E/9E/4.8E/0.8W/5W via SCR switches 2 x 2 x 6 user bands
* Ziggo digital cable TV (FTA)
I don't read PM -> if you have something to ask or to report, do it in the forum so others can benefit. I don't take freelance jobs.
Ik lees geen PM -> als je iets te vragen of te melden hebt, doe het op het forum, zodat anderen er ook wat aan hebben.

Re: streamproxy and seeking in file #26 anudanan

  • Senior Member
  • 995 posts

+14
Neutral

Posted 2 March 2019 - 15:53

I´ve pushed my changes for seeking in a new work branch of github

https://github.com/a...y/tree/work/src

 

Same changes have a prototype character ;-), but it works fine on my uno4kse boxes with APPs and VLCs as a client

 

I moved the fork into the clientsocket file to have in the parent process the knowledge of the movie etc,

 

My daughter uses that from finnland over the internet for streaming movies from my box in germany. It works very good. Also nice is the feature of streamproxy to give the bitrate parameter together with the URL. Is works perfect with dreamplayer on android.


Receiver:2 x Uno4k SE (PLI 7.0 rel), 1 x ET9200 (PLI 4.0), NAS: 2 x QNAP 410, TV: LG 65C8llla, LG 47LB570V, LG 42LM615S, Sound: Yamaha RX-v663, Teufel System 5 THX

Re: streamproxy and seeking in file #27 anudanan

  • Senior Member
  • 995 posts

+14
Neutral

Posted 2 March 2019 - 16:06

Some other change are inside the work branch. I have synchronized the changings of enigma and streamproxy changings (notify) with the streaming clients. The changings are now delayed until the clients are terminated. I´ve have done this to make sure that the clients detection works because after changing parameters the streamproxy makes a restart.

 

I don´t wont to loose the relationship between parents and childs.


Receiver:2 x Uno4k SE (PLI 7.0 rel), 1 x ET9200 (PLI 4.0), NAS: 2 x QNAP 410, TV: LG 65C8llla, LG 47LB570V, LG 42LM615S, Sound: Yamaha RX-v663, Teufel System 5 THX

Re: streamproxy and seeking in file #28 Erik Slagter

  • PLi® Core member
  • 45,327 posts

+497
Excellent

Posted 2 March 2019 - 16:27

Maybe we should simply drop the feature where more than one stream can be active at the same time.

 

My idea:

 

- make the config file selectable from the command line (e.g. streamproxy -c /etc/enigma2/streamproxy-1.conf)

- drop the fork and handle the request from the listener.

- keep monitoring the accept socket; if a new connection comes in, drop the current connection and proceed

- for streaming multiple streams, people can use port 8001, directly to enigma, which keeps allowing it that way

- if someone has a receiver that can transcode more than one stream, they can startup a second streamproxy with an alternate streamproxy.conf, that contains an alternate tcp port (e.g. 8003)

- the only drawback is that you need to specify either first or second streamproxy (tcp port) to your client (app, etc)

 

I think the transcoding device node then also should be mentioned in the streamproxy.conf file.


Edited by Erik Slagter, 2 March 2019 - 16:28.

* Wavefrontier T90 with 28E/23E/19E/13E/9E/4.8E/0.8W/5W via SCR switches 2 x 2 x 6 user bands
* Ziggo digital cable TV (FTA)
I don't read PM -> if you have something to ask or to report, do it in the forum so others can benefit. I don't take freelance jobs.
Ik lees geen PM -> als je iets te vragen of te melden hebt, doe het op het forum, zodat anderen er ook wat aan hebben.

Re: streamproxy and seeking in file #29 anudanan

  • Senior Member
  • 995 posts

+14
Neutral

Posted 2 March 2019 - 16:40

The use of different ports is not so comfortable for the users of boxes with more than 1 transcoding HW.

The other idea maybe to use a threads instead of processes. Than all streaming threads are in the same adresspace and a child thread can handle the new connection which comes up and is a seek


Receiver:2 x Uno4k SE (PLI 7.0 rel), 1 x ET9200 (PLI 4.0), NAS: 2 x QNAP 410, TV: LG 65C8llla, LG 47LB570V, LG 42LM615S, Sound: Yamaha RX-v663, Teufel System 5 THX

Re: streamproxy and seeking in file #30 anudanan

  • Senior Member
  • 995 posts

+14
Neutral

Posted 2 March 2019 - 19:07

The idea with thread can be similar to your idea with more than one streamproxy processes.

 

 

- streamproxy creates at first directly threads for each HW transcoder.(on uno4kse one thread, on duo4k/ultimo4k two threads.

- The parent thread monitors similar as today the socket.

- after detection of the new client the parent gives the socket information to the thread which is idle from streaming or to the thread which can make seeking if the new request is a seek for a running stream.

- I think for the management of a shard datastructur (the new array clientutil for seek detection with PID, requested file, ip.addr) there is a need of locks because all thread can change data of this array. But that is normal for thread programming.

 

did you have done thread programming until today ? I´m not until today on linux, but on other embedded operating systems. I think it is an interesting idea.


Edited by anudanan, 2 March 2019 - 19:11.

Receiver:2 x Uno4k SE (PLI 7.0 rel), 1 x ET9200 (PLI 4.0), NAS: 2 x QNAP 410, TV: LG 65C8llla, LG 47LB570V, LG 42LM615S, Sound: Yamaha RX-v663, Teufel System 5 THX

Re: streamproxy and seeking in file #31 Erik Slagter

  • PLi® Core member
  • 45,327 posts

+497
Excellent

Posted 2 March 2019 - 20:17

It can be done using threads, but it's more complex. You need to have all objects on the stack. If they're on shared storage (like global, static or malloc/new'ed) you must be prepared to regulate access and be sure that every thread is prepared they the object.

 

Having said that, threads are favoured towards processes, so if one would manage to get it working, it would be welcomed.


* Wavefrontier T90 with 28E/23E/19E/13E/9E/4.8E/0.8W/5W via SCR switches 2 x 2 x 6 user bands
* Ziggo digital cable TV (FTA)
I don't read PM -> if you have something to ask or to report, do it in the forum so others can benefit. I don't take freelance jobs.
Ik lees geen PM -> als je iets te vragen of te melden hebt, doe het op het forum, zodat anderen er ook wat aan hebben.

Re: streamproxy and seeking in file #32 anudanan

  • Senior Member
  • 995 posts

+14
Neutral

Posted 2 March 2019 - 20:41

I  think your code doesn´t have global or  static definitions which are ciritcal for threads whichs provides the streams. I think most of them are on stack of the threads if the code from clientsocket and above runs under thread control.

 

Only the parameter from streamproxy.cpp to clientsocket.cpp are ciritical, this must be changed ot an other mechanism to inform the waiting thread for the new streaming jobs

 

But you are right, it is not easy to change in some hours


Edited by anudanan, 2 March 2019 - 20:45.

Receiver:2 x Uno4k SE (PLI 7.0 rel), 1 x ET9200 (PLI 4.0), NAS: 2 x QNAP 410, TV: LG 65C8llla, LG 47LB570V, LG 42LM615S, Sound: Yamaha RX-v663, Teufel System 5 THX

Re: streamproxy and seeking in file #33 anudanan

  • Senior Member
  • 995 posts

+14
Neutral

Posted 2 March 2019 - 22:39

My idea today is

- starting the streaming threads (one or two today) directly on start of streamproxy

- the streamingthreads waiting on jobs

- run the code as today in my work branch in the parent thread until 

https://github.com/a...socket.cpp#L288

 

- see if a streaming thread is  idle or streaming a movie which gets a seek

- collect all streaming params for the streaming thread into the class clientutil array (ervice, fd, stb_traits, streaming_parameters, config_map etc). In index 0 for the first thread. in index 1 for the second thread...

- give a start signal for wating thread for a new streaming job or a seek information for the movie streaming thread which is polled in the filestreaming loop from the filestreaming code

 

- the streamjobs starts with the code similar to the code starting at 

https://github.com/a...socket.cpp#L288


Edited by anudanan, 2 March 2019 - 22:41.

Receiver:2 x Uno4k SE (PLI 7.0 rel), 1 x ET9200 (PLI 4.0), NAS: 2 x QNAP 410, TV: LG 65C8llla, LG 47LB570V, LG 42LM615S, Sound: Yamaha RX-v663, Teufel System 5 THX

Re: streamproxy and seeking in file #34 Erik Slagter

  • PLi® Core member
  • 45,327 posts

+497
Excellent

Posted 3 March 2019 - 09:45

I'd say, make a POC (proof of concept) ;)


* Wavefrontier T90 with 28E/23E/19E/13E/9E/4.8E/0.8W/5W via SCR switches 2 x 2 x 6 user bands
* Ziggo digital cable TV (FTA)
I don't read PM -> if you have something to ask or to report, do it in the forum so others can benefit. I don't take freelance jobs.
Ik lees geen PM -> als je iets te vragen of te melden hebt, doe het op het forum, zodat anderen er ook wat aan hebben.

Re: streamproxy and seeking in file #35 anudanan

  • Senior Member
  • 995 posts

+14
Neutral

Posted 3 March 2019 - 10:14

I will see if I have time in the next weeks ;-)


Receiver:2 x Uno4k SE (PLI 7.0 rel), 1 x ET9200 (PLI 4.0), NAS: 2 x QNAP 410, TV: LG 65C8llla, LG 47LB570V, LG 42LM615S, Sound: Yamaha RX-v663, Teufel System 5 THX

Re: streamproxy and seeking in file #36 anudanan

  • Senior Member
  • 995 posts

+14
Neutral

Posted 4 March 2019 - 17:09

I´ve today a very little poc running  with a thread for making filestreaming.  Now I will check if a seek detection is found, how can give the thread the new parameter and setup the seek command. Today the thread poll a datastructur with the data for the new streaming jobs. Maybe there is a better war so wait until the new job data is available, but that is a work after the seeking works fine.

 

@erik:

If I had a successfull  and faster seek in a movie in my poc then I can show you the prototype code


Edited by anudanan, 4 March 2019 - 17:09.

Receiver:2 x Uno4k SE (PLI 7.0 rel), 1 x ET9200 (PLI 4.0), NAS: 2 x QNAP 410, TV: LG 65C8llla, LG 47LB570V, LG 42LM615S, Sound: Yamaha RX-v663, Teufel System 5 THX

Re: streamproxy and seeking in file #37 anudanan

  • Senior Member
  • 995 posts

+14
Neutral

Posted 4 March 2019 - 20:11

Wow, I´m very surprised now how smoothy the seeking now works in my poc.

 

Today the code is a very prototype code and can only do streaming of files today. I will work on it to because i think it is a very good idea to make seeking better than today


Receiver:2 x Uno4k SE (PLI 7.0 rel), 1 x ET9200 (PLI 4.0), NAS: 2 x QNAP 410, TV: LG 65C8llla, LG 47LB570V, LG 42LM615S, Sound: Yamaha RX-v663, Teufel System 5 THX

Re: streamproxy and seeking in file #38 anudanan

  • Senior Member
  • 995 posts

+14
Neutral

Posted 4 March 2019 - 22:44

Now it works also with livestreaming in the thread architecture

 

But only for broadcom transcoding.

 

@erik:

what does streamproxy with direct streaming? In the code there are line for that but I haven´t use it in the past.


Receiver:2 x Uno4k SE (PLI 7.0 rel), 1 x ET9200 (PLI 4.0), NAS: 2 x QNAP 410, TV: LG 65C8llla, LG 47LB570V, LG 42LM615S, Sound: Yamaha RX-v663, Teufel System 5 THX

Re: streamproxy and seeking in file #39 anudanan

  • Senior Member
  • 995 posts

+14
Neutral

Posted 4 March 2019 - 23:18

Here the prototyp sources of the first poc

 

https://github.com/a...ork-threads/src


Receiver:2 x Uno4k SE (PLI 7.0 rel), 1 x ET9200 (PLI 4.0), NAS: 2 x QNAP 410, TV: LG 65C8llla, LG 47LB570V, LG 42LM615S, Sound: Yamaha RX-v663, Teufel System 5 THX

Re: streamproxy and seeking in file #40 anudanan

  • Senior Member
  • 995 posts

+14
Neutral

Posted 5 March 2019 - 09:56

@erik:

Is it neccessary to integrate the direct streaming without transcoding also in streamproxy with threads?

In my PoC these functions are not ready for use

 

If yes, I can do it, but acutally I don´t know, if anyone need this


Edited by anudanan, 5 March 2019 - 09:56.

Receiver:2 x Uno4k SE (PLI 7.0 rel), 1 x ET9200 (PLI 4.0), NAS: 2 x QNAP 410, TV: LG 65C8llla, LG 47LB570V, LG 42LM615S, Sound: Yamaha RX-v663, Teufel System 5 THX




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users