<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - module-switch-on-port-available will only select unavailable ports when a new sink or source appears"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=100451#c6">Comment # 6</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - module-switch-on-port-available will only select unavailable ports when a new sink or source appears"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=100451">bug 100451</a>
              from <span class="vcard"><a class="email" href="mailto:tanuk@iki.fi" title="Tanu Kaskinen <tanuk@iki.fi>"> <span class="fn">Tanu Kaskinen</span></a>
</span></b>
        <pre>(In reply to Vivek Dasmohapatra from <a href="show_bug.cgi?id=100451#c5">comment #5</a>)
<span class="quote">> Seems bizarre to have a port selector that can't ever return an available
> port.</span >

That would be bizarre, but that's not how the function works.

If the name parameter is set, some other module has already selected a port. If
that port is available, new_sink_source() will return NULL, and as a result,
the port choice is not overridden. If the port that the other module chose is
unavailable, then new_sink_source() will override that with what
find_best_port() returns.

If the name parameter is not set, then there shouldn't be need for
new_sink_source() to do anything, but for some reason it nevertheless first
picks the highest priority port. If that port is available, then
new_sink_source() returns NULL. As a result, no port will be selected, and
pa_sink_new() will do its own selection logic. If the highest priority is
unavailable, then new_sink_source() will return what find_best_port() returns.
This is bizarre, but harmless.

If you want to change the code, I would suggest removing the port selection
logic from module-switch-on-port-available and fix all other modules so that
they never choose an unavailable port (actually module-device-restore is the
only other module that configures the initial port of new sinks and sources).</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
          <li>You are the QA Contact for the bug.</li>
      </ul>
    </body>
</html>