Commit graph

68 commits

Author SHA1 Message Date
Wim Taymans
e142e40cfe stream: set latency variable correctly 2020-09-15 13:22:41 +02:00
Wim Taymans
67f4acaf1d pulse: try hard to always create a valid channel map
Unknown channel names are mapped to aux channels.
Add extra AUX channels when we don't know the channel layout.
This makes sure apps always receive valid channel layouts so they
don't abort (pactl).
2020-09-14 11:06:11 +02:00
Wim Taymans
38f8c9c6c8 pulse: always notify of available data
If we have some data available for capture, always report this
to get the lowest latency possible.
2020-09-11 15:34:30 +02:00
Wim Taymans
8f75056689 pulse: improve handling of buffer attributes
Repect minreq and fragsize for playback and capture.
Try to configure tlength at 2 seconds, minreq at around 25ms. Should
greatly improve compatibility with audacious and mpv.
Count since_underrun correctly.

Fixes #278
2020-09-11 13:08:20 +02:00
Wim Taymans
6eb4b552ad stream: unmark Not Implemented methods
_prebuf and _trigger are not implemented but should not really cause
any trouble, so just debug them without warning.
2020-09-11 11:41:29 +02:00
Wim Taymans
3b7f2c527c stream: call _done after operation callback 2020-09-11 11:40:57 +02:00
Wim Taymans
af64666716 pulse: call operation_done at end of callback 2020-09-09 13:48:01 +02:00
Wim Taymans
289a8e86ca stream: move some debug to trace 2020-09-03 13:19:55 +02:00
Wim Taymans
157b15d643 pulse: implement load_module of null-sink
Implement load_module of the null sink
Keep track of sink_input/source_output linked sink/source in a
better way.
Associate the global with our streams and the streams with the
global.
Don't emit the sink_input/source_output before there is a linked device
and before our stream is READY.
Improve server info to make it more look like pulse.
2020-08-20 18:00:00 +02:00
Wim Taymans
cde6b99890 stream: call latency_update callback 2020-08-19 16:49:30 +02:00
Wim Taymans
5037a97690 stream: call started callback when started
.. instead of the suspended callback
2020-08-19 16:49:02 +02:00
Wim Taymans
bb323a82a7 stream: call the moved_callback when moved 2020-08-19 16:48:25 +02:00
Wim Taymans
4e17d4cdf8 pulse: don't leak device_name
Small cleanups
2020-08-19 16:47:52 +02:00
Wim Taymans
1f298cb5bf stream: guard against old timestamps 2020-08-19 16:02:52 +02:00
Wim Taymans
6aa6b4eac7 pulse: improve debug 2020-08-18 12:12:49 +02:00
Wim Taymans
9290137931 pulse: handle NULL pw_stream
The pipewire stream might have been destroyed when the pulse stream
is freed.
2020-08-04 18:20:20 +02:00
Wim Taymans
653465a1b1 pulse: handle device_name of NULL as error 2020-08-04 18:15:19 +02:00
Wim Taymans
979fec288e stream: let the operation emit the TERMINATED state
When we disconnect, let the operation emit the TERMINATED state
because some apps expect this state to be emited asynchronously.

Makes GStreamer pulsesink work.

Fixes #210
2020-08-04 18:13:37 +02:00
Wim Taymans
94c23b7ed1 pulse: handle memory user_data of NULL 2020-08-04 18:11:58 +02:00
Wim Taymans
007c50df56 stream: clear user data on flush
Or else we might add the memory to the free list again when
we free the buffers. Fixes audacity using the pulseaudio backend
in portaudio.
2020-08-03 21:53:51 +02:00
Wim Taymans
2d76a00e20 stream: fix printf modifier 2020-08-03 09:56:37 +02:00
Wim Taymans
a5f85deabe pulse: also use PIPEWIRE_LATENCY as a fallback 2020-07-30 18:23:23 +02:00
Wim Taymans
aee95e76bb pulse: use the right sample spec 2020-07-30 18:22:03 +02:00
Wim Taymans
18b4aee677 Parse format param and store in node 2020-07-29 14:29:03 +02:00
Wim Taymans
55bef12cda pulse: take queued data into account when asking for more
Don't use always ask for the maximum amount of data in the
write_callback but subtract the queued amount of data from it or else
we will queue too much and cause huge lag.

