[pulseaudio-discuss] paprefs port setting
Nico
pulseaudio-discuss at nicohood.de
Tue Nov 1 16:37:42 UTC 2016
On 10/31/2016 08:13 PM, Tanu Kaskinen wrote:
> On Mon, 2016-10-31 at 19:25 +0100, Nico wrote:
>> On 10/31/2016 04:49 PM, Tanu Kaskinen wrote:
>>> On Mon, 2016-10-31 at 15:02 +0100, NicoHood wrote:
>>>> Hye,
>>>>
>>>> I am currently actively using pulseaudio for streaming audio over
>>>> network. I found RTP the most promesing method for me. However there is
>>>> a problem I ran into which I'd like to solve. I've also prepared a
>>>> possible solution.
>>>>
>>>> My goal is to stream music via RTP and paprefs. Quick setup on the
>>>> sender side and quick setup on the receiver side if also pulse+paprefs
>>>> is used. Now my receiver is a raspberry pi which uses kodi + alsa as
>>>> pulse is too slow on it for some reason (general lag, even for local
>>>> playback). But kodi also can playback an RTP stream directly:
>>>>
>>>> Create a file named pulse.strm with the content: rtp://@224.0.0.56:46400
>>>> Now the problem is that the port always changes, as paprefs does not set
>>>> any specific port. The module it uses is module-rtp-send:
>>>> https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules/#index38h3
>>>>
>>>> I am wondering if you can set the default port for this module globally
>>>> via config file. If not the only way to fix this issue is to provide a
>>>> way for paprefs to use a fixed port. Due to the fact that the source
>>>> port is always random and the pulse sink listens to all ports it would
>>>> not matter much if the sender would always send with a fixed port. Using
>>>> a fixed port is simple to patch and works for me:
>>>>
>>>> Just change line 537 of paprefs.cc to the following:
>>>>
>>>> changeSet.set(PA_GCONF_PATH_MODULES"/rtp-send/args1",
>>>> Glib::ustring(loopbackEnabled ? "source=rtp.monitor loop=1 port=46400" :
>>>> "source=rtp.monitor loop=0 port=46400"));
>>>>
>>>> Now paprefs creates a sender with the same port. You may want to use a
>>>> different port, but basically that'd solve the problem. And existing
>>>> setups would still work.
>>>>
>>>> Is there a way to get this fix applied? Or are there any other
>>>> suggestions? FYI: the same also applies to vlc playback, not only kodi.
>>> The first question comes to mind is why do we randomize the port in the
>>> first place? Is it for security reasons or what? Given that the port is
>>> selected from a pool of only 256 ports, the reason is probably not
>>> really security-related. Maybe it's to make conflicts unlikely if two
>>> computers in a network load module-rtp-send?
>>>
>>> Ideally paprefs would let the user choose between a random port or a
>>> manually selected one. Would you be willing to implement this? If not,
>>> changing paprefs to just pick one port as you suggested would probably
>>> still be an improvement over the status quo. The UI should indicate
>>> what the port is, though.
>>>
>>> paprefs should also detect the situation where the gconf key is still
>>> set to the old value (i.e. no port in the module argument list) and
>>> change it to the new value automatically.
>>>
>> So I installed the legacy glade gtk2 tool and edited the source a bit.
>> It does not seem to be super complicated. However I am wondering how to
>> design the gui, as we should keep things simple and intuitive. I have
>> the following options:
>> * Add a checkbox to use a fixed port xyz
> I think radio buttons with two options would be nicer, because if the
> checkbox label says "use fixed port xyz", it's not clear what happens
> when the checkbox is unchecked. Using radio buttons would allow an
> explanatory label for both options.
>
>> * Add a checkbox + textentry for a fixed user selectable port
>> * Add a checkbox + dropdown menu for a fixed user selectable port of a list
>>
>> The first one is quite simple and suit everyones needs.
>> The second I am worrying about the text->number conversion and the
>> update of the module. As the user types you'd update the module over and
>> over which is bad. and the user could input invalid ports.
>> The last one seems to be the most promesing. A few options to possibly
>> also have different streams inside your LAN while still keeping the
>> options simple for the user. We could provide like 10 selectable ports
>> or so.
>>
>> Any opinions on that?
> My preference would be checkbox + textentry, or just a textentry with a
> label that says that 0 means a random port. I'm not very familiar with
> GUI programming, but I'd expect there to be some easy way to use a
> textentry in a way that doesn't trigger change for every keypress. For
> example, gedit preferences contain "display right margin at column:",
> and if I edit the number, the setting is applied only when I press
> enter or make the focus move somewhere else.
>
> That said, I'm not against any of the options you presented.
>
Okay I found someone who can give me valueable feedback about my
problems. So paprefs uses an old gtk version and on top of that libglade
which does not even implement all gtk2 functions (newer is gtkbuilder).
So in order to do exactly what i want i'd need to update the source to
gtk3 to avoid any future problems. Now that I've too little knowledge
and time I want to drop that idea.
So there are mainly 3 options left:
Use a ComboBox with fixed index integer -> portnumber mapping
(workaround, looks too dirty too me)
Use multiple radio buttons in a row to select "auto" or 3 alternative ports
Use a checkbox to use a fixed port xyz.
Now I'd go for the last option as this breaks nothing, the change is
simpler and the fix is good enough if you ask me. That'd be a small but
nice addition to paprefs which does not completely change the app and
its design. I will submit my patch when I am ready, as I dont see the
other 2 alternatives as a good option anyways.
Cheers
Nico
More information about the pulseaudio-discuss
mailing list