summaryrefslogtreecommitdiff
path: root/src/modules/module-virtual-sink.c
Commit message (Collapse)AuthorAgeFilesLines
* virtual sources and sinks: Don't double attach a sink input or source output ↵Georg Chini2017-05-181-26/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | on filter load When a filter is loaded and module-switch-on-connect is present, switch-on-connect will make the filter the default sink or source and move streams from the old default to the filter. This is done from the sink/source put hook, therefore streams are moved to the filter before the module init function of the filter calls sink_input_put() or source_output_put(). The move succeeds because the asyncmsq already points to the queue of the master sink or source. When the master sink or source is attached to the sink input or source output, the attach callback will call pa_{sink,source}_attach_within_thread(). These functions assume that all streams are detached. Because streams were already moved to the filter by switch-on-connect, this assumption leads to an assertion in pa_{sink_input,source_output}_attach(). This patch fixes the problem by reverting the order of the pa_{sink,source}_put() calls and the pa_{sink_input,source_output}_put calls and creating the sink input or source output corked. The initial rewind that is done for the master sink is moved to the sink message handler. The order of the unlink calls is swapped as well to prevent that the filter appears to be moving during module unload. The patch also seems to improve user experience, the move of a stream to the filter sink is now done without any audible interruption on my system. The patch is only tested for module-echo-cancel. Bug-Link: https://bugs.freedesktop.org/show_bug.cgi?id=100065
* virtual sinks and sources: Revert commitsGeorg Chini2017-05-181-2/+1
| | | | | | This patch reverts commit db4fbb0121a2577d786cda023a6a439a9734f152 and 3bb94c4e836ca765a36255e416fd8e6cf272ab44. They were the wrong approach to fix the bug (and did not fix it anyway).
* virtual sources and sinks: Fix possible segfaultGeorg Chini2017-04-241-1/+2
| | | | | | | | | | Several virtual sources and sinks apart from module-echo-cancel also query the master sink or source to estimate the current latency. Those modules might potentially show the bug that is described for module-echo-cancel in bug 100277. This patch checks in the message handlers for the PA_{SINK,SOURCE}_MESSAGE_GET_LATENCY if the master sink or source is valid and returns 0 as latency if not. This is however not yet sufficient to solve the issue. Additional patches will follow.
* source/sink: Allow pa_{source, sink}_get_latency_within_thread() to return ↵Georg Chini2017-04-171-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | negative values The reported latency of source or sink is based on measured initial conditions. If the conditions contain an error, the estimated latency values may become negative. This does not indicate that the latency is indeed negative but can be considered merely an offset error. The current get_latency_in_thread() calls and the implementations of the PA_{SINK,SOURCE}_MESSAGE_GET_LATENCY messages truncate negative latencies because they do not make sense from a physical point of view. In fact, the values are truncated twice, once in the message handler and a second time in the pa_{source,sink}_get_latency_within_thread() call itself. This leads to two problems for the latency controller within module-loopback: - Truncating leads to discontinuities in the latency reports which then trigger unwanted end to end latency corrections. - If a large negative port latency offsets is set, the reported latency is always 0, making it impossible to control the end to end latency at all. This patch is a pre-condition for solving these problems. It adds a new flag to pa_{sink,source}_get_latency_within_thread() to allow negative return values. Truncating is also removed in all implementations of the PA_{SINK,SOURCE}_MESSAGE_GET_LATENCY message handlers. The allow_negative flag is set to false for all calls of pa_{sink,source}_get_latency_within_thread() except when used within PA_{SINK,SOURCE}_MESSAGE_GET_LATENCY. This means that the original behavior is not altered in most cases. Only if a positive latency offset is set and the message returns a negative value, the reported latency is smaller because the values are not truncated twice. Additionally let PA_SOURCE_MESSAGE_GET_LATENCY return -pa_sink_get_latency_within_thread() for monitor sources because the source gets the data before it is played.
* sink-input/source-output: Don't crash when cork() is called without valid ↵Georg Chini2017-03-291-1/+1
| | | | | | | | | | | sink or source If pa_sink_input_cork() or pa_source_output_cork() were called without a sink or source attached, the calls would crash pulseaudio. This patch fixes the problem, so that a source output or sink input can still be corked or uncorked while source or sink are invalid. This is needed to correct the corking logic in module-loopback.
* update FSF addresses to FSF web pageOndrej Holecek2015-01-141-3/+1
| | | | | | | | | FSF addresses used in PA sources are no longer valid and rpmlint generates numerous warnings during packaging because of this. This patch changes all FSF addresses to FSF web page according to the GPL how-to: https://www.gnu.org/licenses/gpl-howto.en.html Done automatically by sed-ing through sources.
* Remove pa_bool_t and replace it with bool.poljar (Damir Jelić)2013-07-041-12/+12
| | | | | | | | | | | | | | | | | commands used for this (executed from the pulseaudio/src directory): find . -regex '\(.*\.[hc]\|.*\.cc\|.*\.m4\)' -not -name 'macro.h' \ -a -not -name 'reserve.[ch]' -a -not -name 'reserve-monitor.[ch]' \ -a -not -name 'glib-mainloop.c' -a -not -name 'gkt-test.c' \ -a -not -name 'glib-mainloop.c' -a -not -name 'gkt-test.c' \ -a -not -name 'poll-win32.c' -a -not -name 'thread-win32.c' \ -a -not -name 'dllmain.c' -a -not -name 'gconf-helper.c' \ -exec sed -i -e 's/\bpa_bool_t\b/bool/g' \ -e 's/\bTRUE\b/true/g' -e 's/\bFALSE\b/false/g' {} \; and: sed -i -e '181,194!s/\bpa_bool_t\b/bool/' \ -e '181,194!s/\bTRUE\b/true/' -e \ '181,194!s/\bFALSE\b/false/' pulsecore/macro.h
* modules: Remove obsolete may_move_to callbacksStefan Huber2013-03-061-11/+0
| | | | | | Some modules have source_output_may_move_to_cb() and sink_input_may_move_to_cb() implemented that duplicate the default behavior. Remove them.
* virtual-sink: Removed the option to specify sample format.Ștefan Săftescu2012-12-191-2/+0
| | | | BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=46529
* memblock: Add pa_memblock_acquire_chunk().Tanu Kaskinen2012-08-221-2/+2
| | | | | | Besides making the code a bit cleaner, this also gets rid of a few "cast increases required alignment of target type" warnings.
* Add comments referring to bug #53709.Tanu Kaskinen2012-08-191-0/+5
|
* virtual-sink: Remove irrelevant comment.Tanu Kaskinen2012-02-121-3/+0
| | | | | The comment is inherited from module-ladspa-sink. It doesn't make sense in module-virtual-sink.
* memblockq: Improve debuggability by storing a name and a sample spec.Tanu Kaskinen2011-10-011-1/+1
| | | | | | These are not used for anything at this point, but this makes it easy to add ad-hoc debug prints that show the memblockq name and to convert between bytes and usecs.
* virtual: Make volume sharing on by defaultArun Raghavan2011-09-141-1/+1
| | | | | People who use this code (i.e. mostly filters) would presumably want volume sharing on by default.
* Move i18n.[ch] to src/pulsecoreMaarten Bosmans2011-08-111-1/+1
| | | | | The header is used in files troughout the tree and is not included in the public api, so it belongs in pulsecore, not in pulse.
* virtual: Fix volume callback setting.Tanu Kaskinen2011-07-211-1/+1
| | | | | | | | We want to set the volume callbacks only if volume sharing is not used. When volume sharing is used, we don't want to mess with the stream volumes. This was broken in 6c6b50
* alsa: Reinitialise the mixer on port change.Colin Guthrie2011-07-201-3/+8
| | | | | This allows us to flip from software to hardware volume control as the port's mixer path dictates.
* devices: Use wrapper functions to set the *_volume and *_mute callbacks.Colin Guthrie2011-07-191-2/+2
| | | | | | This is not currently useful but future commits will make further changes concerning automatic setting of flags and event delivery that makes this structure necessary.
* Remove unnecessary #includesMaarten Bosmans2011-06-221-3/+1
|
* core: Add extended stream API to support compressed formatsArun Raghavan2011-05-021-1/+1
| | | | | | | | | | | | | | | This is the beginning of work to support compressed formats natively in PulseAudio. This adds a pa_stream_new_extended() that takes a format structure, sends it to the server (=> protocol extension) and has the server negotiate with the appropropriate sink to figure out what format it should use. This is work in progress, and works only with PCM streams. Actual compressed format support in some sink needs to be implemented, and extensive testing is required. More details on how this is supposed to work is available at: http://pulseaudio.org/wiki/PassthroughSupport
* filter-apply: Mark modules as being autoloadedArun Raghavan2011-05-021-0/+3
| | | | | | | (Based on Colin's review) We mark modules as being autoloaded so that they can handle this as a special case if needed (which is required by module-echo-cancel for now). This inverts how things were done and makes using these modules manually less error-prone.
* Get rid of some warningsMaarten Bosmans2011-03-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mostly warnings about unused stuff. Furthermore, the first hunk is a fix for the change in 177948a6. Finally, comment in AEC_dtd was translated and the code simplified slightly. CC module_bluetooth_device_la-module-bluetooth-device.lo modules/bluetooth/module-bluetooth-device.c: In function ‘a2dp_process_render’: modules/bluetooth/module-bluetooth-device.c:1335:30: warning: pointer targets in passing argument 6 of ‘sbc_encode’ differ in signedness [-Wpointer-sign] ../src/modules/bluetooth/sbc/sbc.h:92:9: note: expected ‘ssize_t *’ but argument is of type ‘size_t *’ CC module_rygel_media_server_la-module-rygel-media-server.lo modules/module-rygel-media-server.c:383:13: warning: ‘append_property_dict_entry_object_array’ defined but not used [-Wunused-function] CC module_echo_cancel_la-adrian-aec.lo modules/echo-cancel/adrian-aec.h:360:15: warning: ‘AEC_getambient’ defined but not used [-Wunused-function] modules/echo-cancel/adrian-aec.h:368:14: warning: ‘AEC_setgain’ defined but not used [-Wunused-function] modules/echo-cancel/adrian-aec.h:374:14: warning: ‘AEC_setaes’ defined but not used [-Wunused-function] modules/echo-cancel/adrian-aec.h:377:16: warning: ‘AEC_max_dotp_xf_xf’ declared ‘static’ but never defined [-Wunused-function] CC module_echo_cancel_la-module-echo-cancel.lo modules/echo-cancel/module-echo-cancel.c: In function ‘time_callback’: modules/echo-cancel/module-echo-cancel.c:266:12: warning: variable ‘fs’ set but not used [-Wunused-but-set-variable] CC module-virtual-sink.lo modules/module-virtual-sink.c: In function ‘sink_input_pop_cb’: modules/module-virtual-sink.c:206:15: warning: variable ‘current_latency’ set but not used [-Wunused-but-set-variable]
* Fix up according to Coding StyleMaarten Bosmans2011-03-111-1/+1
| | | | Only whitespace changes in here
* virtual-sink: Fix a crash when moving the sink to a new master right after ↵Tanu Kaskinen2011-02-261-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | setup. If the virtual sink is moved to a new master right after it has been created, then the virtual sink input's memblockq can be rewound to a negative read index. The data written prior to the move starts from index zero, so after the rewind there's a bit of silence. If the memblockq doesn't have a silence memchunk set, then pa_memblockq_peek() will return zero in such case, and the returned memchunk's memblock pointer will be NULL. That scenario wasn't taken into account in the implementation of sink_input_pop_cb. Setting a silence memchunk for the memblockq solves this problem, because pa_memblock_peek() will now return a valid memblock if the read index happens to point to a hole in the memblockq. I believe this isn't the best possible solution, though. It doesn't really make sense to rewind the sink input's memblockq beyond index 0 in the first place, because now when the stream starts to play to the new master sink, there's some unnecessary silence before the actual data starts. This is a small problem, though, and I don't grok the rewinding system well enough to know how to fix this issue properly. I went through all files that call pa_memblockq_peek() to see if there are more similar bugs. play-memblockq.c was the only one that looked to me like it might be broken in the same way. I didn't try reproducing the bug with play-memblockq.c, though, so I just added a FIXME comment there.
* virtual-sink/source: Remove an unused variable.Tanu Kaskinen2011-02-261-5/+0
|
* virtual-sink/source: Use a more descriptive stream name.Tanu Kaskinen2011-02-261-1/+1
|
* virtual-sink: Add a modarg for forcing flat volume.Tanu Kaskinen2011-02-261-1/+15
|
* virtual-sink: Add a modarg for enabling volume sharing.Tanu Kaskinen2011-02-261-5/+12
|
* core: Link virtual sinks and sources to their streams.Tanu Kaskinen2011-02-221-0/+3
| | | | | | | | | | | | | | | This change doesn't add any functionality in itself, but it will be useful in the future for operating on chains of sinks or sources that are piggy-backing on each other. For example, the PA_PROP_DEVICE_MASTER_DEVICE property could be handled in the core so that each virtual device doesn't have to maintain it separately. By using the origin_sink and destination_source pointers the core is able to see at stream creation time that the stream is created by a virtual device, and then update that device's property list using the name of the master device that the stream is being connected to. The same thing can be done also when the stream is being moved from a device to another, in which case the _MASTER_DEVICE property needs updating.
* virtual: when fixed block sizes are used the memblockq must have a silence blockLennart Poettering2010-02-251-2/+6
|
* virtual: document how to implement fixed block size filtersLennart Poettering2010-02-251-6/+27
|
* memblockq: implement new call pa_memblockq_peek_fixed_size()Lennart Poettering2010-02-251-4/+2
|
* virtual: minor simplifications for the virtual sinkLennart Poettering2010-02-251-20/+11
|
* virutal-sink: boilerplate virtual sink to add PCM processingPierre-Louis Bossart2010-02-171-0/+635