Fixes #258
2020-07-29 09:49:06 +02:00
Wim Taymans
cb91e9c536 stream: improve flags 2020-07-28 10:49:33 +02:00
Wim Taymans
6184c0fe32 keys: add stream to avoid remixing channels 2020-07-28 10:16:04 +02:00
Wim Taymans
cc0727e62f pulse: remove useless leaked property 2020-07-21 17:39:08 +02:00
Wim Taymans
2909786eb2 stream: put target string in node.target 2020-07-20 16:27:50 +02:00
Wim Taymans
5d0a1c4838 stream: remove wrong warning 2020-07-20 13:27:25 +02:00
Wim Taymans
2991a814cd pulse: wait for READY before calling callbacks 2020-07-07 13:42:56 +02:00
Wim Taymans
d560499054 stream: handle NULL context 2020-06-24 12:52:50 +02:00
Wim Taymans
64fc8dda20 stream: check for NULL context
If a stream was killed, the context is cleared. Disconnecting a killed
stream should not crash but return BADSTATE.
2020-06-08 11:58:32 +02:00
Wim Taymans
ee5d6b4451 pulse: add more checks 2020-06-05 12:43:26 +02:00
Wim Taymans
cab645d155 stream: we can get the index before we are ready 2020-05-12 17:50:24 +02:00
Wim Taymans
a7d8e805ac stream: do some extra checks 2020-05-11 14:16:19 +02:00
Wim Taymans
df8ad59e37 stream: fix writable size when no timing info received
Always report that we can write a buffer, even when we have
not yet received timing info. Fixes stalled spotify.

Fixes #238
2020-05-11 11:30:24 +02:00
Wim Taymans
e6ccc72feb fix compiler warnings 2020-05-08 20:40:02 +02:00
Wim Taymans
4e44da6c4b pulse: hide the pa_proplist implementation
Hide the proplist implementation.
Add some more methods to update the proplist
Make sure our integration functions only use exported symbols
so that they even work against the original pulse implementations
in case they are loaded first.

Fixes #236
2020-05-08 14:17:45 +02:00
Wim Taymans
9c1ac4e850 pulse: implement cork now 2020-04-28 12:18:57 +02:00
Wim Taymans
aafd1e7298 improve debug
Improve log so that debug level 3 gives a reasonably readable overview
of what is going on.
2020-04-22 12:47:18 +02:00
Wim Taymans
dfd1adf816 stream: always request one block
Don't request too many bytes in one go but one block at a time.
This slowly fills up the queue.
2020-04-15 17:21:42 +02:00
Wim Taymans
262d0ee7d2 pulse: count queued bytes 2020-04-15 17:11:49 +02:00
Wim Taymans
bf95887a02 pulse: improve timing
Make writable size more accurate by using the clock. mplayer uses this
to check if the clock is advancing.
Remove requested_bytes, we can use ready_bytes for the ready bytes
and use the queued bytes for playback.
Reset after a flush, wait for a new timing update.
2020-04-15 16:19:42 +02:00
Wim Taymans
30fac2b242 stream: improve timing
Dequeue the input buffers so that we can calculate the available
bytes to read.
2020-04-14 16:50:29 +02:00
Wim Taymans
6d24a034fb stream: improve timing
Improve the delay, make sure we don't overflow
Flush and free pending memory
Keep track of requested_bytes
2020-04-14 10:22:34 +02:00
Wim Taymans
4fd43733c2 pulse: more work on timings
The read_index should not include the delay to the device.
Keep a separate lis of memory blocks filled by the app and give
those to the stream when we can. This is because pulse can allocate
an infinite amount of buffers but we must cycle between a fixed
number. Use DYNAMIC_DATA to avoid memcpy.
Use the right requested_bytes in the write_callback. This should
be the tlength - the amount of bytes we already queued.
_get_time() should include the sink latency.
2020-04-13 19:44:12 +02:00
Wim Taymans
b01c264c5c pulse: improve timing
Keep track of written bytes and use this to calculate the latency.
2020-04-12 20:47:33 +02:00
Wim Taymans
7febf7ea25 improve debug 2020-04-06 18:01:19 +02:00
Wim Taymans
4346cad322 pulse: improve debug of events 2020-04-02 15:28:24 +02:00