Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zero Client upstream bandwidth idle disconnect timeout option #3

Open
chron0 opened this issue Feb 9, 2015 · 7 comments
Open

Zero Client upstream bandwidth idle disconnect timeout option #3

chron0 opened this issue Feb 9, 2015 · 7 comments
Assignees

Comments

@chron0
Copy link

chron0 commented Feb 9, 2015

While testing mjpg-relay for our 3D Printer (https://apollo.open-resource.org/mission:resources:picoprint) one question came up : It seems that even if there is no client connected, mjpg-relay is still connected to mjpg-streamer and pulling the stream. I can see a number of good reasons to keep it open but at the same time, here the goal is to consider upstream bandwidth something precious, that's why there is the desire to have a relay in the first place :) I haven't looked at the code yet but it would be great to have at least an option to have it disconnect, while no clients are accessing the relay (even at a cost of some initial delays).

Maybe I was just blind and didn't see it in the options, but I would consider it a great feature to have a

$ python relay.py -T 30

argv, defining a period in seconds (default say 30), if set, after which mjpg-relay idles/throttles/disconnects the upstream source and shows a dummy image (Connecting...) similar to missing feed, so that the first new user after the timeout gets the connect image while the link to the upstream source is re-established.

I might be able to hack something together, but I don't know if I will find the time and how long it will take me to get into the internals of mjpg-streamer, so if someone else is faster than me, and has a similar need, please share and send a pull-request to mjpg-relay :)

And thanks for sharing mjpg-relay, it works great with mjpg-streamer so far.

@OliverF
Copy link
Owner

OliverF commented Feb 9, 2015

It does indeed make sense in most cases to disconnect from the source when no clients are connected. I'm confident it wouldn't take too long to implement - I'll have some time this week to look into it.

@chron0
Copy link
Author

chron0 commented Feb 9, 2015

Sweet, then I will hold my ugly hacking horses and will be ready to test & deploy anytime.

@Alex9779
Copy link

Alex9779 commented Sep 4, 2015

Is this still active?
I am really looking forward for this enhancement. Unfortunately my python skill do not cover to do this on my own atm...

@OliverF
Copy link
Owner

OliverF commented Sep 21, 2015

Apologies for the delay, I've been busy lately. I've got a few updates in the works for mjpeg-relay, and this feature is one of them.

@chron0
Copy link
Author

chron0 commented Nov 12, 2015

Sweet, in the past it wasn't much of an issue where we had 100MBit down/10MBit upload bandwidth. Now we're only having access to a 10MBit down/1MBit upload line, so we had to shut down the camera stream to save bandwidth - so it would be really handy now :)

@disccomp
Copy link

@OliverF Thank you for your great work on this. This project is my first python deployment and it works great. However I too am concerned about the bandwidth as I am pulling streams from multiple cameras.

I made an attempt at trying to disconnect the sourceStream when (self.getClientCount() == 0 and self.streamQueue.empty()), but I didn't quite get it working, it was fighting with the code in broadcast or it wouldn't restart the connection when a client queued up.

@OliverF OliverF self-assigned this Dec 6, 2015
@aziraphale
Copy link

Did we ever get anywhere with this feature?

This project (if this feature was implemented) is exactly what I'm looking for right now - incidentally to do the same 3D-printer-cam thing that OP's doing.

This project will already let me save my poor Raspberry Pi from handling several streams at once, but ideally I'd be relaying the stream via my 300 Mbps dedicated server rather than requiring everyone to connect to my home server where I only have 20 Mbps upstream... I'm thankfully not charged for or limited with upstream usage, but even so, keeping a 1-2 Mbps webcam stream active 24/7 isn't ideal! :)

I'm a PHP/JS dev unfortunately (trying to learn Python, but it's early days!), so I can't really help with this :( Happy to throw a few £ in the direction of whoever can get this implemented, though <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants