-
-
Notifications
You must be signed in to change notification settings - Fork 82
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
Add adapter restrictions #1117
Add adapter restrictions #1117
Conversation
* Handle CWs out of cycle * Change CW time after calculate expire time
… and only CAIDs accepted by the CAM
Eventually all parameter parsing should be factored out to separate functions like this so they can be tested in isolation
- specifying "~" made the hostname contain "~" if an offset was specified - specifying an offset truncated the hostname
Fixes: stream.c:611:5: warning: implicit conversion from 'int' to 'char' changes value from 128 to -128 [-Wconstant-conversion] copy16(rtp_buf, len + 0, (uint16_t)0x8021); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../src/minisatip.h:34:27: note: expanded from macro 'copy16' a[i] = ((v) >> 8) & 0xFF; \ ~ ~~~~~~~~~~~^~~~~~ 1 warning generated.
Some SAT>IP clients send the parameter "bw" (DVB-T/C) in a incorrect range. The specifications indicate that acceptable values are: "5”, ”6”, “7”, “8", “10”, “1.712”. Therefore values like "bw=8000" or "bw=8000000" are incorrect. But we can handle them. In fact previously these requests will generate an overflow internaly in the value but the request will be served. This patch fixes this recalculating incorrect values.
A new parameter called "--adapter-restrictions" is added to enforce some adapter limitations when selecting a free tuner. The three limits are (in order of checking): number of used services, number of total pids, consumed bandwith. By default for all adapters the limits are "-1 : -1 : -1". But if you want to limit the adapter #1 to three simultaneous services only use "1:3:-1:-1". Note: The calculation of the current bandwith is not currently implemented. Therefore it really doesn't work.
Hi @catalinii and @Jalle19 , This PR implements the request #1114. Please, note that the code is simple. The most large function is the parsing of the parameters. The data of the used pids and services it's already calculated. The only missing is the bandwith. All the code is here, but I don't know how to calculate it for each individual adapter. So I request your help to complete this. All my tests limiting the number of services (2 or 3 for example) and the pids (10, 15, 20, etc.) work without troubles. Regards. |
When PMT support is not enabled the limits of the services will not be calculated (so it will be disabled).
Clearly we have different opinions on what "simple" means 😄 |
@lars18th there is another point that is not obvious:
So even if the BW at adapter level is <15Mbits, you will still send > 15Mbits over the network. |
Hi @catalinii , Thank you for the response. Regarding your question, what I want to implement regarding the limit of the bandwith is the "adapter bandwith" and not the network bandwith. The problem is that not all adapters/drivers/devices can handle the full bandwith of a transponder. And then if you put a limit, then you have the option to not serve more requests over this limit. For sure the limit is reliable for CBR and not true for VBR. However, with a single 10Mbps limit you will not get add more services if the current bandwith is going from 10-15Mbps for example. That's the simple idea. And the limit have more sense if you are using the Futhermore, I'll try to simplify the code a bit more. Note: If you want, after committing this we could try to add a "client network bandwidth limit". In this case, the idea would be to limit the "total output network bandwidth" to a maximum, regardless of the number of adapters. |
Hi @Jalle19 ,
If you remove the parsing of the command line parameter the code is very simple. Just a few lines of code. |
This adds the calculation of the bandwith at adapter level (individually), and the check of the limit.
Hi @catalinii , I've implemented the bandwith adapter calculation. Therfore the check is complete. Please, check it and merge. |
Hi @Jalle19 and @catalinii , If you aren't testing this PR because the erros in CI, then the problem is not with my code. It's because this commit 8d33e93 that has broken the binaries build. So please fix this, and check my PR. I'm waiting for merging it. |
@lars18th this PR takes the current get_adapter_code to a place where is really too complex and hard to reason about. The motivation for that as I said is to support devices that are not supported by their vendor. As I said is not worth merging it. |
Hi @catalinii ,
Sorry, but I don't agree with that. Let me to comment these key points about devices:
Let me to comment other points regarding the PR too:
So please, don't be wrong. This patch has sense for several users. And because it doesn't change anything by default I feel it's preferable to merge it. Anyway, please comment if you want about point per point of the discussed points. Perhaps I'm really missing something. |
I feel it would be better to document which these devices are so people don't buy them, instead of working around their shortcomings. |
Sorry? You can recommend whatever you want. However, manufacturers will continue to provide what they want. That's the current situation. And minisatip can handle any type of devices. And this PR is proof that this is true. Sorry @Jalle19 and @catalinii , but I'm very confused about your reluctance to merge a simple/clear/useful/non-intrusive patch that provides very interesting functionality. Just because you don't seem to want to boost "underpowered and poorly supported hardware". My intention is to enhance this software, and in my environment the physical tuner is not very relevant.... I'm using from Digital Devices to low cost ALi based STB (very, very, very bad and closed source). But with a central minisatip I can manage everything together. And in case you are still thinking about it, I don't recommend buying certain low-cost Enigma2-based products with outdated, poorly implemented, unsupported, absurdly limited and closed-source drivers. But what's wrong with adding this functionality? Regards. |
I think we have different opinions on what "clean and non-intrusive" means. Also, "useful" is a matter of opinion since minisatip has been around for at least 7 years without this coming up as a feature request. I just want to keep the code simple and not support odd usecases. |
Hi @Jalle19 , It's clear that we share different point of views. However, let me to add some comments:
Well, how many lines are in this PR? Please, take note that the functionality to limit the tuners are only in the function It's non-intrusive? If you apply the patch and restart minisatip with identical parameters nothing changes. So we can considerer non-intrusive... or not?
I not agree 100% with this sentence. A lot of time ago I've requested to @catalinii to support something more smart when selecting between multiple tuners. Futhermore, I've help in implementing the source mapping of adapters, more complex that this functionality and only used by some users (my included). Plus other changes too. Anyway, I can understand that perhaps you will not need/use this functionality, but for other users it has sense.
It will continue to have the same simplicity. The code of the patch reflects it. So I finally see that I'm not going to convince you. I just hope that my effort and time invested in this project will not be questioned and thrown away. |
As a compromise, could we consider just having a limiter for the number of services per adapter? |
Hi @catalinii and @Jalle19 , I've resolved the conflicts with this patch, but now the tests fail because the out-of-sync with the current master branch. I feel I need to return to create a PR to provide this change. However, BEFORE THAT I need to know your current point of view. Please, take note of the effort to contribute to the project and be as open-minded as you can:
Said that, let me to explain the use cases of this new functionality:
After this explanation about the sense of this enhancement, please review the code and check the real simplicity of it:
Therefore, I feel this could be added without any problem. But I need your confirmation. My idea is that if you accept this then I'll remake the PR for the current master branch to be ready to merge it. You agree? |
From the use cases you listed, numbers 2 and 3 are IMO reasonable scenarios. Perhaps we could add just support for "max services" and skip "max pids" and "max bandwidth" to keep things simple? |
Closing this for now, we can re-open it when you have time to work on it again 🙏 |
Hi @Jalle19 , No problem. I'm using it for a lot of time, but I've more "smart" options for the tuner selection. So I'll try to implement all-in-one in a new P.R. in the future when I'll have sufficient time. Regards. |
A new parameter called "--adapter-restrictions" is added to enforce some adapter limitations when selecting a free tuner. The three limits are (in order of checking): number of used services, number of total pids, consumed bandwith. By default for all adapters the limits are "-1 : -1 : -1". But if you want to limit the adapter #1 to three simultaneous services only use "1:3:-1:-1".
Note: The calculation of the current bandwith is not currently implemented. Therefore it really doesn't work.