resampler: Introduce work frame size (w_fz)

w_fz represents the number of bytes per frame in the resampler stage

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
resampler: Introduce work_channels

work_channels is the number of channels in the resampler stage

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
resampler: Change interface, resampler may return the number of leftover frames

some resampler implementations (e.g. libsamplerate and ffmpeg) do not consume
the entire input buffer; the impl_resample() function now has a return value
returning the number of frames in the input buffer not processed

these frames must be saved in appropriate buffer and presented together with
new input data

also change the parameter names from in_samples, out_samples to in_n_frames,
out_n_frames, respectively (n_frames = samples / channels)

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
resampler: Handle leftover samples, use new return value

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
resampler: Cleanup, rename xxxx_buf_samples to xxxx_buf_size

we measure the capacity of a buffer in bytes, not samples

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
resampler: Add fit_buf() helper funtion for buffer allocation

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
resampler: Prepare to have leftover data in different output buffers

leftover_buf points to the output buffer of a stage containing leftover
data; similar for leftover_buf_size and have_leftover

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
resampler: Cleanup, index of memchunks is not used

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
sink-input, source-output: Don't assume that proplist has been initialized in free()

It's bad form to assume in free() that any member of the struct has
been initialized. I ran into problems with this when I reordered
things in pa_sink_input_new() and pa_source_output_new().
tunnel-new: add cookie module argument

When connecting to a remote server your local generated authentication
cookie is used. If remote server's cookie is different from your local
one you aren't allowed to connect. You can use the cookie argument
or define a wider acl in remote server configuration for
module-native-protocol.
core: make sure win32 sockets remain blocking

Commit 7e344b5 hade the side effect of forcing every socket to
be non-blocking on Windows. This is because of a (documented)
side effect of WSAEventSelect(). So we need to make sure to restore
blocking behaviour afterwards for relevant sockets.
Revert "core: Transparently handle non-blocking sockets on Windows"

This reverts commit c327850d9e4479a0572b7baaf8dafd737586e5a1 as
the workaround in that commit is no longer needed after the real
bug has been fixed.

Conflicts:
	src/pulsecore/core-util.c
bluetooth: Remove a redundant variable
protocol-native: Express XOR asserts more concisely

7 instances of the roundabout asserts were found,
All of them have been replaced with appropriate XOR asserts.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=47493
bluetooth: Use a helper function for setting device_info_valid

The helper function doesn't yet bring much benefits in this form, but
I'll add more functionality later.
bluetooth: Don't mark device valid before it has an adapter

At this point this doesn't make any other practical difference than
making the code more logical, but in the next patch I'll fire the
DEVICE_CONNECTION_CHANGED hook in set_device_info_valid(), and at that
point it's important that the device isn't marked valid too early,
because otherwise external code would see "valid" devices that however
don't have the adapter set.
bluetooth: Fire DEVICE_CONNECTION_CHANGED in set_device_info_valid()

Normally DEVICE_CONNECTION_CHANGED is fired when the first transport
becomes connected, but it may happen that the first transport becomes
connected already before the device properties have been received. In
that case the hook should be fired at the time the device properties
are received. This patch makes the hook to be fired at the right time.
bluetooth: Remove device_remove_all()

The function did two things: set device_info_valid to -1 and called
device_free() for each device in the hashmap. Setting
device_info_valid to -1 was unnecessary. The main purpose of that was
to fire DEVICE_CONNECTION_CHANGED as a side effect, but that hook is
fired anyway in device_free(), as a side effect of removing all
transports. Calling device_free() can be delegated to pa_hashmap, when
freeing or emptying it.
bluetooth: Set device_info_valid to -1 when the device's adapter disappears

When parsing device properties, missing adapter will result in
device_info_valid being set to -1. It is then logical that if the
adapter goes missing at a later point, device_info_valid gets set to
-1 also in that situation.
card: Ensure we still pick a profile even if it's unavailable.

f434087e42b introduced the potential to not select a card profile if
all the profiles were marked as unavailable.

While this is very unlikely, it's a theoretical posibility, so if the
initial choice of a profile fails, try harder.