summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2012-11-16modules: Micro-optimisation for rewind_requested pathsArun Raghavan12-12/+12
Since some devices can be chatty with regards to how often they return from poll(), this adds a PA_UNLIKELY() to all the the rewind_requested checks in our sink modules to make the general case (no rewind was requested) the fast path.
2012-11-16sink: Process rewind requests also when suspended.Tanu Kaskinen14-60/+57
When a rewind is requested on a sink input, the request parameters are stored in the pa_sink_input struct. The parameters are reset during rewind processing, and if the sink decides to ignore the rewind request due to being suspended, stale parameters are left in pa_sink_input. It's particularly problematic if the rewrite_bytes parameter is left at -1, because that will prevent all future rewind processing on that sink input. So, in order to avoid stale parameters, every rewind request needs to be processed, even if the sink is suspended. Reported-by: Uoti Urpala
2012-11-16sink, source: Prevent unnecessary rate update attemptsArun Raghavan4-18/+10
We don't need to try a rate update if the desired sample rate is the same as the one the sink or source is already using.
2012-11-16alsa-mixer: Prefer "Digital Input Source:Digital Mic 1"David Henningsson1-3/+3
...over "Digital Input Source:Analog Input". It makes life a little easier for users of Dell xps m1330. Just an old Ubuntu delta I never upstreamed until now. The patch was originally written by Daniel T Chen <crimsun@ubuntu.com>. BugLink: https://bugs.launchpad.net/bugs/453966 Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-11-15mainloop: Don't care about the mainloop state variable when waking up the ↵Tanu Kaskinen1-1/+1
mainloop. If the mainloop is just about to enter polling, but m->state is not POLLING yet when some other thread calls pa_mainloop_wakeup(), the mainloop will not be woken up. It's safe to write to the wakeup pipe at any time, so let's just remove the check.
2012-11-15mainloop: Change wakeup_requested type from pa_bool_t to pa_atomic_t.Tanu Kaskinen1-4/+3
The variable is accessed from multiple threads, so it should be atomic.
2012-11-14alsa-mixer: Add "CLFE" and "Bass Speaker" namesDavid Henningsson3-0/+32
These are sometimes being used in the HDA driver and we should support them. Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-11-09alsa-mixer: Add a few more machines to internal mic whitelistDavid Henningsson1-0/+6
Based on feedback in the bug below (comments 128, 129, 131). BugLink: https://bugs.launchpad.net/bugs/946232 Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-11-08pulse: Fix hole handling in pa_stream_peek().Tanu Kaskinen2-9/+31
Previously, if there was a hole in a recording stream, pa_stream_peek() would crash. Holes could be handled silently inside pa_stream_peek() by generating silence (wouldn't work for compressed streams, though) or by skipping any holes. However, I think it's better to let the caller decide how the holes should be handled, so in case of holes, pa_stream_peek() will return NULL data pointer and the length of the hole in the nbytes argument. This change is technically an interface break, because previously the documentation didn't mention the possibility of holes that need special handling. However, since holes caused crashing anyway in the past, it's not a regression if applications keep misbehaving due to not handing holes properly. Some words about when holes can appear in recording streams: I think it would be reasonable behavior if overruns due to the application reading data too slowly would cause holes. Currently that's not the case - overruns will just cause audio to be skipped. But the point is that this might change some day. I'm not sure how holes can occur with the current code, but as the linked bug shows, they can happen. It's most likely due to recording from a monitor source where the thing being monitored has holes in its playback stream. BugLink: http://bugs.launchpad.net/bugs/1058200
2012-11-08introspect: Minor documentation fixArun Raghavan1-4/+4
s/pa_latency_info/pa_timing_info
2012-11-07alsa: get avail, delay, timestamps in a single kernel callPierre-Louis Bossart4-22/+21
Refactor code to fetch avail, delay and timestamp values in a single call to snd_pcm_status(). The information reported is exactly the same as before, however it is extracted in a more atomic manner to improve timer-based scheduling. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2012-11-05Revert "tests: modify alsa-time-test to use 'check' framework"Arun Raghavan2-72/+50
This reverts commit 1569601864af375c3788fbce429b6773bd48072e. Rethinking this, it makes more sense to not add this to the check framework. This is mostly useful for exposing ALSA driver issues, and it's handy to be able to build this as a standalone executable.
2012-11-05alsa: Drop verbosity on UCM messageArun Raghavan1-1/+1
We don't need to log an error-level message for missing UCM config.
2012-11-04resampler: Fix crash if 'auto' resampler chooses ffmpeg with variable rateFrédéric Dalleau1-1/+4
To reproduce, add resampler-method = ffmpeg in daemon.conf then start PA, and load module-loopback Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0xb2f1db40 (LWP 23047)] 0x00000000 in ?? () (gdb) bt 0 0x00000000 in ?? () 1 0xb7c463cb in pa_resampler_set_input_rate (r=0x80e9438, rate=44011) at pulsecore/resampler.c:365 2 0xb7c6321d in pa_sink_input_process_msg (o=0x80e87a0, code=3, userdata=0xabeb, offset=0, chunk=0x0) at pulsecore/sink-input.c:1833 3 0xb7e9840b in sink_input_process_msg_cb (obj=0x80e87a0, code=3, data=0xabeb, offset=0, chunk=0x0) at modules/module-loopback.c:538 4 0xb7c2709b in pa_asyncmsgq_dispatch (object=0x80e87a0, code=3, userdata=0xabeb, offset=0, memchunk=0xb2f1d17c) at pulsecore/asyncmsgq.c:322 5 0xb7c4c6e3 in asyncmsgq_read_work (i=0x80dd580) at pulsecore/rtpoll.c:564 6 0xb7c4b34a in pa_rtpoll_run (p=0x80fb7e0, wait_op=true) at pulsecore/rtpoll.c:238 7 0xb7dd90af in thread_func (userdata=0x80afe88) at modules/alsa/alsa-sink.c:1785 8 0xb7bf3291 in internal_thread_func (userdata=0x8095d08) at pulsecore/thread-posix.c:83 9 0xb7ab9d4c in start_thread (arg=0xb2f1db40) at pthread_create.c:308 10 0xb79f3ace in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
2012-11-04device-restore: When restoring volume, print the restored volume to the log.Tanu Kaskinen1-6/+10
2012-11-03build-sys: Document libpulsecommon vs. libpulse duplicationv2.99.1Arun Raghavan1-0/+5
2012-11-03Revert "core: adjust playing_for and underrun_for at rewind"Arun Raghavan1-22/+4
This reverts commit 5bc6cadcb2e7255fd333ed88cc80b61a7673ddd9. I wasn't meaning to push this out - just merged for review / testing.
2012-10-31core: adjust playing_for and underrun_for at rewindUoti Urpala1-4/+22
A rewind may erase data that sink_input counted in playing_for or underrun_for earlier. Add code adjusting those values after a rewind. One visible symptom of this bug was problems recovering from an underrun. When a client calls pa_stream_write() with a large block of memory, the function can split that into smaller pieces before sending it to the server. When receiving new data for a stream that had silence queued due to underrun, the server would do a rewind to replace the queued-but-not-played silence with the new data. Because of the bug, this rewind itself would not change underrun_for. It's possible for multiple rewinds to be done without filling the sink buffer in between (which is what would eventually reset underrun_for). In this case, the server rapidly processing the split packets would rewind the stream for _each_ of them (as underrun_for would stay set), erasing valid audio as a result.
2012-10-30svolume: Fix ARM alignment issuesArun Raghavan1-41/+60
As Peter Meerwald <p.meerwald@bct-electronic.com> discovered, our ARM svolume code performance is quite terrible when the incoming samples are not word-aligned. This can very easily be the case, since the architecture only requires that the samples be 16-bit aligned, and we might end up running the innermost loop after processing modulo-4 samples. The performance degradation was ~50x on a Cortex A9 (Pandaboard). This reworks the svolume logic to first consume enough samples to make sure the rest is word aligned, and reordering the processing to work with 4 samples at a time first, and then finally deal with the remainder. With this, performance is comparable for arbitrary alignments (~3x faster than the C code).
2012-10-30tests: Minor alignment adjustment fix for cpu-testArun Raghavan1-1/+2
2012-10-30match: Use the SINK_INPUT_FIXATE hook instead of NEW.Tanu Kaskinen1-5/+5
The callback relies on the sample spec being finalized, which is not true with the NEW hook. In case you're wondering about the "hook EARLY - 1, to match before stream-restore" comment that was not changed even though the code that the comment concerned was changed: the comment was apparently written at a time when module-stream-restore used the NEW hook too, and later stream-restore has been changed to use the FIXATE hook. So, the comment was wrong/nonsensical before this patch. Since these two modules now use the same hook again, the comment makes sense again. BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=55135
2012-10-30combine: Keep the timer active in the null mode only when running.Tanu Kaskinen1-5/+3
Previously thread_func() used PA_SINK_IS_OPENED() to check whether some data should be rendered. process_render_null() used a different check: it would return immediately if the sink was not in the RUNNING state. This caused a busy loop when the sink was in the IDLE state, because process_render_null() didn't update the timestamp, and thread_func() still kept the timer active using the old timestamp. pa_rtpoll_run() would return immediately because of the old timestamp. This is fixed by using the same check in both thread_func() and process_render_null(). Since the checks are the same, it's actually redundant to have the check in process_render_null(), so it is now an assertion. BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=54779
2012-10-30virtual-surround-sink: Fix setting max_request and max_rewind.Tanu Kaskinen1-2/+2
The sink has different frame size than the sink input, so the max_request and max_rewind values of the sink input need to be converted when setting the sink max_request and max_rewind values. The conversion is already done correctly in sink_input_update_max_request_cb() and sink_input_update_max_rewind_cb().
2012-10-30loopback: Don't fix the source output format/rate/channels.Tanu Kaskinen1-9/+0
Once the sink input has been routed in pa_sink_input_new(), the sample spec and channel map have already become fixed. The sink input and source output must use the same stream format, because the data is copied as-is.
2012-10-30loopback: Use the real sample spec once it's known.Tanu Kaskinen1-0/+5
When module-loopback is loaded without arguments, the ss and map variables are initialized with dummy values. This caused a problem, because also pa_memblockq_new() was called with the dummy values, making it work incorrectly. The base was set to 1 instead of the real frame size, which in turn caused alignment related crashes.
2012-10-30resampler: Make sure that there are no overflows when multiplying ↵Tanu Kaskinen1-6/+6
potentially big numbers. This fixes at least one crash that has been observed. The multiplication in trivial_resample() overflowed when resampling from 96 kHz to 48 kHz, causing an assertion error: Assertion 'o_index * fz < pa_memblock_get_length(output->memblock)' failed at pulsecore/resampler.c:1521, function trivial_resample(). Aborting. Without the assertion, the memcpy() after the assertion would have overwritten some random heap memory.
2012-10-30memblockq: Fix the order of setting minreq and prebuf.Tanu Kaskinen2-3/+3
2012-10-30core-util: Don't error out on existing runtime directory.Thomas Martitz1-2/+3
When compiling without HAVE_SYMLINK the runtime dir is a real directory, which is attempted to be created. In the case it already exists we shouldn't error out. The HAVE_SYMLINK-enabled code already does this.
2012-10-30core: Proper poll() emulation to fix pacat and friends on WindowsThomas Martitz4-19/+645
Currently, Windows versions of pacat and friends fail because the current poll emulation is not sufficient (it only works for socket fds). Luckily Gnulib has a much better emulation that seems to work good enough. The implementation has been largely copied (except a few bug fix regarding timeout handling, to be pushed upstream) and works on pipes and files as well. The copy has been obtained through their gnulib-tool utility, which gives a LGPLv2.1+ licensed file. This fixes the "Assertion (!e->dead) failed" error coming and lets pacat and friends stream happily to/from a server (I didn't actually test parec).
2012-10-30tests: Fix a cpu-test debug messageArun Raghavan1-3/+3
We align at sample granularity and not byte granularity (which might violate arch alignment requirements).
2012-10-30tests: Run svolume on different channel countsArun Raghavan1-46/+43
This adds checks to run svolume tests with 1, 2 and 3 channels (we don't run Orc with 3 channels since only 1/2-ch are implemented there).
2012-10-30tests: Make cpu-test less verboseArun Raghavan1-7/+4
Drops the correctness debug output since we want to run this several times, and the output becomes much more verbose than required.
2012-10-30tests: Run svolume test for various sample alignmentsArun Raghavan1-29/+77
Allows us to make sure that svolume works independently of sample alignment, and that performance doesn't degrade based on this.
2012-10-29core: Fix warning on non-win32 buildsArun Raghavan1-0/+2
2012-10-29build: Add a2dp-codecs.h to libbluetooth-util sources.Tanu Kaskinen1-1/+4
2012-10-29tests: Minor cpu-test fixes for non-NEON buildsArun Raghavan1-0/+7
The s16->float test is only run on ARM with NEOn at the moment, so we don't define that code in other cases.
2012-10-29tests: Print average outer-loop iteration time in cpu-testArun Raghavan1-2/+6
2012-10-29tests: Increase sconv cpu-test timeoutArun Raghavan1-0/+1
This takes longer on ARM CPUs, especially older ones.
2012-10-29tests: Allow off-by-one error in sconv testArun Raghavan1-8/+4
With some optimised sconv implementations (read NEON), rounding inaccuracy might lead to a difference of 1 with the reference implementation. The inaccuracy is worth the performance gain. Also increases floating-point accuracy while printing errors to make errors easier to analyse.
2012-10-29sconv: Fix NEON sconv rounding codeArun Raghavan1-7/+3
Rounding with 0.5 causes us to always round up for any value of the form x.5. IEEE754 specifies round-to-nearest-even as the behaviour in this case. This might not always be possible with NEON code, but this change gets us much closer to it.
2012-10-29tests: Implement test code for ARM NEON sconv s16_to_floatPeter Meerwald1-11/+70
Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
2012-10-29tests: Fix test description in cpu-testPeter Meerwald1-2/+2
Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
2012-10-29core: Add ARM NEON optimized sample conversion codePeter Meerwald5-1/+165
final: * includes some minor style fixes and build-time changes to allow building a single binary for neon and non-neon systems v4: * fix for sample length < 4 v3: * convert from intrinsics to inline assembly v2: * load and store data with vld1/vld1q and vst1/vst1q, resp., to work around alignment issues of compiler-generated vldmia instruction * remove redundant check for NEON flags Ubuntu/Linaro gcc 4.6.3 arm-linux-gnueabi-gcc -O2 -mcpu=cortex-a8 -mfloat-abi=softfp -mfpu=neon runtime on beagle-xm: D: [pulseaudio] sconv_neon.c: checking NEON sconv_s16le_from_float I: [pulseaudio] sconv_neon.c: NEON: 3754 usec. I: [pulseaudio] sconv_neon.c: ref: 58594 usec. D: [pulseaudio] sconv_neon.c: checking NEON sconv_s16le_to_float I: [pulseaudio] sconv_neon.c: NEON: 1831 usec. I: [pulseaudio] sconv_neon.c: ref: 10528 usec. I: [pulseaudio] sconv_neon.c: Initialising ARM NEON optimized conversions. conversion may be off by one for some samples due to rounding issues
2012-10-26build-sys: Add volume code to libpulsecommonArun Raghavan1-0/+1
Commit dd31d652a ("utils: Adding a function to get volume from string") uses pa_sw_volume_from_dB(), which is part of libpulse, in libpulsecore. This breaks as-needed builds. We fix this by also building the volume code in libpulsecommon.
2012-10-25card: Store a pa_card pointer in pa_card_profile.Tanu Kaskinen2-7/+17
2012-10-25bluetooth: Add hook to announce late UUIDsMikel Astiz2-0/+9
UUIDs might be announced at any time, so a hook is needed to notify any interested module. In practice, the UUIDs are quite stable with the exception of the pairing procedure, where the UUIDs are reported by BlueZ as soon as they are discovered.
2012-10-25card: Support adding ports dynamicallyMikel Astiz3-0/+19
Card profiles -specially the ones registered with pa_card_add_profile()- might need to create new ports during the lifetime of the card.
2012-10-25card: Support adding profiles dynamicallyMikel Astiz3-0/+15
Some cards might need to add profiles during their lifetime, that is, after the card has been created.
2012-10-25utils: Adding a function to get volume from stringFlavio Ceolin2-0/+45
The allowed volume formats are dB, % or integer. For example: 10% or 10db or 10.
2012-10-25tests: Run sconv tests with multiple alignmentsArun Raghavan1-26/+46
This allows us to test the sconv code with the incoming samples at various byte alignments. The test is also now split into correctness and performance checks.