All you need to know is your upload and download bandwidth, and then throw away at least 20% of your download speed, more if you want less jitter in the mentioned cases.
Modems are usually the bottleneck and know the link speed, they could do the above automatically. Even finetuning can happen automatically, by monitoring the delays and adjusting the limits if latency is too high.
It may not be perfect, but it's a hell of a lot better than the default.