How do we stop our dog from growling when people pay attention to other dogs rather than him?

Our 1 1/2 year old neutered mini schnauzer loves attention. He loves other dogs! He loves other people! We've taken him on multiple play dates, he's been properly socialized since he was a small puppy, and gets along with everyone... usually.

The issues occur when another dog comes up to us and wants to say hi. He will growl. He doesn't act aggressive, or get too mouthy, but he'll definitely start throwing his weight around. He will bark sometimes, too. This has now started also happening at the dog park, when another owner stops paying attention to him and goes to greet a different dog.

We're not sure the best course of action here. We started putting him in 'no fun' time outs when we're out and doing this (pulling him away from others and not letting him socialize for a minute or two). If he starts behaving like this frequently we're worried about long term consequences.

He doesn't do this at home when it's just myself, him, and my husband. He likes attention, but doesn't bark or demand it.

Halp!