[pulseaudio] 02/12: Refreshed patches, and dropped those that were applied upstream.

Luke Yelavich themuso-guest at moszumanska.debian.org
Sun Nov 1 23:18:50 UTC 2015


This is an automated email from the git hooks/post-receive script.

themuso-guest pushed a commit to branch ubuntu
in repository pulseaudio.

commit bc9589a773925791d576d02a1884c7941028719c
Author: Luke Yelavich <themuso at ubuntu.com>
Date:   Mon Sep 21 11:38:53 2015 +1000

    Refreshed patches, and dropped those that were applied upstream.
---
 debian/changelog                                   |   3 +-
 debian/patches/0001-volume-config-changes.patch    |   8 +-
 ...rapper-Quit-daemon-if-pid-file-is-removed.patch |   4 +-
 ...nd_mixer_poll_descriptors_count_when_zero.patch |   2 +-
 debian/patches/0099-pa_yes_no.patch                |  17 -
 debian/patches/0202-dont-probe-ucm.patch           |   2 +-
 debian/patches/0207-Enable-pulseaudio-droid.patch  |  10 +-
 ...ch-on-connect-adding-parameter-to-allow-s.patch |  18 +-
 ...le-device-restore-adding-property-to-skip.patch |   8 +-
 ...-corking-a-sink-input-stream-when-stalled.patch |  16 +-
 ...Import-code-from-the-Chrome-OS-audio-serv.patch | 782 ---------------------
 ...filter-Enable-LFE-filter-in-the-resampler.patch | 458 ------------
 .../0302-lfe-filter-Cleanup-and-refactor.patch     | 707 -------------------
 ...change-the-crossover-frequency-as-a-param.patch | 274 --------
 ...ange-pa_memblock_new_malloced-to-an-inlin.patch |  42 --
 .../0305-lfe-filter-Add-rewind-support.patch       | 231 ------
 ...r-Make-some-basic-functions-for-rewinding.patch |  96 ---
 .../0307-tests-adding-lfe-filter-test.patch        | 248 -------
 ...n-conf-enable-the-lfe-remixing-by-default.patch |  54 --
 ...llow-disabling-the-LFE-filter-by-setting-.patch |  43 --
 ...Rename-lfe_filter_required-to-lfe_remixed.patch |  92 ---
 ...olerant-variation-for-comparing-the-rewin.patch |  53 --
 .../0312-lfe-filter-test-Use-S16NE-format.patch    |  29 -
 .../patches/0406-tagstruct-add-copy-method.patch   |  20 +-
 .../0407-access-Add-access-control-hooks.patch     |  38 +-
 .../0408-protocol-native-add-access-checks.patch   |  84 +--
 debian/patches/0409-Trust-store-patch.patch        |  92 +--
 ...-thread-to-activate-trust-store-interface.patch |  25 +-
 .../0415-dynarray-Add-PA_DYNARRAY_FOREACH.patch    |  62 --
 .../0417-increase-timeout-check-apparmor.patch     |  18 +-
 debian/patches/series                              |  17 -
 31 files changed, 167 insertions(+), 3386 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 7137292..0620a67 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-pulseaudio 1:(6.99.1-2ubuntu1) UNRELEASED; urgency=medium
+pulseaudio (1:6.99.1-2ubuntu1) UNRELEASED; urgency=medium
 
   * Merge from Debian experimental, remaining changes:
     - epoch (my stupid fault :S)
@@ -26,6 +26,7 @@ pulseaudio 1:(6.99.1-2ubuntu1) UNRELEASED; urgency=medium
       bindings
     - Add example upstart job to run pulseaudio in system mode
     - Add a build/run autopkgtest for libpulse-dev
+  * Refreshed patches, and dropped those that were applied upstream.
 
  -- Luke Yelavich <themuso at ubuntu.com>  Mon, 21 Sep 2015 11:01:11 +1000
 
diff --git a/debian/patches/0001-volume-config-changes.patch b/debian/patches/0001-volume-config-changes.patch
index f19d01f..9167e11 100644
--- a/debian/patches/0001-volume-config-changes.patch
+++ b/debian/patches/0001-volume-config-changes.patch
@@ -2,16 +2,16 @@ Index: pulseaudio/src/daemon/daemon.conf.in
 ===================================================================
 --- pulseaudio.orig/src/daemon/daemon.conf.in
 +++ pulseaudio/src/daemon/daemon.conf.in
-@@ -56,7 +56,7 @@ ifelse(@HAVE_DBUS@, 1, [dnl
- ; enable-remixing = yes
- ; enable-lfe-remixing = no
+@@ -57,7 +57,7 @@ ifelse(@HAVE_DBUS@, 1, [dnl
+ ; enable-lfe-remixing = yes
+ ; lfe-crossover-freq = 120
  
 -; flat-volumes = yes
 +flat-volumes = no
  
  ifelse(@HAVE_SYS_RESOURCE_H@, 1, [dnl
  ; rlimit-fsize = -1
-@@ -86,5 +86,5 @@ ifelse(@HAVE_SYS_RESOURCE_H@, 1, [dnl
+@@ -87,5 +87,5 @@ ifelse(@HAVE_SYS_RESOURCE_H@, 1, [dnl
  ; default-fragment-size-msec = 25
  
  ; enable-deferred-volume = yes
diff --git a/debian/patches/0022-inotify-wrapper-Quit-daemon-if-pid-file-is-removed.patch b/debian/patches/0022-inotify-wrapper-Quit-daemon-if-pid-file-is-removed.patch
index 5a9d5e6..64bc62b 100644
--- a/debian/patches/0022-inotify-wrapper-Quit-daemon-if-pid-file-is-removed.patch
+++ b/debian/patches/0022-inotify-wrapper-Quit-daemon-if-pid-file-is-removed.patch
@@ -29,7 +29,7 @@ Index: pulseaudio/src/Makefile.am
 ===================================================================
 --- pulseaudio.orig/src/Makefile.am
 +++ pulseaudio/src/Makefile.am
-@@ -922,6 +922,7 @@ libpulsecore_ at PA_MAJORMINOR@_la_SOURCES
+@@ -933,6 +933,7 @@ libpulsecore_ at PA_MAJORMINOR@_la_SOURCES
  		pulsecore/core-subscribe.c pulsecore/core-subscribe.h \
  		pulsecore/core.c pulsecore/core.h \
  		pulsecore/hook-list.c pulsecore/hook-list.h \
@@ -91,7 +91,7 @@ Index: pulseaudio/src/daemon/main.c
      c->default_sample_spec = conf->default_sample_spec;
      c->alternate_sample_rate = conf->alternate_sample_rate;
      c->default_channel_map = conf->default_channel_map;
-@@ -1153,6 +1166,9 @@ finish:
+@@ -1154,6 +1167,9 @@ finish:
          pa_autospawn_lock_done(false);
      }
  
diff --git a/debian/patches/0023-fixing_snd_mixer_poll_descriptors_count_when_zero.patch b/debian/patches/0023-fixing_snd_mixer_poll_descriptors_count_when_zero.patch
index 40480f4..0adff37 100644
--- a/debian/patches/0023-fixing_snd_mixer_poll_descriptors_count_when_zero.patch
+++ b/debian/patches/0023-fixing_snd_mixer_poll_descriptors_count_when_zero.patch
@@ -4,7 +4,7 @@ Index: pulseaudio/src/modules/alsa/alsa-mixer.c
 ===================================================================
 --- pulseaudio.orig/src/modules/alsa/alsa-mixer.c
 +++ pulseaudio/src/modules/alsa/alsa-mixer.c
-@@ -215,6 +215,9 @@ static void defer_cb(pa_mainloop_api *a,
+@@ -328,6 +328,9 @@ static void defer_cb(pa_mainloop_api *a,
      if (n < 0) {
          pa_log("snd_mixer_poll_descriptors_count() failed: %s", pa_alsa_strerror(n));
          return;
diff --git a/debian/patches/0099-pa_yes_no.patch b/debian/patches/0099-pa_yes_no.patch
deleted file mode 100644
index ae07b22..0000000
--- a/debian/patches/0099-pa_yes_no.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-Subject: Fix PulseAudio failure on some non-English locales
-Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/1445358
-Author: Simos Xenitellis
-
-diff --git a/src/pulsecore/core-util.h b/src/pulsecore/core-util.h
-index dcdc40e..e6be901 100644
---- a/src/pulsecore/core-util.h
-+++ b/src/pulsecore/core-util.h
-@@ -90,7 +90,7 @@ int pa_parse_boolean(const char *s) PA_GCC_PURE;
- int pa_parse_volume(const char *s, pa_volume_t *volume);
- 
- static inline const char *pa_yes_no(bool b) {
--    return b ? _("yes") : _("no");
-+    return b ? "yes" : "no";
- }
- 
- static inline const char *pa_strnull(const char *x) {
diff --git a/debian/patches/0202-dont-probe-ucm.patch b/debian/patches/0202-dont-probe-ucm.patch
index 3fd6c6c..bed2ee4 100644
--- a/debian/patches/0202-dont-probe-ucm.patch
+++ b/debian/patches/0202-dont-probe-ucm.patch
@@ -2,7 +2,7 @@ Index: pulseaudio/src/modules/alsa/alsa-ucm.c
 ===================================================================
 --- pulseaudio.orig/src/modules/alsa/alsa-ucm.c
 +++ pulseaudio/src/modules/alsa/alsa-ucm.c
-@@ -1538,7 +1538,8 @@ pa_alsa_profile_set* pa_alsa_ucm_add_pro
+@@ -1620,7 +1620,8 @@ pa_alsa_profile_set* pa_alsa_ucm_add_pro
          ucm_create_profile(ucm, ps, verb, verb_name, verb_desc);
      }
  
diff --git a/debian/patches/0207-Enable-pulseaudio-droid.patch b/debian/patches/0207-Enable-pulseaudio-droid.patch
index e32c8c2..867b25e 100644
--- a/debian/patches/0207-Enable-pulseaudio-droid.patch
+++ b/debian/patches/0207-Enable-pulseaudio-droid.patch
@@ -24,7 +24,7 @@ Index: pulseaudio/configure.ac
  #### EsounD support (optional) ####
  
  AC_ARG_ENABLE([esound],
-@@ -1498,6 +1513,7 @@ AS_IF([test "x$HAVE_X11" = "x1"], ENABLE
+@@ -1521,6 +1536,7 @@ AS_IF([test "x$HAVE_X11" = "x1"], ENABLE
  AS_IF([test "x$HAVE_OSS_OUTPUT" = "x1"], ENABLE_OSS_OUTPUT=yes, ENABLE_OSS_OUTPUT=no)
  AS_IF([test "x$HAVE_OSS_WRAPPER" = "x1"], ENABLE_OSS_WRAPPER=yes, ENABLE_OSS_WRAPPER=no)
  AS_IF([test "x$HAVE_ALSA" = "x1"], ENABLE_ALSA=yes, ENABLE_ALSA=no)
@@ -32,7 +32,7 @@ Index: pulseaudio/configure.ac
  AS_IF([test "x$HAVE_COREAUDIO" = "x1"], ENABLE_COREAUDIO=yes, ENABLE_COREAUDIO=no)
  AS_IF([test "x$HAVE_SOLARIS" = "x1"], ENABLE_SOLARIS=yes, ENABLE_SOLARIS=no)
  AS_IF([test "x$HAVE_WAVEOUT" = "x1"], ENABLE_WAVEOUT=yes, ENABLE_WAVEOUT=no)
-@@ -1558,6 +1574,7 @@ echo "
+@@ -1583,6 +1599,7 @@ echo "
      Enable OSS Wrapper:            ${ENABLE_OSS_WRAPPER}
      Enable EsounD:                 ${ENABLE_ESOUND}
      Enable Alsa:                   ${ENABLE_ALSA}
@@ -44,7 +44,7 @@ Index: pulseaudio/src/Makefile.am
 ===================================================================
 --- pulseaudio.orig/src/Makefile.am
 +++ pulseaudio/src/Makefile.am
-@@ -1251,6 +1251,16 @@ modlibexec_LTLIBRARIES += \
+@@ -1268,6 +1268,16 @@ modlibexec_LTLIBRARIES += \
  		module-alsa-source.la \
  		module-alsa-card.la
  
@@ -61,7 +61,7 @@ Index: pulseaudio/src/Makefile.am
  dist_alsaprofilesets_DATA = \
  		modules/alsa/mixer/profile-sets/default.conf \
  		modules/alsa/mixer/profile-sets/force-speaker.conf \
-@@ -1520,6 +1530,13 @@ SYMDEF_FILES = \
+@@ -1537,6 +1547,13 @@ SYMDEF_FILES = \
  		module-filter-apply-symdef.h \
  		module-filter-heuristics-symdef.h
  
@@ -75,7 +75,7 @@ Index: pulseaudio/src/Makefile.am
  if HAVE_ESOUND
  SYMDEF_FILES += \
  		module-esound-protocol-tcp-symdef.h \
-@@ -1829,6 +1846,44 @@ libalsa_util_la_LIBADD += $(DBUS_LIBS)
+@@ -1846,6 +1863,44 @@ libalsa_util_la_LIBADD += $(DBUS_LIBS)
  libalsa_util_la_CFLAGS += $(DBUS_CFLAGS)
  endif
  
diff --git a/debian/patches/0209-module-switch-on-connect-adding-parameter-to-allow-s.patch b/debian/patches/0209-module-switch-on-connect-adding-parameter-to-allow-s.patch
index 28917fa..91a631d 100644
--- a/debian/patches/0209-module-switch-on-connect-adding-parameter-to-allow-s.patch
+++ b/debian/patches/0209-module-switch-on-connect-adding-parameter-to-allow-s.patch
@@ -12,7 +12,7 @@ Index: pulseaudio/src/modules/module-switch-on-connect.c
 ===================================================================
 --- pulseaudio.orig/src/modules/module-switch-on-connect.c
 +++ pulseaudio/src/modules/module-switch-on-connect.c
-@@ -41,10 +41,12 @@ PA_MODULE_VERSION(PACKAGE_VERSION);
+@@ -41,22 +41,25 @@ PA_MODULE_VERSION(PACKAGE_VERSION);
  PA_MODULE_LOAD_ONCE(true);
  PA_MODULE_USAGE(
          "only_from_unavailable=<boolean, only switch from unavailable ports> "
@@ -25,9 +25,7 @@ Index: pulseaudio/src/modules/module-switch-on-connect.c
      NULL,
  };
  
-@@ -53,13 +55,14 @@ struct userdata {
-         *sink_put_slot,
-         *source_put_slot;
+ struct userdata {
      bool only_from_unavailable;
 +    bool skip_abstract;
  };
@@ -41,7 +39,7 @@ Index: pulseaudio/src/modules/module-switch-on-connect.c
      struct userdata *u = userdata;
  
      pa_assert(c);
-@@ -78,6 +81,12 @@ static pa_hook_result_t sink_put_hook_ca
+@@ -75,6 +78,12 @@ static pa_hook_result_t sink_put_hook_ca
              return PA_HOOK_OK;
      }
  
@@ -54,7 +52,7 @@ Index: pulseaudio/src/modules/module-switch-on-connect.c
      def = pa_namereg_get_default_sink(c);
      if (def == sink)
          return PA_HOOK_OK;
-@@ -114,7 +123,7 @@ static pa_hook_result_t source_put_hook_
+@@ -111,7 +120,7 @@ static pa_hook_result_t source_put_hook_
      pa_source_output *o;
      uint32_t idx;
      pa_source *def;
@@ -63,7 +61,7 @@ Index: pulseaudio/src/modules/module-switch-on-connect.c
      struct userdata *u = userdata;
  
      pa_assert(c);
-@@ -137,6 +146,12 @@ static pa_hook_result_t source_put_hook_
+@@ -134,6 +143,12 @@ static pa_hook_result_t source_put_hook_
              return PA_HOOK_OK;
      }
  
@@ -76,7 +74,7 @@ Index: pulseaudio/src/modules/module-switch-on-connect.c
      def = pa_namereg_get_default_source(c);
      if (def == source)
          return PA_HOOK_OK;
-@@ -182,6 +197,11 @@ int pa__init(pa_module*m) {
+@@ -179,6 +194,11 @@ int pa__init(pa_module*m) {
  
      m->userdata = u = pa_xnew0(struct userdata, 1);
  
@@ -86,5 +84,5 @@ Index: pulseaudio/src/modules/module-switch-on-connect.c
 +    }
 +
      /* A little bit later than module-rescue-streams... */
-     u->sink_put_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_PUT], PA_HOOK_LATE+30, (pa_hook_cb_t) sink_put_hook_callback, u);
-     u->source_put_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_PUT], PA_HOOK_LATE+20, (pa_hook_cb_t) source_put_hook_callback, u);
+     pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_SINK_PUT], PA_HOOK_LATE+30, (pa_hook_cb_t) sink_put_hook_callback, u);
+     pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_SOURCE_PUT], PA_HOOK_LATE+20, (pa_hook_cb_t) source_put_hook_callback, u);
diff --git a/debian/patches/0210-module-device-restore-adding-property-to-skip.patch b/debian/patches/0210-module-device-restore-adding-property-to-skip.patch
index 6ff66e4..2e2272b 100644
--- a/debian/patches/0210-module-device-restore-adding-property-to-skip.patch
+++ b/debian/patches/0210-module-device-restore-adding-property-to-skip.patch
@@ -28,7 +28,7 @@ Index: pulseaudio/src/modules/module-device-restore.c
  
  static const char* const valid_modargs[] = {
      "restore_volume",
-@@ -611,6 +613,9 @@ static void subscribe_callback(pa_core *
+@@ -602,6 +604,9 @@ static void subscribe_callback(pa_core *
          if (!(sink = pa_idxset_get_by_index(c->sinks, idx)))
              return;
  
@@ -38,7 +38,7 @@ Index: pulseaudio/src/modules/module-device-restore.c
          type = PA_DEVICE_TYPE_SINK;
          name = pa_sprintf_malloc("sink:%s", sink->name);
          if (sink->active_port)
-@@ -650,6 +655,9 @@ static void subscribe_callback(pa_core *
+@@ -641,6 +646,9 @@ static void subscribe_callback(pa_core *
          if (!(source = pa_idxset_get_by_index(c->sources, idx)))
              return;
  
@@ -48,7 +48,7 @@ Index: pulseaudio/src/modules/module-device-restore.c
          type = PA_DEVICE_TYPE_SOURCE;
          name = pa_sprintf_malloc("source:%s", source->name);
          if (source->active_port)
-@@ -816,6 +824,9 @@ static pa_hook_result_t sink_port_hook_c
+@@ -807,6 +815,9 @@ static pa_hook_result_t sink_port_hook_c
      pa_assert(u);
      pa_assert(u->restore_volume || u->restore_muted);
  
@@ -58,7 +58,7 @@ Index: pulseaudio/src/modules/module-device-restore.c
      name = pa_sprintf_malloc("sink:%s", sink->name);
  
      if ((e = perportentry_read(u, name, (sink->active_port ? sink->active_port->name : NULL)))) {
-@@ -958,6 +969,9 @@ static pa_hook_result_t source_port_hook
+@@ -949,6 +960,9 @@ static pa_hook_result_t source_port_hook
      pa_assert(u);
      pa_assert(u->restore_volume || u->restore_muted);
  
diff --git a/debian/patches/0211-corking-a-sink-input-stream-when-stalled.patch b/debian/patches/0211-corking-a-sink-input-stream-when-stalled.patch
index f978405..e1f5fe0 100644
--- a/debian/patches/0211-corking-a-sink-input-stream-when-stalled.patch
+++ b/debian/patches/0211-corking-a-sink-input-stream-when-stalled.patch
@@ -18,10 +18,10 @@ implementation.
 
 Bug-Link: https://bugs.launchpad.net/ubuntu-rtm/+source/pulseaudio/+bug/1391230
 
-Index: pulseaudio-6.0/src/pulsecore/protocol-native.c
+Index: pulseaudio/src/pulsecore/protocol-native.c
 ===================================================================
---- pulseaudio-6.0.orig/src/pulsecore/protocol-native.c
-+++ pulseaudio-6.0/src/pulsecore/protocol-native.c
+--- pulseaudio.orig/src/pulsecore/protocol-native.c
++++ pulseaudio/src/pulsecore/protocol-native.c
 @@ -124,6 +124,10 @@ typedef struct playback_stream {
  
      bool is_underrun:1;
@@ -44,7 +44,7 @@ Index: pulseaudio-6.0/src/pulsecore/protocol-native.c
  };
  
  enum {
-@@ -831,6 +837,18 @@ static int playback_stream_process_msg(p
+@@ -832,6 +838,18 @@ static int playback_stream_process_msg(p
              break;
          }
  
@@ -63,7 +63,7 @@ Index: pulseaudio-6.0/src/pulsecore/protocol-native.c
          case PLAYBACK_STREAM_MESSAGE_UNDERFLOW: {
              pa_tagstruct *t;
  
-@@ -1183,6 +1201,12 @@ static playback_stream* playback_stream_
+@@ -1184,6 +1202,12 @@ static playback_stream* playback_stream_
      s->sink_input = sink_input;
      s->is_underrun = true;
      s->drain_request = false;
@@ -76,7 +76,7 @@ Index: pulseaudio-6.0/src/pulsecore/protocol-native.c
      pa_atomic_store(&s->missing, 0);
      s->buffer_attr_req = *a;
      s->adjust_latency = adjust_latency;
-@@ -1425,6 +1449,12 @@ static void handle_seek(playback_stream
+@@ -1426,6 +1450,12 @@ static void handle_seek(playback_stream
              /* We just ended an underrun, let's ask the sink
               * for a complete rewind rewrite */
  
@@ -89,7 +89,7 @@ Index: pulseaudio-6.0/src/pulsecore/protocol-native.c
              pa_log_debug("Requesting rewind due to end of underrun.");
              pa_sink_input_request_rewind(s->sink_input,
                                           (size_t) (s->sink_input->thread_info.underrun_for == (uint64_t) -1 ? 0 :
-@@ -1604,6 +1634,15 @@ static int sink_input_process_msg(pa_msg
+@@ -1605,6 +1635,15 @@ static int sink_input_process_msg(pa_msg
      return pa_sink_input_process_msg(o, code, userdata, offset, chunk);
  }
  
@@ -105,7 +105,7 @@ Index: pulseaudio-6.0/src/pulsecore/protocol-native.c
  static bool handle_input_underrun(playback_stream *s, bool force) {
      bool send_drain;
  
-@@ -1655,6 +1694,9 @@ static int sink_input_pop_cb(pa_sink_inp
+@@ -1656,6 +1695,9 @@ static int sink_input_pop_cb(pa_sink_inp
      if (!handle_input_underrun(s, false))
          s->is_underrun = false;
  
diff --git a/debian/patches/0300-lfe-filter-Import-code-from-the-Chrome-OS-audio-serv.patch b/debian/patches/0300-lfe-filter-Import-code-from-the-Chrome-OS-audio-serv.patch
deleted file mode 100644
index a733d7b..0000000
--- a/debian/patches/0300-lfe-filter-Import-code-from-the-Chrome-OS-audio-serv.patch
+++ /dev/null
@@ -1,782 +0,0 @@
-From f3ebf6b667b155f5fe6526bd70881c79e07d7874 Mon Sep 17 00:00:00 2001
-From: David Henningsson <david.henningsson at canonical.com>
-Date: Tue, 24 Mar 2015 10:29:12 +0100
-Subject: [PATCH 300/311] lfe-filter: Import code from the Chrome OS audio
- server
-
-The chrome OS audio server has some already existing code, which
-has been made available under a BSD-style license, which should be
-safe to import by us.
-
-Signed-off-by: David Henningsson <david.henningsson at canonical.com>
----
- LICENSE                             |   3 +
- src/pulsecore/filter/LICENSE.WEBKIT |  27 +++
- src/pulsecore/filter/biquad.c       | 368 ++++++++++++++++++++++++++++++++++++
- src/pulsecore/filter/biquad.h       |  57 ++++++
- src/pulsecore/filter/crossover.c    | 188 ++++++++++++++++++
- src/pulsecore/filter/crossover.h    |  70 +++++++
- 6 files changed, 713 insertions(+)
- create mode 100644 src/pulsecore/filter/LICENSE.WEBKIT
- create mode 100644 src/pulsecore/filter/biquad.c
- create mode 100644 src/pulsecore/filter/biquad.h
- create mode 100644 src/pulsecore/filter/crossover.c
- create mode 100644 src/pulsecore/filter/crossover.h
-
-diff --git a/LICENSE b/LICENSE
-index 226c4ce..6932317 100644
---- a/LICENSE
-+++ b/LICENSE
-@@ -29,6 +29,9 @@ considered too small and stable to be considered as an external library) use the
- more permissive MIT license. This include the device reservation DBus protocol
- and realtime kit implementations.
- 
-+A more permissive BSD-style license is used for LFE filters, see
-+src/pulsecore/filter/LICENSE.WEBKIT for details.
-+
- Additionally, a more permissive Sun license is used for code that performs
- u-law, A-law and linear PCM conversions.
- 
-diff --git a/src/pulsecore/filter/LICENSE.WEBKIT b/src/pulsecore/filter/LICENSE.WEBKIT
-new file mode 100644
-index 0000000..2f69d9f
---- /dev/null
-+++ b/src/pulsecore/filter/LICENSE.WEBKIT
-@@ -0,0 +1,27 @@
-+/*
-+ * Copyright (C) 2010 Google Inc. All rights reserved.
-+ *
-+ * Redistribution and use in source and binary forms, with or without
-+ * modification, are permitted provided that the following conditions
-+ * are met:
-+ *
-+ * 1.  Redistributions of source code must retain the above copyright
-+ *     notice, this list of conditions and the following disclaimer.
-+ * 2.  Redistributions in binary form must reproduce the above copyright
-+ *     notice, this list of conditions and the following disclaimer in the
-+ *     documentation and/or other materials provided with the distribution.
-+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
-+ *     its contributors may be used to endorse or promote products derived
-+ *     from this software without specific prior written permission.
-+ *
-+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
-+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
-+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-+ */
-diff --git a/src/pulsecore/filter/biquad.c b/src/pulsecore/filter/biquad.c
-new file mode 100644
-index 0000000..b28256d
---- /dev/null
-+++ b/src/pulsecore/filter/biquad.c
-@@ -0,0 +1,368 @@
-+/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
-+ * Use of this source code is governed by a BSD-style license that can be
-+ * found in the LICENSE file.
-+ */
-+
-+/* Copyright (C) 2010 Google Inc. All rights reserved.
-+ * Use of this source code is governed by a BSD-style license that can be
-+ * found in the LICENSE.WEBKIT file.
-+ */
-+
-+#include <math.h>
-+#include "biquad.h"
-+
-+#ifndef max
-+#define max(a, b) ({ __typeof__(a) _a = (a);	\
-+			__typeof__(b) _b = (b);	\
-+			_a > _b ? _a : _b; })
-+#endif
-+
-+#ifndef min
-+#define min(a, b) ({ __typeof__(a) _a = (a);	\
-+			__typeof__(b) _b = (b);	\
-+			_a < _b ? _a : _b; })
-+#endif
-+
-+#ifndef M_PI
-+#define M_PI 3.14159265358979323846
-+#endif
-+
-+static void set_coefficient(struct biquad *bq, double b0, double b1, double b2,
-+			    double a0, double a1, double a2)
-+{
-+	double a0_inv = 1 / a0;
-+	bq->b0 = b0 * a0_inv;
-+	bq->b1 = b1 * a0_inv;
-+	bq->b2 = b2 * a0_inv;
-+	bq->a1 = a1 * a0_inv;
-+	bq->a2 = a2 * a0_inv;
-+}
-+
-+static void biquad_lowpass(struct biquad *bq, double cutoff, double resonance)
-+{
-+	/* Limit cutoff to 0 to 1. */
-+	cutoff = max(0.0, min(cutoff, 1.0));
-+
-+	if (cutoff == 1) {
-+		/* When cutoff is 1, the z-transform is 1. */
-+		set_coefficient(bq, 1, 0, 0, 1, 0, 0);
-+	} else if (cutoff > 0) {
-+		/* Compute biquad coefficients for lowpass filter */
-+		resonance = max(0.0, resonance); /* can't go negative */
-+		double g = pow(10.0, 0.05 * resonance);
-+		double d = sqrt((4 - sqrt(16 - 16 / (g * g))) / 2);
-+
-+		double theta = M_PI * cutoff;
-+		double sn = 0.5 * d * sin(theta);
-+		double beta = 0.5 * (1 - sn) / (1 + sn);
-+		double gamma = (0.5 + beta) * cos(theta);
-+		double alpha = 0.25 * (0.5 + beta - gamma);
-+
-+		double b0 = 2 * alpha;
-+		double b1 = 2 * 2 * alpha;
-+		double b2 = 2 * alpha;
-+		double a1 = 2 * -gamma;
-+		double a2 = 2 * beta;
-+
-+		set_coefficient(bq, b0, b1, b2, 1, a1, a2);
-+	} else {
-+		/* When cutoff is zero, nothing gets through the filter, so set
-+		 * coefficients up correctly.
-+		 */
-+		set_coefficient(bq, 0, 0, 0, 1, 0, 0);
-+	}
-+}
-+
-+static void biquad_highpass(struct biquad *bq, double cutoff, double resonance)
-+{
-+	/* Limit cutoff to 0 to 1. */
-+	cutoff = max(0.0, min(cutoff, 1.0));
-+
-+	if (cutoff == 1) {
-+		/* The z-transform is 0. */
-+		set_coefficient(bq, 0, 0, 0, 1, 0, 0);
-+	} else if (cutoff > 0) {
-+		/* Compute biquad coefficients for highpass filter */
-+		resonance = max(0.0, resonance); /* can't go negative */
-+		double g = pow(10.0, 0.05 * resonance);
-+		double d = sqrt((4 - sqrt(16 - 16 / (g * g))) / 2);
-+
-+		double theta = M_PI * cutoff;
-+		double sn = 0.5 * d * sin(theta);
-+		double beta = 0.5 * (1 - sn) / (1 + sn);
-+		double gamma = (0.5 + beta) * cos(theta);
-+		double alpha = 0.25 * (0.5 + beta + gamma);
-+
-+		double b0 = 2 * alpha;
-+		double b1 = 2 * -2 * alpha;
-+		double b2 = 2 * alpha;
-+		double a1 = 2 * -gamma;
-+		double a2 = 2 * beta;
-+
-+		set_coefficient(bq, b0, b1, b2, 1, a1, a2);
-+	} else {
-+		/* When cutoff is zero, we need to be careful because the above
-+		 * gives a quadratic divided by the same quadratic, with poles
-+		 * and zeros on the unit circle in the same place. When cutoff
-+		 * is zero, the z-transform is 1.
-+		 */
-+		set_coefficient(bq, 1, 0, 0, 1, 0, 0);
-+	}
-+}
-+
-+static void biquad_bandpass(struct biquad *bq, double frequency, double Q)
-+{
-+	/* No negative frequencies allowed. */
-+	frequency = max(0.0, frequency);
-+
-+	/* Don't let Q go negative, which causes an unstable filter. */
-+	Q = max(0.0, Q);
-+
-+	if (frequency > 0 && frequency < 1) {
-+		double w0 = M_PI * frequency;
-+		if (Q > 0) {
-+			double alpha = sin(w0) / (2 * Q);
-+			double k = cos(w0);
-+
-+			double b0 = alpha;
-+			double b1 = 0;
-+			double b2 = -alpha;
-+			double a0 = 1 + alpha;
-+			double a1 = -2 * k;
-+			double a2 = 1 - alpha;
-+
-+			set_coefficient(bq, b0, b1, b2, a0, a1, a2);
-+		} else {
-+			/* When Q = 0, the above formulas have problems. If we
-+			 * look at the z-transform, we can see that the limit
-+			 * as Q->0 is 1, so set the filter that way.
-+			 */
-+			set_coefficient(bq, 1, 0, 0, 1, 0, 0);
-+		}
-+	} else {
-+		/* When the cutoff is zero, the z-transform approaches 0, if Q
-+		 * > 0. When both Q and cutoff are zero, the z-transform is
-+		 * pretty much undefined. What should we do in this case?
-+		 * For now, just make the filter 0. When the cutoff is 1, the
-+		 * z-transform also approaches 0.
-+		 */
-+		set_coefficient(bq, 0, 0, 0, 1, 0, 0);
-+	}
-+}
-+
-+static void biquad_lowshelf(struct biquad *bq, double frequency, double db_gain)
-+{
-+	/* Clip frequencies to between 0 and 1, inclusive. */
-+	frequency = max(0.0, min(frequency, 1.0));
-+
-+	double A = pow(10.0, db_gain / 40);
-+
-+	if (frequency == 1) {
-+		/* The z-transform is a constant gain. */
-+		set_coefficient(bq, A * A, 0, 0, 1, 0, 0);
-+	} else if (frequency > 0) {
-+		double w0 = M_PI * frequency;
-+		double S = 1; /* filter slope (1 is max value) */
-+		double alpha = 0.5 * sin(w0) *
-+			sqrt((A + 1 / A) * (1 / S - 1) + 2);
-+		double k = cos(w0);
-+		double k2 = 2 * sqrt(A) * alpha;
-+		double a_plus_one = A + 1;
-+		double a_minus_one = A - 1;
-+
-+		double b0 = A * (a_plus_one - a_minus_one * k + k2);
-+		double b1 = 2 * A * (a_minus_one - a_plus_one * k);
-+		double b2 = A * (a_plus_one - a_minus_one * k - k2);
-+		double a0 = a_plus_one + a_minus_one * k + k2;
-+		double a1 = -2 * (a_minus_one + a_plus_one * k);
-+		double a2 = a_plus_one + a_minus_one * k - k2;
-+
-+		set_coefficient(bq, b0, b1, b2, a0, a1, a2);
-+	} else {
-+		/* When frequency is 0, the z-transform is 1. */
-+		set_coefficient(bq, 1, 0, 0, 1, 0, 0);
-+	}
-+}
-+
-+static void biquad_highshelf(struct biquad *bq, double frequency,
-+			     double db_gain)
-+{
-+	/* Clip frequencies to between 0 and 1, inclusive. */
-+	frequency = max(0.0, min(frequency, 1.0));
-+
-+	double A = pow(10.0, db_gain / 40);
-+
-+	if (frequency == 1) {
-+		/* The z-transform is 1. */
-+		set_coefficient(bq, 1, 0, 0, 1, 0, 0);
-+	} else if (frequency > 0) {
-+		double w0 = M_PI * frequency;
-+		double S = 1; /* filter slope (1 is max value) */
-+		double alpha = 0.5 * sin(w0) *
-+			sqrt((A + 1 / A) * (1 / S - 1) + 2);
-+		double k = cos(w0);
-+		double k2 = 2 * sqrt(A) * alpha;
-+		double a_plus_one = A + 1;
-+		double a_minus_one = A - 1;
-+
-+		double b0 = A * (a_plus_one + a_minus_one * k + k2);
-+		double b1 = -2 * A * (a_minus_one + a_plus_one * k);
-+		double b2 = A * (a_plus_one + a_minus_one * k - k2);
-+		double a0 = a_plus_one - a_minus_one * k + k2;
-+		double a1 = 2 * (a_minus_one - a_plus_one * k);
-+		double a2 = a_plus_one - a_minus_one * k - k2;
-+
-+		set_coefficient(bq, b0, b1, b2, a0, a1, a2);
-+	} else {
-+		/* When frequency = 0, the filter is just a gain, A^2. */
-+		set_coefficient(bq, A * A, 0, 0, 1, 0, 0);
-+	}
-+}
-+
-+static void biquad_peaking(struct biquad *bq, double frequency, double Q,
-+			   double db_gain)
-+{
-+	/* Clip frequencies to between 0 and 1, inclusive. */
-+	frequency = max(0.0, min(frequency, 1.0));
-+
-+	/* Don't let Q go negative, which causes an unstable filter. */
-+	Q = max(0.0, Q);
-+
-+	double A = pow(10.0, db_gain / 40);
-+
-+	if (frequency > 0 && frequency < 1) {
-+		if (Q > 0) {
-+			double w0 = M_PI * frequency;
-+			double alpha = sin(w0) / (2 * Q);
-+			double k = cos(w0);
-+
-+			double b0 = 1 + alpha * A;
-+			double b1 = -2 * k;
-+			double b2 = 1 - alpha * A;
-+			double a0 = 1 + alpha / A;
-+			double a1 = -2 * k;
-+			double a2 = 1 - alpha / A;
-+
-+			set_coefficient(bq, b0, b1, b2, a0, a1, a2);
-+		} else {
-+			/* When Q = 0, the above formulas have problems. If we
-+			 * look at the z-transform, we can see that the limit
-+			 * as Q->0 is A^2, so set the filter that way.
-+			 */
-+			set_coefficient(bq, A * A, 0, 0, 1, 0, 0);
-+		}
-+	} else {
-+		/* When frequency is 0 or 1, the z-transform is 1. */
-+		set_coefficient(bq, 1, 0, 0, 1, 0, 0);
-+	}
-+}
-+
-+static void biquad_notch(struct biquad *bq, double frequency, double Q)
-+{
-+	/* Clip frequencies to between 0 and 1, inclusive. */
-+	frequency = max(0.0, min(frequency, 1.0));
-+
-+	/* Don't let Q go negative, which causes an unstable filter. */
-+	Q = max(0.0, Q);
-+
-+	if (frequency > 0 && frequency < 1) {
-+		if (Q > 0) {
-+			double w0 = M_PI * frequency;
-+			double alpha = sin(w0) / (2 * Q);
-+			double k = cos(w0);
-+
-+			double b0 = 1;
-+			double b1 = -2 * k;
-+			double b2 = 1;
-+			double a0 = 1 + alpha;
-+			double a1 = -2 * k;
-+			double a2 = 1 - alpha;
-+
-+			set_coefficient(bq, b0, b1, b2, a0, a1, a2);
-+		} else {
-+			/* When Q = 0, the above formulas have problems. If we
-+			 * look at the z-transform, we can see that the limit
-+			 * as Q->0 is 0, so set the filter that way.
-+			 */
-+			set_coefficient(bq, 0, 0, 0, 1, 0, 0);
-+		}
-+	} else {
-+		/* When frequency is 0 or 1, the z-transform is 1. */
-+		set_coefficient(bq, 1, 0, 0, 1, 0, 0);
-+	}
-+}
-+
-+static void biquad_allpass(struct biquad *bq, double frequency, double Q)
-+{
-+	/* Clip frequencies to between 0 and 1, inclusive. */
-+	frequency = max(0.0, min(frequency, 1.0));
-+
-+	/* Don't let Q go negative, which causes an unstable filter. */
-+	Q = max(0.0, Q);
-+
-+	if (frequency > 0 && frequency < 1) {
-+		if (Q > 0) {
-+			double w0 = M_PI * frequency;
-+			double alpha = sin(w0) / (2 * Q);
-+			double k = cos(w0);
-+
-+			double b0 = 1 - alpha;
-+			double b1 = -2 * k;
-+			double b2 = 1 + alpha;
-+			double a0 = 1 + alpha;
-+			double a1 = -2 * k;
-+			double a2 = 1 - alpha;
-+
-+			set_coefficient(bq, b0, b1, b2, a0, a1, a2);
-+		} else {
-+			/* When Q = 0, the above formulas have problems. If we
-+			 * look at the z-transform, we can see that the limit
-+			 * as Q->0 is -1, so set the filter that way.
-+			 */
-+			set_coefficient(bq, -1, 0, 0, 1, 0, 0);
-+		}
-+	} else {
-+		/* When frequency is 0 or 1, the z-transform is 1. */
-+		set_coefficient(bq, 1, 0, 0, 1, 0, 0);
-+	}
-+}
-+
-+void biquad_set(struct biquad *bq, enum biquad_type type, double freq, double Q,
-+		double gain)
-+{
-+	/* Default is an identity filter. Also clear history values. */
-+	set_coefficient(bq, 1, 0, 0, 1, 0, 0);
-+	bq->x1 = 0;
-+	bq->x2 = 0;
-+	bq->y1 = 0;
-+	bq->y2 = 0;
-+
-+	switch (type) {
-+	case BQ_LOWPASS:
-+		biquad_lowpass(bq, freq, Q);
-+		break;
-+	case BQ_HIGHPASS:
-+		biquad_highpass(bq, freq, Q);
-+		break;
-+	case BQ_BANDPASS:
-+		biquad_bandpass(bq, freq, Q);
-+		break;
-+	case BQ_LOWSHELF:
-+		biquad_lowshelf(bq, freq, gain);
-+		break;
-+	case BQ_HIGHSHELF:
-+		biquad_highshelf(bq, freq, gain);
-+		break;
-+	case BQ_PEAKING:
-+		biquad_peaking(bq, freq, Q, gain);
-+		break;
-+	case BQ_NOTCH:
-+		biquad_notch(bq, freq, Q);
-+		break;
-+	case BQ_ALLPASS:
-+		biquad_allpass(bq, freq, Q);
-+		break;
-+	case BQ_NONE:
-+		break;
-+	}
-+}
-diff --git a/src/pulsecore/filter/biquad.h b/src/pulsecore/filter/biquad.h
-new file mode 100644
-index 0000000..c584aa9
---- /dev/null
-+++ b/src/pulsecore/filter/biquad.h
-@@ -0,0 +1,57 @@
-+/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
-+ * Use of this source code is governed by a BSD-style license that can be
-+ * found in the LICENSE file.
-+ */
-+
-+#ifndef BIQUAD_H_
-+#define BIQUAD_H_
-+
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
-+/* The biquad filter parameters. The transfer function H(z) is (b0 + b1 * z^(-1)
-+ * + b2 * z^(-2)) / (1 + a1 * z^(-1) + a2 * z^(-2)).  The previous two inputs
-+ * are stored in x1 and x2, and the previous two outputs are stored in y1 and
-+ * y2.
-+ *
-+ * We use double during the coefficients calculation for better accurary, but
-+ * float is used during the actual filtering for faster computation.
-+ */
-+struct biquad {
-+	float b0, b1, b2;
-+	float a1, a2;
-+	float x1, x2;
-+	float y1, y2;
-+};
-+
-+/* The type of the biquad filters */
-+enum biquad_type {
-+	BQ_NONE,
-+	BQ_LOWPASS,
-+	BQ_HIGHPASS,
-+	BQ_BANDPASS,
-+	BQ_LOWSHELF,
-+	BQ_HIGHSHELF,
-+	BQ_PEAKING,
-+	BQ_NOTCH,
-+	BQ_ALLPASS
-+};
-+
-+/* Initialize a biquad filter parameters from its type and parameters.
-+ * Args:
-+ *    bq - The biquad filter we want to set.
-+ *    type - The type of the biquad filter.
-+ *    frequency - The value should be in the range [0, 1]. It is relative to
-+ *        half of the sampling rate.
-+ *    Q - Quality factor. See Web Audio API for details.
-+ *    gain - The value is in dB. See Web Audio API for details.
-+ */
-+void biquad_set(struct biquad *bq, enum biquad_type type, double freq, double Q,
-+		double gain);
-+
-+#ifdef __cplusplus
-+} /* extern "C" */
-+#endif
-+
-+#endif /* BIQUAD_H_ */
-diff --git a/src/pulsecore/filter/crossover.c b/src/pulsecore/filter/crossover.c
-new file mode 100644
-index 0000000..11a8c6e
---- /dev/null
-+++ b/src/pulsecore/filter/crossover.c
-@@ -0,0 +1,188 @@
-+/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
-+ * Use of this source code is governed by a BSD-style license that can be
-+ * found in the LICENSE file.
-+ */
-+
-+#include "crossover.h"
-+#include "biquad.h"
-+
-+static void lr4_set(struct lr4 *lr4, enum biquad_type type, float freq)
-+{
-+	struct biquad q;
-+	biquad_set(&q, type, freq, 0, 0);
-+	lr4->b0 = q.b0;
-+	lr4->b1 = q.b1;
-+	lr4->b2 = q.b2;
-+	lr4->a1 = q.a1;
-+	lr4->a2 = q.a2;
-+	lr4->x1 = 0;
-+	lr4->x2 = 0;
-+	lr4->y1 = 0;
-+	lr4->y2 = 0;
-+	lr4->z1 = 0;
-+	lr4->z2 = 0;
-+}
-+
-+/* Split input data using two LR4 filters, put the result into the input array
-+ * and another array.
-+ *
-+ * data0 --+-- lp --> data0
-+ *         |
-+ *         \-- hp --> data1
-+ */
-+static void lr4_split(struct lr4 *lp, struct lr4 *hp, int count, float *data0,
-+		      float *data1)
-+{
-+	float lx1 = lp->x1;
-+	float lx2 = lp->x2;
-+	float ly1 = lp->y1;
-+	float ly2 = lp->y2;
-+	float lz1 = lp->z1;
-+	float lz2 = lp->z2;
-+	float lb0 = lp->b0;
-+	float lb1 = lp->b1;
-+	float lb2 = lp->b2;
-+	float la1 = lp->a1;
-+	float la2 = lp->a2;
-+
-+	float hx1 = hp->x1;
-+	float hx2 = hp->x2;
-+	float hy1 = hp->y1;
-+	float hy2 = hp->y2;
-+	float hz1 = hp->z1;
-+	float hz2 = hp->z2;
-+	float hb0 = hp->b0;
-+	float hb1 = hp->b1;
-+	float hb2 = hp->b2;
-+	float ha1 = hp->a1;
-+	float ha2 = hp->a2;
-+
-+	int i;
-+	for (i = 0; i < count; i++) {
-+		float x, y, z;
-+		x = data0[i];
-+		y = lb0*x + lb1*lx1 + lb2*lx2 - la1*ly1 - la2*ly2;
-+		z = lb0*y + lb1*ly1 + lb2*ly2 - la1*lz1 - la2*lz2;
-+		lx2 = lx1;
-+		lx1 = x;
-+		ly2 = ly1;
-+		ly1 = y;
-+		lz2 = lz1;
-+		lz1 = z;
-+		data0[i] = z;
-+
-+		y = hb0*x + hb1*hx1 + hb2*hx2 - ha1*hy1 - ha2*hy2;
-+		z = hb0*y + hb1*hy1 + hb2*hy2 - ha1*hz1 - ha2*hz2;
-+		hx2 = hx1;
-+		hx1 = x;
-+		hy2 = hy1;
-+		hy1 = y;
-+		hz2 = hz1;
-+		hz1 = z;
-+		data1[i] = z;
-+	}
-+
-+	lp->x1 = lx1;
-+	lp->x2 = lx2;
-+	lp->y1 = ly1;
-+	lp->y2 = ly2;
-+	lp->z1 = lz1;
-+	lp->z2 = lz2;
-+
-+	hp->x1 = hx1;
-+	hp->x2 = hx2;
-+	hp->y1 = hy1;
-+	hp->y2 = hy2;
-+	hp->z1 = hz1;
-+	hp->z2 = hz2;
-+}
-+
-+/* Split input data using two LR4 filters and sum them back to the original
-+ * data array.
-+ *
-+ * data --+-- lp --+--> data
-+ *        |        |
-+ *        \-- hp --/
-+ */
-+static void lr4_merge(struct lr4 *lp, struct lr4 *hp, int count, float *data)
-+{
-+	float lx1 = lp->x1;
-+	float lx2 = lp->x2;
-+	float ly1 = lp->y1;
-+	float ly2 = lp->y2;
-+	float lz1 = lp->z1;
-+	float lz2 = lp->z2;
-+	float lb0 = lp->b0;
-+	float lb1 = lp->b1;
-+	float lb2 = lp->b2;
-+	float la1 = lp->a1;
-+	float la2 = lp->a2;
-+
-+	float hx1 = hp->x1;
-+	float hx2 = hp->x2;
-+	float hy1 = hp->y1;
-+	float hy2 = hp->y2;
-+	float hz1 = hp->z1;
-+	float hz2 = hp->z2;
-+	float hb0 = hp->b0;
-+	float hb1 = hp->b1;
-+	float hb2 = hp->b2;
-+	float ha1 = hp->a1;
-+	float ha2 = hp->a2;
-+
-+	int i;
-+	for (i = 0; i < count; i++) {
-+		float x, y, z;
-+		x = data[i];
-+		y = lb0*x + lb1*lx1 + lb2*lx2 - la1*ly1 - la2*ly2;
-+		z = lb0*y + lb1*ly1 + lb2*ly2 - la1*lz1 - la2*lz2;
-+		lx2 = lx1;
-+		lx1 = x;
-+		ly2 = ly1;
-+		ly1 = y;
-+		lz2 = lz1;
-+		lz1 = z;
-+
-+		y = hb0*x + hb1*hx1 + hb2*hx2 - ha1*hy1 - ha2*hy2;
-+		z = hb0*y + hb1*hy1 + hb2*hy2 - ha1*hz1 - ha2*hz2;
-+		hx2 = hx1;
-+		hx1 = x;
-+		hy2 = hy1;
-+		hy1 = y;
-+		hz2 = hz1;
-+		hz1 = z;
-+		data[i] = z + lz1;
-+	}
-+
-+	lp->x1 = lx1;
-+	lp->x2 = lx2;
-+	lp->y1 = ly1;
-+	lp->y2 = ly2;
-+	lp->z1 = lz1;
-+	lp->z2 = lz2;
-+
-+	hp->x1 = hx1;
-+	hp->x2 = hx2;
-+	hp->y1 = hy1;
-+	hp->y2 = hy2;
-+	hp->z1 = hz1;
-+	hp->z2 = hz2;
-+}
-+
-+void crossover_init(struct crossover *xo, float freq1, float freq2)
-+{
-+	int i;
-+	for (i = 0; i < 3; i++) {
-+		float f = (i == 0) ? freq1 : freq2;
-+		lr4_set(&xo->lp[i], BQ_LOWPASS, f);
-+		lr4_set(&xo->hp[i], BQ_HIGHPASS, f);
-+	}
-+}
-+
-+void crossover_process(struct crossover *xo, int count, float *data0,
-+		       float *data1, float *data2)
-+{
-+	lr4_split(&xo->lp[0], &xo->hp[0], count, data0, data1);
-+	lr4_merge(&xo->lp[1], &xo->hp[1], count, data0);
-+	lr4_split(&xo->lp[2], &xo->hp[2], count, data1, data2);
-+}
-diff --git a/src/pulsecore/filter/crossover.h b/src/pulsecore/filter/crossover.h
-new file mode 100644
-index 0000000..99a601c
---- /dev/null
-+++ b/src/pulsecore/filter/crossover.h
-@@ -0,0 +1,70 @@
-+/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
-+ * Use of this source code is governed by a BSD-style license that can be
-+ * found in the LICENSE file.
-+ */
-+
-+#ifndef CROSSOVER_H_
-+#define CROSSOVER_H_
-+
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
-+/* An LR4 filter is two biquads with the same parameters connected in series:
-+ *
-+ * x -- [BIQUAD] -- y -- [BIQUAD] -- z
-+ *
-+ * Both biquad filter has the same parameter b[012] and a[12],
-+ * The variable [xyz][12] keep the history values.
-+ */
-+struct lr4 {
-+	float b0, b1, b2;
-+	float a1, a2;
-+	float x1, x2;
-+	float y1, y2;
-+	float z1, z2;
-+};
-+
-+/* Three bands crossover filter:
-+ *
-+ * INPUT --+-- lp0 --+-- lp1 --+---> LOW (0)
-+ *         |         |         |
-+ *         |         \-- hp1 --/
-+ *         |
-+ *         \-- hp0 --+-- lp2 ------> MID (1)
-+ *                   |
-+ *                   \-- hp2 ------> HIGH (2)
-+ *
-+ *            [f0]       [f1]
-+ *
-+ * Each lp or hp is an LR4 filter, which consists of two second-order
-+ * lowpass or highpass butterworth filters.
-+ */
-+struct crossover {
-+	struct lr4 lp[3], hp[3];
-+};
-+
-+/* Initializes a crossover filter
-+ * Args:
-+ *    xo - The crossover filter we want to initialize.
-+ *    freq1 - The normalized frequency splits low and mid band.
-+ *    freq2 - The normalized frequency splits mid and high band.
-+ */
-+void crossover_init(struct crossover *xo, float freq1, float freq2);
-+
-+/* Splits input samples to three bands.
-+ * Args:
-+ *    xo - The crossover filter to use.
-+ *    count - The number of input samples.
-+ *    data0 - The input samples, also the place to store low band output.
-+ *    data1 - The place to store mid band output.
-+ *    data2 - The place to store high band output.
-+ */
-+void crossover_process(struct crossover *xo, int count, float *data0,
-+		       float *data1, float *data2);
-+
-+#ifdef __cplusplus
-+} /* extern "C" */
-+#endif
-+
-+#endif /* CROSSOVER_H_ */
--- 
-1.9.1
-
diff --git a/debian/patches/0301-lfe-filter-Enable-LFE-filter-in-the-resampler.patch b/debian/patches/0301-lfe-filter-Enable-LFE-filter-in-the-resampler.patch
deleted file mode 100644
index 4d6413b..0000000
--- a/debian/patches/0301-lfe-filter-Enable-LFE-filter-in-the-resampler.patch
+++ /dev/null
@@ -1,458 +0,0 @@
-From 979f19a434733afba0480e2ba456cccc98362e05 Mon Sep 17 00:00:00 2001
-From: David Henningsson <david.henningsson at canonical.com>
-Date: Tue, 24 Mar 2015 10:29:13 +0100
-Subject: [PATCH 301/311] lfe-filter: Enable LFE filter in the resampler
-
-When enable-lfe-remixing is set, an LFE channel is present in the
-resampler's destination channel map but not in the source channel map,
-we insert a low-pass filter instead of just averaging the channels.
-Other channels will get a high-pass filter.
-
-In this patch, the crossover frequency is hardcoded to 120Hz (to be fixed
-in later patches).
-
-Note that in current state the LFE filter is
- - not very optimised
- - not rewind friendly (rewinding can cause audible artifacts)
-
-Signed-off-by: David Henningsson <david.henningsson at canonical.com>
----
- src/Makefile.am                   |   3 ++
- src/pulsecore/filter/crossover.c  |  85 +++++++++++++++++++++++++++++++-
- src/pulsecore/filter/crossover.h  |   6 +++
- src/pulsecore/filter/lfe-filter.c | 101 ++++++++++++++++++++++++++++++++++++++
- src/pulsecore/filter/lfe-filter.h |  38 ++++++++++++++
- src/pulsecore/resampler.c         |  34 +++++++++++--
- src/pulsecore/resampler.h         |   3 ++
- 7 files changed, 265 insertions(+), 5 deletions(-)
- create mode 100644 src/pulsecore/filter/lfe-filter.c
- create mode 100644 src/pulsecore/filter/lfe-filter.h
-
-Index: pulseaudio/src/Makefile.am
-===================================================================
---- pulseaudio.orig/src/Makefile.am	2015-05-13 14:59:27.522147266 +0800
-+++ pulseaudio/src/Makefile.am	2015-05-13 14:59:27.518147266 +0800
-@@ -911,6 +911,9 @@
- 
- # Pure core stuff
- libpulsecore_ at PA_MAJORMINOR@_la_SOURCES = \
-+		pulsecore/filter/lfe-filter.c pulsecore/filter/lfe-filter.h \
-+		pulsecore/filter/biquad.c pulsecore/filter/biquad.h \
-+		pulsecore/filter/crossover.c pulsecore/filter/crossover.h \
- 		pulsecore/asyncmsgq.c pulsecore/asyncmsgq.h \
- 		pulsecore/asyncq.c pulsecore/asyncq.h \
- 		pulsecore/auth-cookie.c pulsecore/auth-cookie.h \
-Index: pulseaudio/src/pulsecore/filter/crossover.c
-===================================================================
---- pulseaudio.orig/src/pulsecore/filter/crossover.c	2015-05-13 14:59:27.522147266 +0800
-+++ pulseaudio/src/pulsecore/filter/crossover.c	2015-05-13 14:59:27.518147266 +0800
-@@ -3,10 +3,16 @@
-  * found in the LICENSE file.
-  */
- 
--#include "crossover.h"
-+#ifdef HAVE_CONFIG_H
-+#include <config.h>
-+#endif
-+
-+#include <pulsecore/macro.h>
-+
- #include "biquad.h"
-+#include "crossover.h"
- 
--static void lr4_set(struct lr4 *lr4, enum biquad_type type, float freq)
-+void lr4_set(struct lr4 *lr4, enum biquad_type type, float freq)
- {
- 	struct biquad q;
- 	biquad_set(&q, type, freq, 0, 0);
-@@ -23,6 +29,81 @@
- 	lr4->z2 = 0;
- }
- 
-+void lr4_process_float32(struct lr4 *lr4, int samples, int channels, float *src, float *dest)
-+{
-+	float lx1 = lr4->x1;
-+	float lx2 = lr4->x2;
-+	float ly1 = lr4->y1;
-+	float ly2 = lr4->y2;
-+	float lz1 = lr4->z1;
-+	float lz2 = lr4->z2;
-+	float lb0 = lr4->b0;
-+	float lb1 = lr4->b1;
-+	float lb2 = lr4->b2;
-+	float la1 = lr4->a1;
-+	float la2 = lr4->a2;
-+
-+	int i;
-+	for (i = 0; i < samples * channels; i += channels) {
-+		float x, y, z;
-+		x = src[i];
-+		y = lb0*x + lb1*lx1 + lb2*lx2 - la1*ly1 - la2*ly2;
-+		z = lb0*y + lb1*ly1 + lb2*ly2 - la1*lz1 - la2*lz2;
-+		lx2 = lx1;
-+		lx1 = x;
-+		ly2 = ly1;
-+		ly1 = y;
-+		lz2 = lz1;
-+		lz1 = z;
-+		dest[i] = z;
-+	}
-+
-+	lr4->x1 = lx1;
-+	lr4->x2 = lx2;
-+	lr4->y1 = ly1;
-+	lr4->y2 = ly2;
-+	lr4->z1 = lz1;
-+	lr4->z2 = lz2;
-+}
-+
-+void lr4_process_s16(struct lr4 *lr4, int samples, int channels, short *src, short *dest)
-+{
-+	float lx1 = lr4->x1;
-+	float lx2 = lr4->x2;
-+	float ly1 = lr4->y1;
-+	float ly2 = lr4->y2;
-+	float lz1 = lr4->z1;
-+	float lz2 = lr4->z2;
-+	float lb0 = lr4->b0;
-+	float lb1 = lr4->b1;
-+	float lb2 = lr4->b2;
-+	float la1 = lr4->a1;
-+	float la2 = lr4->a2;
-+
-+	int i;
-+	for (i = 0; i < samples * channels; i += channels) {
-+		float x, y, z;
-+		x = src[i];
-+		y = lb0*x + lb1*lx1 + lb2*lx2 - la1*ly1 - la2*ly2;
-+		z = lb0*y + lb1*ly1 + lb2*ly2 - la1*lz1 - la2*lz2;
-+		lx2 = lx1;
-+		lx1 = x;
-+		ly2 = ly1;
-+		ly1 = y;
-+		lz2 = lz1;
-+		lz1 = z;
-+		dest[i] = PA_CLAMP_UNLIKELY((int) z, -0x8000, 0x7fff);
-+	}
-+
-+	lr4->x1 = lx1;
-+	lr4->x2 = lx2;
-+	lr4->y1 = ly1;
-+	lr4->y2 = ly2;
-+	lr4->z1 = lz1;
-+	lr4->z2 = lz2;
-+}
-+
-+
- /* Split input data using two LR4 filters, put the result into the input array
-  * and another array.
-  *
-Index: pulseaudio/src/pulsecore/filter/crossover.h
-===================================================================
---- pulseaudio.orig/src/pulsecore/filter/crossover.h	2015-05-13 14:59:27.522147266 +0800
-+++ pulseaudio/src/pulsecore/filter/crossover.h	2015-05-13 14:59:27.518147266 +0800
-@@ -25,6 +25,12 @@
- 	float z1, z2;
- };
- 
-+void lr4_set(struct lr4 *lr4, enum biquad_type type, float freq);
-+
-+void lr4_process_float32(struct lr4 *lr4, int samples, int channels, float *src, float *dest);
-+void lr4_process_s16(struct lr4 *lr4, int samples, int channels, short *src, short *dest);
-+
-+
- /* Three bands crossover filter:
-  *
-  * INPUT --+-- lp0 --+-- lp1 --+---> LOW (0)
-Index: pulseaudio/src/pulsecore/filter/lfe-filter.c
-===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ pulseaudio/src/pulsecore/filter/lfe-filter.c	2015-05-13 14:59:27.518147266 +0800
-@@ -0,0 +1,101 @@
-+/***
-+  This file is part of PulseAudio.
-+
-+  Copyright 2014 David Henningsson, Canonical Ltd.
-+
-+  PulseAudio is free software; you can redistribute it and/or modify
-+  it under the terms of the GNU Lesser General Public License as published
-+  by the Free Software Foundation; either version 2.1 of the License,
-+  or (at your option) any later version.
-+
-+  PulseAudio is distributed in the hope that it will be useful, but
-+  WITHOUT ANY WARRANTY; without even the implied warranty of
-+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+  General Public License for more details.
-+
-+  You should have received a copy of the GNU Lesser General Public License
-+  along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
-+***/
-+
-+#ifdef HAVE_CONFIG_H
-+#include <config.h>
-+#endif
-+
-+#include "lfe-filter.h"
-+#include <pulse/xmalloc.h>
-+#include <pulsecore/filter/biquad.h>
-+#include <pulsecore/filter/crossover.h>
-+
-+/* An LR4 filter, implemented as a chain of two Butterworth filters.
-+
-+   Currently the channel map is fixed so that a highpass filter is applied to all
-+   channels except for the LFE channel, where a lowpass filter is applied.
-+   This works well for e g stereo to 2.1/5.1/7.1 scenarios, where the remap engine
-+   has calculated the LFE channel to be the average of all source channels.
-+*/
-+
-+struct pa_lfe_filter {
-+    float crossover;
-+    pa_channel_map cm;
-+    pa_sample_spec ss;
-+    bool active;
-+    struct lr4 lr4[PA_CHANNELS_MAX];
-+};
-+
-+pa_lfe_filter_t * pa_lfe_filter_new(const pa_sample_spec* ss, const pa_channel_map* cm, float crossover_freq) {
-+
-+    pa_lfe_filter_t *f = pa_xnew0(struct pa_lfe_filter, 1);
-+    f->crossover = crossover_freq;
-+    f->cm = *cm;
-+    f->ss = *ss;
-+    pa_lfe_filter_update_rate(f, ss->rate);
-+    return f;
-+}
-+
-+void pa_lfe_filter_free(pa_lfe_filter_t *f) {
-+    pa_xfree(f);
-+}
-+
-+void pa_lfe_filter_reset(pa_lfe_filter_t *f) {
-+    pa_lfe_filter_update_rate(f, f->ss.rate);
-+}
-+
-+pa_memchunk * pa_lfe_filter_process(pa_lfe_filter_t *f, pa_memchunk *buf) {
-+    int samples = buf->length / pa_frame_size(&f->ss);
-+
-+    if (!f->active)
-+        return buf;
-+    if (f->ss.format == PA_SAMPLE_FLOAT32NE) {
-+        int i;
-+        float *data = pa_memblock_acquire_chunk(buf);
-+        for (i = 0; i < f->cm.channels; i++)
-+            lr4_process_float32(&f->lr4[i], samples, f->cm.channels, &data[i], &data[i]);
-+        pa_memblock_release(buf->memblock);
-+    }
-+    else if (f->ss.format == PA_SAMPLE_S16NE) {
-+        int i;
-+        short *data = pa_memblock_acquire_chunk(buf);
-+        for (i = 0; i < f->cm.channels; i++)
-+            lr4_process_s16(&f->lr4[i], samples, f->cm.channels, &data[i], &data[i]);
-+        pa_memblock_release(buf->memblock);
-+    }
-+    else pa_assert_not_reached();
-+    return buf;
-+}
-+
-+void pa_lfe_filter_update_rate(pa_lfe_filter_t *f, uint32_t new_rate) {
-+    int i;
-+    float biquad_freq = f->crossover / (new_rate / 2);
-+
-+    f->ss.rate = new_rate;
-+    if (biquad_freq <= 0 || biquad_freq >= 1) {
-+        pa_log_warn("Crossover frequency (%f) outside range for sample rate %d", f->crossover, new_rate);
-+        f->active = false;
-+        return;
-+    }
-+
-+    for (i = 0; i < f->cm.channels; i++)
-+        lr4_set(&f->lr4[i], f->cm.map[i] == PA_CHANNEL_POSITION_LFE ? BQ_LOWPASS : BQ_HIGHPASS, biquad_freq);
-+
-+    f->active = true;
-+}
-Index: pulseaudio/src/pulsecore/filter/lfe-filter.h
-===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ pulseaudio/src/pulsecore/filter/lfe-filter.h	2015-05-13 14:59:27.518147266 +0800
-@@ -0,0 +1,38 @@
-+#ifndef foolfefilterhfoo
-+#define foolfefilterhfoo
-+
-+/***
-+  This file is part of PulseAudio.
-+
-+  Copyright 2014 David Henningsson, Canonical Ltd.
-+
-+  PulseAudio is free software; you can redistribute it and/or modify
-+  it under the terms of the GNU Lesser General Public License as published
-+  by the Free Software Foundation; either version 2.1 of the License,
-+  or (at your option) any later version.
-+
-+  PulseAudio is distributed in the hope that it will be useful, but
-+  WITHOUT ANY WARRANTY; without even the implied warranty of
-+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+  General Public License for more details.
-+
-+  You should have received a copy of the GNU Lesser General Public License
-+  along with PulseAudio; if not, write to the Free Software
-+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-+  USA.
-+***/
-+
-+#include <pulse/sample.h>
-+#include <pulse/channelmap.h>
-+#include <pulsecore/memchunk.h>
-+
-+
-+typedef struct pa_lfe_filter pa_lfe_filter_t;
-+
-+pa_lfe_filter_t * pa_lfe_filter_new(const pa_sample_spec* ss, const pa_channel_map* cm, float crossover_freq);
-+void pa_lfe_filter_free(pa_lfe_filter_t *);
-+void pa_lfe_filter_reset(pa_lfe_filter_t *);
-+pa_memchunk * pa_lfe_filter_process(pa_lfe_filter_t *filter, pa_memchunk *buf);
-+void pa_lfe_filter_update_rate(pa_lfe_filter_t *, uint32_t new_rate);
-+
-+#endif
-Index: pulseaudio/src/pulsecore/resampler.c
-===================================================================
---- pulseaudio.orig/src/pulsecore/resampler.c	2015-05-13 14:59:27.522147266 +0800
-+++ pulseaudio/src/pulsecore/resampler.c	2015-05-13 14:59:27.518147266 +0800
-@@ -40,7 +40,7 @@
- 
- static int copy_init(pa_resampler *r);
- 
--static void setup_remap(const pa_resampler *r, pa_remap_t *m);
-+static void setup_remap(const pa_resampler *r, pa_remap_t *m, bool *lfe_filter_required);
- static void free_remap(pa_remap_t *m);
- 
- static int (* const init_table[])(pa_resampler *r) = {
-@@ -302,6 +302,7 @@
-         pa_resample_flags_t flags) {
- 
-     pa_resampler *r = NULL;
-+    bool lfe_filter_required = false;
- 
-     pa_assert(pool);
-     pa_assert(a);
-@@ -390,7 +391,15 @@
- 
-     /* set up the remap structure */
-     if (r->map_required)
--        setup_remap(r, &r->remap);
-+        setup_remap(r, &r->remap, &lfe_filter_required);
-+
-+    if (lfe_filter_required) {
-+        pa_sample_spec wss = r->o_ss;
-+        wss.format = r->work_format;
-+        /* TODO: Temporary code that sets crossover freq to 120 Hz. This should be a parameter */
-+        r->lfe_filter = pa_lfe_filter_new(&wss, &r->o_cm, 120.0f);
-+        pa_log_debug("  lfe filter activated (LR4 type)");
-+    }
- 
-     /* initialize implementation */
-     if (init_table[method](r) < 0)
-@@ -412,6 +421,9 @@
-     else
-         pa_xfree(r->impl.data);
- 
-+    if (r->lfe_filter)
-+        pa_lfe_filter_free(r->lfe_filter);
-+
-     if (r->to_work_format_buf.memblock)
-         pa_memblock_unref(r->to_work_format_buf.memblock);
-     if (r->remap_buf.memblock)
-@@ -450,6 +462,9 @@
-     r->o_ss.rate = rate;
- 
-     r->impl.update_rates(r);
-+
-+    if (r->lfe_filter)
-+        pa_lfe_filter_update_rate(r->lfe_filter, rate);
- }
- 
- size_t pa_resampler_request(pa_resampler *r, size_t out_length) {
-@@ -534,6 +549,9 @@
-     if (r->impl.reset)
-         r->impl.reset(r);
- 
-+    if (r->lfe_filter)
-+        pa_lfe_filter_reset(r->lfe_filter);
-+
-     *r->have_leftover = false;
- }
- 
-@@ -731,7 +749,7 @@
-     return ON_OTHER;
- }
- 
--static void setup_remap(const pa_resampler *r, pa_remap_t *m) {
-+static void setup_remap(const pa_resampler *r, pa_remap_t *m, bool *lfe_filter_required) {
-     unsigned oc, ic;
-     unsigned n_oc, n_ic;
-     bool ic_connected[PA_CHANNELS_MAX];
-@@ -740,6 +758,7 @@
- 
-     pa_assert(r);
-     pa_assert(m);
-+    pa_assert(lfe_filter_required);
- 
-     n_oc = r->o_ss.channels;
-     n_ic = r->i_ss.channels;
-@@ -752,6 +771,7 @@
-     memset(m->map_table_i, 0, sizeof(m->map_table_i));
- 
-     memset(ic_connected, 0, sizeof(ic_connected));
-+    *lfe_filter_required = false;
- 
-     if (r->flags & PA_RESAMPLER_NO_REMAP) {
-         for (oc = 0; oc < PA_MIN(n_ic, n_oc); oc++)
-@@ -863,6 +883,9 @@
- 
-                     oc_connected = true;
-                     ic_connected[ic] = true;
-+
-+                    if (a == PA_CHANNEL_POSITION_MONO && on_lfe(b) && !(r->flags & PA_RESAMPLER_NO_LFE))
-+                        *lfe_filter_required = true;
-                 }
-                 else if (b == PA_CHANNEL_POSITION_MONO) {
-                     m->map_table_f[oc][ic] = 1.0f / (float) n_ic;
-@@ -945,6 +968,8 @@
- 
-                     /* Please note that a channel connected to LFE doesn't
-                      * really count as connected. */
-+
-+                    *lfe_filter_required = true;
-                 }
-             }
-         }
-@@ -1315,6 +1340,9 @@
-         buf = remap_channels(r, buf);
-     }
- 
-+    if (r->lfe_filter)
-+        buf = pa_lfe_filter_process(r->lfe_filter, buf);
-+
-     if (buf->length) {
-         buf = convert_from_work_format(r, buf);
-         *out = *buf;
-Index: pulseaudio/src/pulsecore/resampler.h
-===================================================================
---- pulseaudio.orig/src/pulsecore/resampler.h	2015-05-13 14:59:27.522147266 +0800
-+++ pulseaudio/src/pulsecore/resampler.h	2015-05-13 14:59:27.518147266 +0800
-@@ -26,6 +26,7 @@
- #include <pulsecore/memchunk.h>
- #include <pulsecore/sconv.h>
- #include <pulsecore/remap.h>
-+#include <pulsecore/filter/lfe-filter.h>
- 
- typedef struct pa_resampler pa_resampler;
- typedef struct pa_resampler_impl pa_resampler_impl;
-@@ -103,6 +104,8 @@
-     pa_remap_t remap;
-     bool map_required;
- 
-+    pa_lfe_filter_t *lfe_filter;
-+
-     pa_resampler_impl impl;
- };
- 
diff --git a/debian/patches/0302-lfe-filter-Cleanup-and-refactor.patch b/debian/patches/0302-lfe-filter-Cleanup-and-refactor.patch
deleted file mode 100644
index 9c552b9..0000000
--- a/debian/patches/0302-lfe-filter-Cleanup-and-refactor.patch
+++ /dev/null
@@ -1,707 +0,0 @@
-From 3538e6636edc1ba0b75e7409db618dbb7fe79d3e Mon Sep 17 00:00:00 2001
-From: David Henningsson <david.henningsson at canonical.com>
-Date: Tue, 24 Mar 2015 10:29:14 +0100
-Subject: [PATCH 302/311] lfe-filter: Cleanup and refactor
-
- - Remove imported dead code
- - Fix compiler warnings
- - Fix non-GCC compiler compilation (use more portable macros)
- - Change lr4 struct to include a biquad struct
-
-Thanks to Alexander Patrakov for suggesting many of these changes.
-
-Signed-off-by: David Henningsson <david.henningsson at canonical.com>
----
- src/pulsecore/filter/biquad.c    | 289 +++------------------------------------
- src/pulsecore/filter/biquad.h    |  14 +-
- src/pulsecore/filter/crossover.c | 194 ++------------------------
- src/pulsecore/filter/crossover.h |  51 +------
- 4 files changed, 33 insertions(+), 515 deletions(-)
-
-diff --git a/src/pulsecore/filter/biquad.c b/src/pulsecore/filter/biquad.c
-index b28256d..7c21a29 100644
---- a/src/pulsecore/filter/biquad.c
-+++ b/src/pulsecore/filter/biquad.c
-@@ -8,20 +8,15 @@
-  * found in the LICENSE.WEBKIT file.
-  */
- 
--#include <math.h>
--#include "biquad.h"
- 
--#ifndef max
--#define max(a, b) ({ __typeof__(a) _a = (a);	\
--			__typeof__(b) _b = (b);	\
--			_a > _b ? _a : _b; })
-+#ifdef HAVE_CONFIG_H
-+#include <config.h>
- #endif
- 
--#ifndef min
--#define min(a, b) ({ __typeof__(a) _a = (a);	\
--			__typeof__(b) _b = (b);	\
--			_a < _b ? _a : _b; })
--#endif
-+#include <pulsecore/macro.h>
-+
-+#include <math.h>
-+#include "biquad.h"
- 
- #ifndef M_PI
- #define M_PI 3.14159265358979323846
-@@ -38,19 +33,18 @@ static void set_coefficient(struct biquad *bq, double b0, double b1, double b2,
- 	bq->a2 = a2 * a0_inv;
- }
- 
--static void biquad_lowpass(struct biquad *bq, double cutoff, double resonance)
-+static void biquad_lowpass(struct biquad *bq, double cutoff)
- {
- 	/* Limit cutoff to 0 to 1. */
--	cutoff = max(0.0, min(cutoff, 1.0));
-+	cutoff = PA_MIN(cutoff, 1.0);
-+	cutoff = PA_MAX(0.0, cutoff);
- 
--	if (cutoff == 1) {
-+	if (cutoff >= 1.0) {
- 		/* When cutoff is 1, the z-transform is 1. */
- 		set_coefficient(bq, 1, 0, 0, 1, 0, 0);
- 	} else if (cutoff > 0) {
- 		/* Compute biquad coefficients for lowpass filter */
--		resonance = max(0.0, resonance); /* can't go negative */
--		double g = pow(10.0, 0.05 * resonance);
--		double d = sqrt((4 - sqrt(16 - 16 / (g * g))) / 2);
-+		double d = sqrt(2);
- 
- 		double theta = M_PI * cutoff;
- 		double sn = 0.5 * d * sin(theta);
-@@ -73,19 +67,18 @@ static void biquad_lowpass(struct biquad *bq, double cutoff, double resonance)
- 	}
- }
- 
--static void biquad_highpass(struct biquad *bq, double cutoff, double resonance)
-+static void biquad_highpass(struct biquad *bq, double cutoff)
- {
- 	/* Limit cutoff to 0 to 1. */
--	cutoff = max(0.0, min(cutoff, 1.0));
-+	cutoff = PA_MIN(cutoff, 1.0);
-+	cutoff = PA_MAX(0.0, cutoff);
- 
--	if (cutoff == 1) {
-+	if (cutoff >= 1.0) {
- 		/* The z-transform is 0. */
- 		set_coefficient(bq, 0, 0, 0, 1, 0, 0);
- 	} else if (cutoff > 0) {
- 		/* Compute biquad coefficients for highpass filter */
--		resonance = max(0.0, resonance); /* can't go negative */
--		double g = pow(10.0, 0.05 * resonance);
--		double d = sqrt((4 - sqrt(16 - 16 / (g * g))) / 2);
-+		double d = sqrt(2);
- 
- 		double theta = M_PI * cutoff;
- 		double sn = 0.5 * d * sin(theta);
-@@ -110,259 +103,15 @@ static void biquad_highpass(struct biquad *bq, double cutoff, double resonance)
- 	}
- }
- 
--static void biquad_bandpass(struct biquad *bq, double frequency, double Q)
--{
--	/* No negative frequencies allowed. */
--	frequency = max(0.0, frequency);
--
--	/* Don't let Q go negative, which causes an unstable filter. */
--	Q = max(0.0, Q);
--
--	if (frequency > 0 && frequency < 1) {
--		double w0 = M_PI * frequency;
--		if (Q > 0) {
--			double alpha = sin(w0) / (2 * Q);
--			double k = cos(w0);
--
--			double b0 = alpha;
--			double b1 = 0;
--			double b2 = -alpha;
--			double a0 = 1 + alpha;
--			double a1 = -2 * k;
--			double a2 = 1 - alpha;
--
--			set_coefficient(bq, b0, b1, b2, a0, a1, a2);
--		} else {
--			/* When Q = 0, the above formulas have problems. If we
--			 * look at the z-transform, we can see that the limit
--			 * as Q->0 is 1, so set the filter that way.
--			 */
--			set_coefficient(bq, 1, 0, 0, 1, 0, 0);
--		}
--	} else {
--		/* When the cutoff is zero, the z-transform approaches 0, if Q
--		 * > 0. When both Q and cutoff are zero, the z-transform is
--		 * pretty much undefined. What should we do in this case?
--		 * For now, just make the filter 0. When the cutoff is 1, the
--		 * z-transform also approaches 0.
--		 */
--		set_coefficient(bq, 0, 0, 0, 1, 0, 0);
--	}
--}
--
--static void biquad_lowshelf(struct biquad *bq, double frequency, double db_gain)
--{
--	/* Clip frequencies to between 0 and 1, inclusive. */
--	frequency = max(0.0, min(frequency, 1.0));
--
--	double A = pow(10.0, db_gain / 40);
--
--	if (frequency == 1) {
--		/* The z-transform is a constant gain. */
--		set_coefficient(bq, A * A, 0, 0, 1, 0, 0);
--	} else if (frequency > 0) {
--		double w0 = M_PI * frequency;
--		double S = 1; /* filter slope (1 is max value) */
--		double alpha = 0.5 * sin(w0) *
--			sqrt((A + 1 / A) * (1 / S - 1) + 2);
--		double k = cos(w0);
--		double k2 = 2 * sqrt(A) * alpha;
--		double a_plus_one = A + 1;
--		double a_minus_one = A - 1;
--
--		double b0 = A * (a_plus_one - a_minus_one * k + k2);
--		double b1 = 2 * A * (a_minus_one - a_plus_one * k);
--		double b2 = A * (a_plus_one - a_minus_one * k - k2);
--		double a0 = a_plus_one + a_minus_one * k + k2;
--		double a1 = -2 * (a_minus_one + a_plus_one * k);
--		double a2 = a_plus_one + a_minus_one * k - k2;
--
--		set_coefficient(bq, b0, b1, b2, a0, a1, a2);
--	} else {
--		/* When frequency is 0, the z-transform is 1. */
--		set_coefficient(bq, 1, 0, 0, 1, 0, 0);
--	}
--}
--
--static void biquad_highshelf(struct biquad *bq, double frequency,
--			     double db_gain)
-+void biquad_set(struct biquad *bq, enum biquad_type type, double freq)
- {
--	/* Clip frequencies to between 0 and 1, inclusive. */
--	frequency = max(0.0, min(frequency, 1.0));
--
--	double A = pow(10.0, db_gain / 40);
--
--	if (frequency == 1) {
--		/* The z-transform is 1. */
--		set_coefficient(bq, 1, 0, 0, 1, 0, 0);
--	} else if (frequency > 0) {
--		double w0 = M_PI * frequency;
--		double S = 1; /* filter slope (1 is max value) */
--		double alpha = 0.5 * sin(w0) *
--			sqrt((A + 1 / A) * (1 / S - 1) + 2);
--		double k = cos(w0);
--		double k2 = 2 * sqrt(A) * alpha;
--		double a_plus_one = A + 1;
--		double a_minus_one = A - 1;
--
--		double b0 = A * (a_plus_one + a_minus_one * k + k2);
--		double b1 = -2 * A * (a_minus_one + a_plus_one * k);
--		double b2 = A * (a_plus_one + a_minus_one * k - k2);
--		double a0 = a_plus_one - a_minus_one * k + k2;
--		double a1 = 2 * (a_minus_one - a_plus_one * k);
--		double a2 = a_plus_one - a_minus_one * k - k2;
--
--		set_coefficient(bq, b0, b1, b2, a0, a1, a2);
--	} else {
--		/* When frequency = 0, the filter is just a gain, A^2. */
--		set_coefficient(bq, A * A, 0, 0, 1, 0, 0);
--	}
--}
--
--static void biquad_peaking(struct biquad *bq, double frequency, double Q,
--			   double db_gain)
--{
--	/* Clip frequencies to between 0 and 1, inclusive. */
--	frequency = max(0.0, min(frequency, 1.0));
--
--	/* Don't let Q go negative, which causes an unstable filter. */
--	Q = max(0.0, Q);
--
--	double A = pow(10.0, db_gain / 40);
--
--	if (frequency > 0 && frequency < 1) {
--		if (Q > 0) {
--			double w0 = M_PI * frequency;
--			double alpha = sin(w0) / (2 * Q);
--			double k = cos(w0);
--
--			double b0 = 1 + alpha * A;
--			double b1 = -2 * k;
--			double b2 = 1 - alpha * A;
--			double a0 = 1 + alpha / A;
--			double a1 = -2 * k;
--			double a2 = 1 - alpha / A;
--
--			set_coefficient(bq, b0, b1, b2, a0, a1, a2);
--		} else {
--			/* When Q = 0, the above formulas have problems. If we
--			 * look at the z-transform, we can see that the limit
--			 * as Q->0 is A^2, so set the filter that way.
--			 */
--			set_coefficient(bq, A * A, 0, 0, 1, 0, 0);
--		}
--	} else {
--		/* When frequency is 0 or 1, the z-transform is 1. */
--		set_coefficient(bq, 1, 0, 0, 1, 0, 0);
--	}
--}
--
--static void biquad_notch(struct biquad *bq, double frequency, double Q)
--{
--	/* Clip frequencies to between 0 and 1, inclusive. */
--	frequency = max(0.0, min(frequency, 1.0));
--
--	/* Don't let Q go negative, which causes an unstable filter. */
--	Q = max(0.0, Q);
--
--	if (frequency > 0 && frequency < 1) {
--		if (Q > 0) {
--			double w0 = M_PI * frequency;
--			double alpha = sin(w0) / (2 * Q);
--			double k = cos(w0);
--
--			double b0 = 1;
--			double b1 = -2 * k;
--			double b2 = 1;
--			double a0 = 1 + alpha;
--			double a1 = -2 * k;
--			double a2 = 1 - alpha;
--
--			set_coefficient(bq, b0, b1, b2, a0, a1, a2);
--		} else {
--			/* When Q = 0, the above formulas have problems. If we
--			 * look at the z-transform, we can see that the limit
--			 * as Q->0 is 0, so set the filter that way.
--			 */
--			set_coefficient(bq, 0, 0, 0, 1, 0, 0);
--		}
--	} else {
--		/* When frequency is 0 or 1, the z-transform is 1. */
--		set_coefficient(bq, 1, 0, 0, 1, 0, 0);
--	}
--}
--
--static void biquad_allpass(struct biquad *bq, double frequency, double Q)
--{
--	/* Clip frequencies to between 0 and 1, inclusive. */
--	frequency = max(0.0, min(frequency, 1.0));
--
--	/* Don't let Q go negative, which causes an unstable filter. */
--	Q = max(0.0, Q);
--
--	if (frequency > 0 && frequency < 1) {
--		if (Q > 0) {
--			double w0 = M_PI * frequency;
--			double alpha = sin(w0) / (2 * Q);
--			double k = cos(w0);
--
--			double b0 = 1 - alpha;
--			double b1 = -2 * k;
--			double b2 = 1 + alpha;
--			double a0 = 1 + alpha;
--			double a1 = -2 * k;
--			double a2 = 1 - alpha;
--
--			set_coefficient(bq, b0, b1, b2, a0, a1, a2);
--		} else {
--			/* When Q = 0, the above formulas have problems. If we
--			 * look at the z-transform, we can see that the limit
--			 * as Q->0 is -1, so set the filter that way.
--			 */
--			set_coefficient(bq, -1, 0, 0, 1, 0, 0);
--		}
--	} else {
--		/* When frequency is 0 or 1, the z-transform is 1. */
--		set_coefficient(bq, 1, 0, 0, 1, 0, 0);
--	}
--}
--
--void biquad_set(struct biquad *bq, enum biquad_type type, double freq, double Q,
--		double gain)
--{
--	/* Default is an identity filter. Also clear history values. */
--	set_coefficient(bq, 1, 0, 0, 1, 0, 0);
--	bq->x1 = 0;
--	bq->x2 = 0;
--	bq->y1 = 0;
--	bq->y2 = 0;
- 
- 	switch (type) {
- 	case BQ_LOWPASS:
--		biquad_lowpass(bq, freq, Q);
-+		biquad_lowpass(bq, freq);
- 		break;
- 	case BQ_HIGHPASS:
--		biquad_highpass(bq, freq, Q);
--		break;
--	case BQ_BANDPASS:
--		biquad_bandpass(bq, freq, Q);
--		break;
--	case BQ_LOWSHELF:
--		biquad_lowshelf(bq, freq, gain);
--		break;
--	case BQ_HIGHSHELF:
--		biquad_highshelf(bq, freq, gain);
--		break;
--	case BQ_PEAKING:
--		biquad_peaking(bq, freq, Q, gain);
--		break;
--	case BQ_NOTCH:
--		biquad_notch(bq, freq, Q);
--		break;
--	case BQ_ALLPASS:
--		biquad_allpass(bq, freq, Q);
--		break;
--	case BQ_NONE:
-+		biquad_highpass(bq, freq);
- 		break;
- 	}
- }
-diff --git a/src/pulsecore/filter/biquad.h b/src/pulsecore/filter/biquad.h
-index c584aa9..bb8f2fb 100644
---- a/src/pulsecore/filter/biquad.h
-+++ b/src/pulsecore/filter/biquad.h
-@@ -21,21 +21,12 @@ extern "C" {
- struct biquad {
- 	float b0, b1, b2;
- 	float a1, a2;
--	float x1, x2;
--	float y1, y2;
- };
- 
- /* The type of the biquad filters */
- enum biquad_type {
--	BQ_NONE,
- 	BQ_LOWPASS,
- 	BQ_HIGHPASS,
--	BQ_BANDPASS,
--	BQ_LOWSHELF,
--	BQ_HIGHSHELF,
--	BQ_PEAKING,
--	BQ_NOTCH,
--	BQ_ALLPASS
- };
- 
- /* Initialize a biquad filter parameters from its type and parameters.
-@@ -44,11 +35,8 @@ enum biquad_type {
-  *    type - The type of the biquad filter.
-  *    frequency - The value should be in the range [0, 1]. It is relative to
-  *        half of the sampling rate.
-- *    Q - Quality factor. See Web Audio API for details.
-- *    gain - The value is in dB. See Web Audio API for details.
-  */
--void biquad_set(struct biquad *bq, enum biquad_type type, double freq, double Q,
--		double gain);
-+void biquad_set(struct biquad *bq, enum biquad_type type, double freq);
- 
- #ifdef __cplusplus
- } /* extern "C" */
-diff --git a/src/pulsecore/filter/crossover.c b/src/pulsecore/filter/crossover.c
-index 0a571c3..dab34af 100644
---- a/src/pulsecore/filter/crossover.c
-+++ b/src/pulsecore/filter/crossover.c
-@@ -9,18 +9,11 @@
- 
- #include <pulsecore/macro.h>
- 
--#include "biquad.h"
- #include "crossover.h"
- 
- void lr4_set(struct lr4 *lr4, enum biquad_type type, float freq)
- {
--	struct biquad q;
--	biquad_set(&q, type, freq, 0, 0);
--	lr4->b0 = q.b0;
--	lr4->b1 = q.b1;
--	lr4->b2 = q.b2;
--	lr4->a1 = q.a1;
--	lr4->a2 = q.a2;
-+	biquad_set(&lr4->bq, type, freq);
- 	lr4->x1 = 0;
- 	lr4->x2 = 0;
- 	lr4->y1 = 0;
-@@ -37,11 +30,11 @@ void lr4_process_float32(struct lr4 *lr4, int samples, int channels, float *src,
- 	float ly2 = lr4->y2;
- 	float lz1 = lr4->z1;
- 	float lz2 = lr4->z2;
--	float lb0 = lr4->b0;
--	float lb1 = lr4->b1;
--	float lb2 = lr4->b2;
--	float la1 = lr4->a1;
--	float la2 = lr4->a2;
-+	float lb0 = lr4->bq.b0;
-+	float lb1 = lr4->bq.b1;
-+	float lb2 = lr4->bq.b2;
-+	float la1 = lr4->bq.a1;
-+	float la2 = lr4->bq.a2;
- 
- 	int i;
- 	for (i = 0; i < samples * channels; i += channels) {
-@@ -74,11 +67,11 @@ void lr4_process_s16(struct lr4 *lr4, int samples, int channels, short *src, sho
- 	float ly2 = lr4->y2;
- 	float lz1 = lr4->z1;
- 	float lz2 = lr4->z2;
--	float lb0 = lr4->b0;
--	float lb1 = lr4->b1;
--	float lb2 = lr4->b2;
--	float la1 = lr4->a1;
--	float la2 = lr4->a2;
-+	float lb0 = lr4->bq.b0;
-+	float lb1 = lr4->bq.b1;
-+	float lb2 = lr4->bq.b2;
-+	float la1 = lr4->bq.a1;
-+	float la2 = lr4->bq.a2;
- 
- 	int i;
- 	for (i = 0; i < samples * channels; i += channels) {
-@@ -102,168 +95,3 @@ void lr4_process_s16(struct lr4 *lr4, int samples, int channels, short *src, sho
- 	lr4->z1 = lz1;
- 	lr4->z2 = lz2;
- }
--
--
--/* Split input data using two LR4 filters, put the result into the input array
-- * and another array.
-- *
-- * data0 --+-- lp --> data0
-- *         |
-- *         \-- hp --> data1
-- */
--static void lr4_split(struct lr4 *lp, struct lr4 *hp, int count, float *data0,
--		      float *data1)
--{
--	float lx1 = lp->x1;
--	float lx2 = lp->x2;
--	float ly1 = lp->y1;
--	float ly2 = lp->y2;
--	float lz1 = lp->z1;
--	float lz2 = lp->z2;
--	float lb0 = lp->b0;
--	float lb1 = lp->b1;
--	float lb2 = lp->b2;
--	float la1 = lp->a1;
--	float la2 = lp->a2;
--
--	float hx1 = hp->x1;
--	float hx2 = hp->x2;
--	float hy1 = hp->y1;
--	float hy2 = hp->y2;
--	float hz1 = hp->z1;
--	float hz2 = hp->z2;
--	float hb0 = hp->b0;
--	float hb1 = hp->b1;
--	float hb2 = hp->b2;
--	float ha1 = hp->a1;
--	float ha2 = hp->a2;
--
--	int i;
--	for (i = 0; i < count; i++) {
--		float x, y, z;
--		x = data0[i];
--		y = lb0*x + lb1*lx1 + lb2*lx2 - la1*ly1 - la2*ly2;
--		z = lb0*y + lb1*ly1 + lb2*ly2 - la1*lz1 - la2*lz2;
--		lx2 = lx1;
--		lx1 = x;
--		ly2 = ly1;
--		ly1 = y;
--		lz2 = lz1;
--		lz1 = z;
--		data0[i] = z;
--
--		y = hb0*x + hb1*hx1 + hb2*hx2 - ha1*hy1 - ha2*hy2;
--		z = hb0*y + hb1*hy1 + hb2*hy2 - ha1*hz1 - ha2*hz2;
--		hx2 = hx1;
--		hx1 = x;
--		hy2 = hy1;
--		hy1 = y;
--		hz2 = hz1;
--		hz1 = z;
--		data1[i] = z;
--	}
--
--	lp->x1 = lx1;
--	lp->x2 = lx2;
--	lp->y1 = ly1;
--	lp->y2 = ly2;
--	lp->z1 = lz1;
--	lp->z2 = lz2;
--
--	hp->x1 = hx1;
--	hp->x2 = hx2;
--	hp->y1 = hy1;
--	hp->y2 = hy2;
--	hp->z1 = hz1;
--	hp->z2 = hz2;
--}
--
--/* Split input data using two LR4 filters and sum them back to the original
-- * data array.
-- *
-- * data --+-- lp --+--> data
-- *        |        |
-- *        \-- hp --/
-- */
--static void lr4_merge(struct lr4 *lp, struct lr4 *hp, int count, float *data)
--{
--	float lx1 = lp->x1;
--	float lx2 = lp->x2;
--	float ly1 = lp->y1;
--	float ly2 = lp->y2;
--	float lz1 = lp->z1;
--	float lz2 = lp->z2;
--	float lb0 = lp->b0;
--	float lb1 = lp->b1;
--	float lb2 = lp->b2;
--	float la1 = lp->a1;
--	float la2 = lp->a2;
--
--	float hx1 = hp->x1;
--	float hx2 = hp->x2;
--	float hy1 = hp->y1;
--	float hy2 = hp->y2;
--	float hz1 = hp->z1;
--	float hz2 = hp->z2;
--	float hb0 = hp->b0;
--	float hb1 = hp->b1;
--	float hb2 = hp->b2;
--	float ha1 = hp->a1;
--	float ha2 = hp->a2;
--
--	int i;
--	for (i = 0; i < count; i++) {
--		float x, y, z;
--		x = data[i];
--		y = lb0*x + lb1*lx1 + lb2*lx2 - la1*ly1 - la2*ly2;
--		z = lb0*y + lb1*ly1 + lb2*ly2 - la1*lz1 - la2*lz2;
--		lx2 = lx1;
--		lx1 = x;
--		ly2 = ly1;
--		ly1 = y;
--		lz2 = lz1;
--		lz1 = z;
--
--		y = hb0*x + hb1*hx1 + hb2*hx2 - ha1*hy1 - ha2*hy2;
--		z = hb0*y + hb1*hy1 + hb2*hy2 - ha1*hz1 - ha2*hz2;
--		hx2 = hx1;
--		hx1 = x;
--		hy2 = hy1;
--		hy1 = y;
--		hz2 = hz1;
--		hz1 = z;
--		data[i] = z + lz1;
--	}
--
--	lp->x1 = lx1;
--	lp->x2 = lx2;
--	lp->y1 = ly1;
--	lp->y2 = ly2;
--	lp->z1 = lz1;
--	lp->z2 = lz2;
--
--	hp->x1 = hx1;
--	hp->x2 = hx2;
--	hp->y1 = hy1;
--	hp->y2 = hy2;
--	hp->z1 = hz1;
--	hp->z2 = hz2;
--}
--
--void crossover_init(struct crossover *xo, float freq1, float freq2)
--{
--	int i;
--	for (i = 0; i < 3; i++) {
--		float f = (i == 0) ? freq1 : freq2;
--		lr4_set(&xo->lp[i], BQ_LOWPASS, f);
--		lr4_set(&xo->hp[i], BQ_HIGHPASS, f);
--	}
--}
--
--void crossover_process(struct crossover *xo, int count, float *data0,
--		       float *data1, float *data2)
--{
--	lr4_split(&xo->lp[0], &xo->hp[0], count, data0, data1);
--	lr4_merge(&xo->lp[1], &xo->hp[1], count, data0);
--	lr4_split(&xo->lp[2], &xo->hp[2], count, data1, data2);
--}
-diff --git a/src/pulsecore/filter/crossover.h b/src/pulsecore/filter/crossover.h
-index a88f5b6..c5c9765 100644
---- a/src/pulsecore/filter/crossover.h
-+++ b/src/pulsecore/filter/crossover.h
-@@ -6,10 +6,7 @@
- #ifndef CROSSOVER_H_
- #define CROSSOVER_H_
- 
--#ifdef __cplusplus
--extern "C" {
--#endif
--
-+#include "biquad.h"
- /* An LR4 filter is two biquads with the same parameters connected in series:
-  *
-  * x -- [BIQUAD] -- y -- [BIQUAD] -- z
-@@ -18,8 +15,7 @@ extern "C" {
-  * The variable [xyz][12] keep the history values.
-  */
- struct lr4 {
--	float b0, b1, b2;
--	float a1, a2;
-+	struct biquad bq;
- 	float x1, x2;
- 	float y1, y2;
- 	float z1, z2;
-@@ -30,47 +26,4 @@ void lr4_set(struct lr4 *lr4, enum biquad_type type, float freq);
- void lr4_process_float32(struct lr4 *lr4, int samples, int channels, float *src, float *dest);
- void lr4_process_s16(struct lr4 *lr4, int samples, int channels, short *src, short *dest);
- 
--
--/* Three bands crossover filter:
-- *
-- * INPUT --+-- lp0 --+-- lp1 --+---> LOW (0)
-- *         |         |         |
-- *         |         \-- hp1 --/
-- *         |
-- *         \-- hp0 --+-- lp2 ------> MID (1)
-- *                   |
-- *                   \-- hp2 ------> HIGH (2)
-- *
-- *            [f0]       [f1]
-- *
-- * Each lp or hp is an LR4 filter, which consists of two second-order
-- * lowpass or highpass butterworth filters.
-- */
--struct crossover {
--	struct lr4 lp[3], hp[3];
--};
--
--/* Initializes a crossover filter
-- * Args:
-- *    xo - The crossover filter we want to initialize.
-- *    freq1 - The normalized frequency splits low and mid band.
-- *    freq2 - The normalized frequency splits mid and high band.
-- */
--void crossover_init(struct crossover *xo, float freq1, float freq2);
--
--/* Splits input samples to three bands.
-- * Args:
-- *    xo - The crossover filter to use.
-- *    count - The number of input samples.
-- *    data0 - The input samples, also the place to store low band output.
-- *    data1 - The place to store mid band output.
-- *    data2 - The place to store high band output.
-- */
--void crossover_process(struct crossover *xo, int count, float *data0,
--		       float *data1, float *data2);
--
--#ifdef __cplusplus
--} /* extern "C" */
--#endif
--
- #endif /* CROSSOVER_H_ */
--- 
-1.9.1
-
diff --git a/debian/patches/0303-lfe-filter-change-the-crossover-frequency-as-a-param.patch b/debian/patches/0303-lfe-filter-change-the-crossover-frequency-as-a-param.patch
deleted file mode 100644
index 20c6213..0000000
--- a/debian/patches/0303-lfe-filter-change-the-crossover-frequency-as-a-param.patch
+++ /dev/null
@@ -1,274 +0,0 @@
-From c36e191ce5d38173424c3db9ba06638fd6b8408e Mon Sep 17 00:00:00 2001
-From: Hui Wang <hui.wang at canonical.com>
-Date: Tue, 24 Mar 2015 10:29:16 +0100
-Subject: [PATCH 303/311] lfe-filter: change the crossover frequency as a
- parameter
-
-Add a user defined parameter lfe-crossover-freq for the lfe-filter,
-to pass this parameter to the lfe-filter, we need to change the
-pa_resampler_new() API as well.
-
-Signed-off-by: Hui Wang <hui.wang at canonical.com>
----
- man/pulse-daemon.conf.5.xml.in             | 5 +++++
- src/daemon/daemon-conf.c                   | 3 +++
- src/daemon/daemon-conf.h                   | 1 +
- src/daemon/daemon.conf.in                  | 1 +
- src/daemon/main.c                          | 1 +
- src/modules/module-virtual-surround-sink.c | 2 +-
- src/pulsecore/core.c                       | 1 +
- src/pulsecore/core.h                       | 1 +
- src/pulsecore/resampler.c                  | 6 +++---
- src/pulsecore/resampler.h                  | 1 +
- src/pulsecore/sink-input.c                 | 2 ++
- src/pulsecore/source-output.c              | 2 ++
- src/tests/remix-test.c                     | 3 ++-
- src/tests/resampler-test.c                 | 7 ++++---
- 14 files changed, 28 insertions(+), 8 deletions(-)
-
-Index: pulseaudio/man/pulse-daemon.conf.5.xml.in
-===================================================================
---- pulseaudio.orig/man/pulse-daemon.conf.5.xml.in	2015-05-13 14:59:47.094147583 +0800
-+++ pulseaudio/man/pulse-daemon.conf.5.xml.in	2015-05-13 14:59:47.086147583 +0800
-@@ -121,6 +121,11 @@
-     </option>
- 
-     <option>
-+      <p><opt>lfe-crossover-freq=</opt> The crossover frequency (in Hz) for the
-+      LFE filter. Defaults to 120 Hz.</p>
-+    </option>
-+
-+    <option>
-       <p><opt>use-pid-file=</opt> Create a PID file in the runtime directory
-       (<file>$XDG_RUNTIME_DIR/pulse/pid</file>). If this is enabled you may
-       use commands like <opt>--kill</opt> or <opt>--check</opt>. If
-Index: pulseaudio/src/daemon/daemon-conf.c
-===================================================================
---- pulseaudio.orig/src/daemon/daemon-conf.c	2015-05-13 14:59:47.094147583 +0800
-+++ pulseaudio/src/daemon/daemon-conf.c	2015-05-13 14:59:47.086147583 +0800
-@@ -83,6 +83,7 @@
-     .resample_method = PA_RESAMPLER_AUTO,
-     .disable_remixing = false,
-     .disable_lfe_remixing = true,
-+    .lfe_crossover_freq = 120,
-     .config_file = NULL,
-     .use_pid_file = true,
-     .system_instance = false,
-@@ -553,6 +554,7 @@
-         { "enable-remixing",            pa_config_parse_not_bool, &c->disable_remixing, NULL },
-         { "disable-lfe-remixing",       pa_config_parse_bool,     &c->disable_lfe_remixing, NULL },
-         { "enable-lfe-remixing",        pa_config_parse_not_bool, &c->disable_lfe_remixing, NULL },
-+        { "lfe-crossover-freq",         pa_config_parse_unsigned, &c->lfe_crossover_freq, NULL },
-         { "load-default-script-file",   pa_config_parse_bool,     &c->load_default_script_file, NULL },
-         { "shm-size-bytes",             pa_config_parse_size,     &c->shm_size, NULL },
-         { "log-meta",                   pa_config_parse_bool,     &c->log_meta, NULL },
-@@ -745,6 +747,7 @@
-     pa_strbuf_printf(s, "resample-method = %s\n", pa_resample_method_to_string(c->resample_method));
-     pa_strbuf_printf(s, "enable-remixing = %s\n", pa_yes_no(!c->disable_remixing));
-     pa_strbuf_printf(s, "enable-lfe-remixing = %s\n", pa_yes_no(!c->disable_lfe_remixing));
-+    pa_strbuf_printf(s, "lfe-crossover-freq = %u\n", c->lfe_crossover_freq);
-     pa_strbuf_printf(s, "default-sample-format = %s\n", pa_sample_format_to_string(c->default_sample_spec.format));
-     pa_strbuf_printf(s, "default-sample-rate = %u\n", c->default_sample_spec.rate);
-     pa_strbuf_printf(s, "alternate-sample-rate = %u\n", c->alternate_sample_rate);
-Index: pulseaudio/src/daemon/daemon-conf.h
-===================================================================
---- pulseaudio.orig/src/daemon/daemon-conf.h	2015-05-13 14:59:47.094147583 +0800
-+++ pulseaudio/src/daemon/daemon-conf.h	2015-05-13 14:59:47.086147583 +0800
-@@ -127,6 +127,7 @@
-     unsigned default_n_fragments, default_fragment_size_msec;
-     unsigned deferred_volume_safety_margin_usec;
-     int deferred_volume_extra_delay_usec;
-+    unsigned lfe_crossover_freq;
-     pa_sample_spec default_sample_spec;
-     uint32_t alternate_sample_rate;
-     pa_channel_map default_channel_map;
-Index: pulseaudio/src/daemon/daemon.conf.in
-===================================================================
---- pulseaudio.orig/src/daemon/daemon.conf.in	2015-05-13 14:59:47.094147583 +0800
-+++ pulseaudio/src/daemon/daemon.conf.in	2015-05-13 14:59:47.086147583 +0800
-@@ -55,6 +55,7 @@
- ; resample-method = speex-float-1
- ; enable-remixing = yes
- ; enable-lfe-remixing = no
-+; lfe-crossover-freq = 120
- 
- flat-volumes = no
- 
-Index: pulseaudio/src/daemon/main.c
-===================================================================
---- pulseaudio.orig/src/daemon/main.c	2015-05-13 14:59:47.094147583 +0800
-+++ pulseaudio/src/daemon/main.c	2015-05-13 14:59:47.090147583 +0800
-@@ -1042,6 +1042,7 @@
-     c->default_fragment_size_msec = conf->default_fragment_size_msec;
-     c->deferred_volume_safety_margin_usec = conf->deferred_volume_safety_margin_usec;
-     c->deferred_volume_extra_delay_usec = conf->deferred_volume_extra_delay_usec;
-+    c->lfe_crossover_freq = conf->lfe_crossover_freq;
-     c->exit_idle_time = conf->exit_idle_time;
-     c->scache_idle_time = conf->scache_idle_time;
-     c->resample_method = conf->resample_method;
-Index: pulseaudio/src/modules/module-virtual-surround-sink.c
-===================================================================
---- pulseaudio.orig/src/modules/module-virtual-surround-sink.c	2015-05-13 14:59:47.094147583 +0800
-+++ pulseaudio/src/modules/module-virtual-surround-sink.c	2015-05-13 14:59:47.090147583 +0800
-@@ -743,7 +743,7 @@
-     pa_memblock_unref(silence.memblock);
- 
-     /* resample hrir */
--    resampler = pa_resampler_new(u->sink->core->mempool, &hrir_temp_ss, &hrir_map, &hrir_ss, &hrir_map,
-+    resampler = pa_resampler_new(u->sink->core->mempool, &hrir_temp_ss, &hrir_map, &hrir_ss, &hrir_map, u->sink->core->lfe_crossover_freq,
-                                  PA_RESAMPLER_SRC_SINC_BEST_QUALITY, PA_RESAMPLER_NO_REMAP);
- 
-     u->hrir_samples = hrir_temp_chunk.length / pa_frame_size(&hrir_temp_ss) * hrir_ss.rate / hrir_temp_ss.rate;
-Index: pulseaudio/src/pulsecore/core.c
-===================================================================
---- pulseaudio.orig/src/pulsecore/core.c	2015-05-13 14:59:47.094147583 +0800
-+++ pulseaudio/src/pulsecore/core.c	2015-05-13 14:59:47.090147583 +0800
-@@ -144,6 +144,7 @@
-     c->realtime_priority = 5;
-     c->disable_remixing = false;
-     c->disable_lfe_remixing = false;
-+    c->lfe_crossover_freq = 120;
-     c->deferred_volume = true;
-     c->resample_method = PA_RESAMPLER_SPEEX_FLOAT_BASE + 1;
- 
-Index: pulseaudio/src/pulsecore/core.h
-===================================================================
---- pulseaudio.orig/src/pulsecore/core.h	2015-05-13 14:59:47.094147583 +0800
-+++ pulseaudio/src/pulsecore/core.h	2015-05-13 14:59:47.090147583 +0800
-@@ -161,6 +161,7 @@
-     unsigned default_n_fragments, default_fragment_size_msec;
-     unsigned deferred_volume_safety_margin_usec;
-     int deferred_volume_extra_delay_usec;
-+    unsigned lfe_crossover_freq;
- 
-     pa_defer_event *module_defer_unload_event;
-     pa_hashmap *modules_pending_unload; /* pa_module -> pa_module (hashmap-as-a-set) */
-Index: pulseaudio/src/pulsecore/resampler.c
-===================================================================
---- pulseaudio.orig/src/pulsecore/resampler.c	2015-05-13 14:59:47.094147583 +0800
-+++ pulseaudio/src/pulsecore/resampler.c	2015-05-13 14:59:47.090147583 +0800
-@@ -298,6 +298,7 @@
-         const pa_channel_map *am,
-         const pa_sample_spec *b,
-         const pa_channel_map *bm,
-+	unsigned crossover_freq,
-         pa_resample_method_t method,
-         pa_resample_flags_t flags) {
- 
-@@ -396,9 +397,8 @@
-     if (lfe_filter_required) {
-         pa_sample_spec wss = r->o_ss;
-         wss.format = r->work_format;
--        /* TODO: Temporary code that sets crossover freq to 120 Hz. This should be a parameter */
--        r->lfe_filter = pa_lfe_filter_new(&wss, &r->o_cm, 120.0f);
--        pa_log_debug("  lfe filter activated (LR4 type)");
-+        r->lfe_filter = pa_lfe_filter_new(&wss, &r->o_cm, (float)crossover_freq);
-+        pa_log_debug("  lfe filter activated (LR4 type), the crossover_freq = %uHz", crossover_freq);
-     }
- 
-     /* initialize implementation */
-Index: pulseaudio/src/pulsecore/resampler.h
-===================================================================
---- pulseaudio.orig/src/pulsecore/resampler.h	2015-05-13 14:59:47.094147583 +0800
-+++ pulseaudio/src/pulsecore/resampler.h	2015-05-13 14:59:47.090147583 +0800
-@@ -115,6 +115,7 @@
-         const pa_channel_map *am,
-         const pa_sample_spec *b,
-         const pa_channel_map *bm,
-+	unsigned crossover_freq,
-         pa_resample_method_t resample_method,
-         pa_resample_flags_t flags);
- 
-Index: pulseaudio/src/pulsecore/sink-input.c
-===================================================================
---- pulseaudio.orig/src/pulsecore/sink-input.c	2015-05-13 14:59:47.094147583 +0800
-+++ pulseaudio/src/pulsecore/sink-input.c	2015-05-13 14:59:47.090147583 +0800
-@@ -451,6 +451,7 @@
-                           core->mempool,
-                           &data->sample_spec, &data->channel_map,
-                           &data->sink->sample_spec, &data->sink->channel_map,
-+                          core->lfe_crossover_freq,
-                           data->resample_method,
-                           ((data->flags & PA_SINK_INPUT_VARIABLE_RATE) ? PA_RESAMPLER_VARIABLE_RATE : 0) |
-                           ((data->flags & PA_SINK_INPUT_NO_REMAP) ? PA_RESAMPLER_NO_REMAP : 0) |
-@@ -2168,6 +2169,7 @@
-         new_resampler = pa_resampler_new(i->core->mempool,
-                                      &i->sample_spec, &i->channel_map,
-                                      &i->sink->sample_spec, &i->sink->channel_map,
-+                                     i->core->lfe_crossover_freq,
-                                      i->requested_resample_method,
-                                      ((i->flags & PA_SINK_INPUT_VARIABLE_RATE) ? PA_RESAMPLER_VARIABLE_RATE : 0) |
-                                      ((i->flags & PA_SINK_INPUT_NO_REMAP) ? PA_RESAMPLER_NO_REMAP : 0) |
-Index: pulseaudio/src/pulsecore/source-output.c
-===================================================================
---- pulseaudio.orig/src/pulsecore/source-output.c	2015-05-13 14:59:47.094147583 +0800
-+++ pulseaudio/src/pulsecore/source-output.c	2015-05-13 14:59:47.090147583 +0800
-@@ -396,6 +396,7 @@
-                         core->mempool,
-                         &data->source->sample_spec, &data->source->channel_map,
-                         &data->sample_spec, &data->channel_map,
-+                        core->lfe_crossover_freq,
-                         data->resample_method,
-                         ((data->flags & PA_SOURCE_OUTPUT_VARIABLE_RATE) ? PA_RESAMPLER_VARIABLE_RATE : 0) |
-                         ((data->flags & PA_SOURCE_OUTPUT_NO_REMAP) ? PA_RESAMPLER_NO_REMAP : 0) |
-@@ -1625,6 +1626,7 @@
-         new_resampler = pa_resampler_new(o->core->mempool,
-                                      &o->source->sample_spec, &o->source->channel_map,
-                                      &o->sample_spec, &o->channel_map,
-+                                     o->core->lfe_crossover_freq,
-                                      o->requested_resample_method,
-                                      ((o->flags & PA_SOURCE_OUTPUT_VARIABLE_RATE) ? PA_RESAMPLER_VARIABLE_RATE : 0) |
-                                      ((o->flags & PA_SOURCE_OUTPUT_NO_REMAP) ? PA_RESAMPLER_NO_REMAP : 0) |
-Index: pulseaudio/src/tests/remix-test.c
-===================================================================
---- pulseaudio.orig/src/tests/remix-test.c	2015-05-13 14:59:47.094147583 +0800
-+++ pulseaudio/src/tests/remix-test.c	2015-05-13 14:59:47.090147583 +0800
-@@ -47,6 +47,7 @@
- 
-     unsigned i, j;
-     pa_mempool *pool;
-+    unsigned crossover_freq = 120;
- 
-     pa_log_set_level(PA_LOG_DEBUG);
- 
-@@ -66,7 +67,7 @@
-             ss1.rate = ss2.rate = 44100;
-             ss1.format = ss2.format = PA_SAMPLE_S16NE;
- 
--            r = pa_resampler_new(pool, &ss1, &maps[i], &ss2, &maps[j], PA_RESAMPLER_AUTO, 0);
-+            r = pa_resampler_new(pool, &ss1, &maps[i], &ss2, &maps[j], crossover_freq, PA_RESAMPLER_AUTO, 0);
- 
-             /* We don't really care for the resampler. We just want to
-              * see the remixing debug output. */
-Index: pulseaudio/src/tests/resampler-test.c
-===================================================================
---- pulseaudio.orig/src/tests/resampler-test.c	2015-05-13 14:59:47.094147583 +0800
-+++ pulseaudio/src/tests/resampler-test.c	2015-05-13 14:59:47.090147583 +0800
-@@ -303,6 +303,7 @@
-     bool all_formats = true;
-     pa_resample_method_t method;
-     int seconds;
-+    unsigned crossover_freq = 120;
- 
-     static const struct option long_options[] = {
-         {"help",                  0, NULL, 'h'},
-@@ -419,7 +420,7 @@
-                    b.rate, b.channels, pa_sample_format_to_string(b.format));
- 
-         ts = pa_rtclock_now();
--        pa_assert_se(resampler = pa_resampler_new(pool, &a, NULL, &b, NULL, method, 0));
-+        pa_assert_se(resampler = pa_resampler_new(pool, &a, NULL, &b, NULL, crossover_freq, method, 0));
-         pa_log_info("init: %llu", (long long unsigned)(pa_rtclock_now() - ts));
- 
-         i.memblock = pa_memblock_new(pool, pa_usec_to_bytes(1*PA_USEC_PER_SEC, &a));
-@@ -450,8 +451,8 @@
-                        pa_sample_format_to_string(b.format),
-                        pa_sample_format_to_string(a.format));
- 
--            pa_assert_se(forth = pa_resampler_new(pool, &a, NULL, &b, NULL, method, 0));
--            pa_assert_se(back = pa_resampler_new(pool, &b, NULL, &a, NULL, method, 0));
-+            pa_assert_se(forth = pa_resampler_new(pool, &a, NULL, &b, NULL, crossover_freq, method, 0));
-+            pa_assert_se(back = pa_resampler_new(pool, &b, NULL, &a, NULL, crossover_freq, method, 0));
- 
-             i.memblock = generate_block(pool, &a);
-             i.length = pa_memblock_get_length(i.memblock);
diff --git a/debian/patches/0304-memblock-Change-pa_memblock_new_malloced-to-an-inlin.patch b/debian/patches/0304-memblock-Change-pa_memblock_new_malloced-to-an-inlin.patch
deleted file mode 100644
index 680f59d..0000000
--- a/debian/patches/0304-memblock-Change-pa_memblock_new_malloced-to-an-inlin.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From d0e8b0fe077b2d59e111c57ed5ed75b7a7d3e92d Mon Sep 17 00:00:00 2001
-From: David Henningsson <david.henningsson at canonical.com>
-Date: Wed, 25 Mar 2015 10:13:13 +0100
-Subject: [PATCH 304/311] memblock: Change pa_memblock_new_malloced to an
- inline function
-
-To avoid the macro trap: I call pa_memblock_new_malloced with
-"pa_xmemdup" as data parameter, and that would expand to *two*
-calls to pa_xmemdup in case that remains a macro, which is clearly
-not intended.
-
-Signed-off-by: David Henningsson <david.henningsson at canonical.com>
----
- src/pulsecore/memblock.h | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/src/pulsecore/memblock.h b/src/pulsecore/memblock.h
-index dbea213..4faef75 100644
---- a/src/pulsecore/memblock.h
-+++ b/src/pulsecore/memblock.h
-@@ -27,6 +27,7 @@ typedef struct pa_memblock pa_memblock;
- #include <inttypes.h>
- 
- #include <pulse/def.h>
-+#include <pulse/xmalloc.h>
- #include <pulsecore/atomic.h>
- #include <pulsecore/memchunk.h>
- 
-@@ -86,7 +87,9 @@ pa_memblock *pa_memblock_new_pool(pa_mempool *, size_t length);
- pa_memblock *pa_memblock_new_user(pa_mempool *, void *data, size_t length, pa_free_cb_t free_cb, void *free_cb_data, bool read_only);
- 
- /* A special case of pa_memblock_new_user: take a memory buffer previously allocated with pa_xmalloc()  */
--#define pa_memblock_new_malloced(p,data,length) pa_memblock_new_user(p, data, length, pa_xfree, data, 0)
-+static inline pa_memblock *pa_memblock_new_malloced(pa_mempool *p, void *data, size_t length) {
-+    return pa_memblock_new_user(p, data, length, pa_xfree, data, 0);
-+}
- 
- /* Allocate a new memory block of type PA_MEMBLOCK_FIXED */
- pa_memblock *pa_memblock_new_fixed(pa_mempool *, void *data, size_t length, bool read_only);
--- 
-1.9.1
-
diff --git a/debian/patches/0305-lfe-filter-Add-rewind-support.patch b/debian/patches/0305-lfe-filter-Add-rewind-support.patch
deleted file mode 100644
index 15ad0f3..0000000
--- a/debian/patches/0305-lfe-filter-Add-rewind-support.patch
+++ /dev/null
@@ -1,231 +0,0 @@
-From defc2b702bd7358634e70635a7614172836d632e Mon Sep 17 00:00:00 2001
-From: David Henningsson <david.henningsson at canonical.com>
-Date: Tue, 24 Mar 2015 10:29:17 +0100
-Subject: [PATCH 305/311] lfe-filter: Add rewind support
-
-Store current filter state at every normal block process.
-When a rewind happens, rewind back to the nearest saved state,
-then calculate forward to the actual sample position.
-
-Signed-off-by: David Henningsson <david.henningsson at canonical.com>
----
- src/pulsecore/filter/lfe-filter.c | 109 +++++++++++++++++++++++++++++++++++---
- src/pulsecore/filter/lfe-filter.h |   5 +-
- src/pulsecore/resampler.c         |   3 +-
- 3 files changed, 108 insertions(+), 9 deletions(-)
-
-Index: pulseaudio/src/pulsecore/filter/lfe-filter.c
-===================================================================
---- pulseaudio.orig/src/pulsecore/filter/lfe-filter.c	2015-05-13 14:59:58.310147765 +0800
-+++ pulseaudio/src/pulsecore/filter/lfe-filter.c	2015-05-13 14:59:58.306147765 +0800
-@@ -23,9 +23,20 @@
- 
- #include "lfe-filter.h"
- #include <pulse/xmalloc.h>
-+#include <pulsecore/flist.h>
-+#include <pulsecore/llist.h>
- #include <pulsecore/filter/biquad.h>
- #include <pulsecore/filter/crossover.h>
- 
-+struct saved_state {
-+    PA_LLIST_FIELDS(struct saved_state);
-+    pa_memchunk chunk;
-+    int64_t index;
-+    struct lr4 lr4[PA_CHANNELS_MAX];
-+};
-+
-+PA_STATIC_FLIST_DECLARE(lfe_state, 0, pa_xfree);
-+
- /* An LR4 filter, implemented as a chain of two Butterworth filters.
- 
-    Currently the channel map is fixed so that a highpass filter is applied to all
-@@ -35,24 +46,37 @@
- */
- 
- struct pa_lfe_filter {
-+    int64_t index;
-+    PA_LLIST_HEAD(struct saved_state, saved);
-     float crossover;
-     pa_channel_map cm;
-     pa_sample_spec ss;
-+    size_t maxrewind;
-     bool active;
-     struct lr4 lr4[PA_CHANNELS_MAX];
- };
- 
--pa_lfe_filter_t * pa_lfe_filter_new(const pa_sample_spec* ss, const pa_channel_map* cm, float crossover_freq) {
-+static void remove_state(pa_lfe_filter_t *f, struct saved_state *s) {
-+    PA_LLIST_REMOVE(struct saved_state, f->saved, s);
-+    pa_memblock_unref(s->chunk.memblock);
-+    pa_xfree(s);
-+}
-+
-+pa_lfe_filter_t * pa_lfe_filter_new(const pa_sample_spec* ss, const pa_channel_map* cm, float crossover_freq, size_t maxrewind) {
- 
-     pa_lfe_filter_t *f = pa_xnew0(struct pa_lfe_filter, 1);
-     f->crossover = crossover_freq;
-     f->cm = *cm;
-     f->ss = *ss;
-+    f->maxrewind = maxrewind;
-     pa_lfe_filter_update_rate(f, ss->rate);
-     return f;
- }
- 
- void pa_lfe_filter_free(pa_lfe_filter_t *f) {
-+    while (f->saved)
-+        remove_state(f, f->saved);
-+
-     pa_xfree(f);
- }
- 
-@@ -60,26 +84,61 @@
-     pa_lfe_filter_update_rate(f, f->ss.rate);
- }
- 
--pa_memchunk * pa_lfe_filter_process(pa_lfe_filter_t *f, pa_memchunk *buf) {
-+static void process_block(pa_lfe_filter_t *f, pa_memchunk *buf, bool store_result) {
-     int samples = buf->length / pa_frame_size(&f->ss);
- 
--    if (!f->active)
--        return buf;
-+    void *garbage = store_result ? NULL : pa_xmalloc(buf->length);
-+
-     if (f->ss.format == PA_SAMPLE_FLOAT32NE) {
-         int i;
-         float *data = pa_memblock_acquire_chunk(buf);
-         for (i = 0; i < f->cm.channels; i++)
--            lr4_process_float32(&f->lr4[i], samples, f->cm.channels, &data[i], &data[i]);
-+            lr4_process_float32(&f->lr4[i], samples, f->cm.channels, &data[i], garbage ? garbage : &data[i]);
-         pa_memblock_release(buf->memblock);
-     }
-     else if (f->ss.format == PA_SAMPLE_S16NE) {
-         int i;
-         short *data = pa_memblock_acquire_chunk(buf);
-         for (i = 0; i < f->cm.channels; i++)
--            lr4_process_s16(&f->lr4[i], samples, f->cm.channels, &data[i], &data[i]);
-+            lr4_process_s16(&f->lr4[i], samples, f->cm.channels, &data[i], garbage ? garbage : &data[i]);
-         pa_memblock_release(buf->memblock);
-     }
-     else pa_assert_not_reached();
-+
-+    pa_xfree(garbage);
-+    f->index += samples;
-+}
-+
-+pa_memchunk * pa_lfe_filter_process(pa_lfe_filter_t *f, pa_memchunk *buf) {
-+    struct saved_state *s, *s2;
-+    void *data;
-+
-+    if (!f->active)
-+        return buf;
-+
-+    /* Remove old states (FIXME: we could do better than searching the entire array here?) */
-+    PA_LLIST_FOREACH_SAFE(s, s2, f->saved)
-+        if (s->index + (int64_t) (s->chunk.length / pa_frame_size(&f->ss) + f->maxrewind) < f->index)
-+            remove_state(f, s);
-+
-+    /* Insert our existing state into the flist */
-+    if ((s = pa_flist_pop(PA_STATIC_FLIST_GET(lfe_state))) == NULL)
-+        s = pa_xnew(struct saved_state, 1);
-+    PA_LLIST_INIT(struct saved_state, s);
-+
-+    /* TODO: This actually memcpys the entire chunk into a new allocation, because we need to retain the original
-+       in case of rewinding. Investigate whether this can be avoided. */
-+    data = pa_memblock_acquire_chunk(buf);
-+    s->chunk.memblock = pa_memblock_new_malloced(pa_memblock_get_pool(buf->memblock), pa_xmemdup(data, buf->length), buf->length);
-+    s->chunk.length = buf->length;
-+    s->chunk.index = 0;
-+    pa_memblock_release(buf->memblock);
-+
-+    s->index = f->index;
-+    memcpy(s->lr4, f->lr4, sizeof(struct lr4) * f->cm.channels);
-+    PA_LLIST_PREPEND(struct saved_state, f->saved, s);
-+
-+    process_block(f, buf, true);
-     return buf;
- }
- 
-@@ -87,6 +146,10 @@
-     int i;
-     float biquad_freq = f->crossover / (new_rate / 2);
- 
-+    while (f->saved)
-+        remove_state(f, f->saved);
-+
-+    f->index = 0;
-     f->ss.rate = new_rate;
-     if (biquad_freq <= 0 || biquad_freq >= 1) {
-         pa_log_warn("Crossover frequency (%f) outside range for sample rate %d", f->crossover, new_rate);
-@@ -99,3 +162,37 @@
- 
-     f->active = true;
- }
-+
-+void pa_lfe_filter_rewind(pa_lfe_filter_t *f, size_t amount) {
-+    struct saved_state *i, *s = NULL;
-+    size_t samples = amount / pa_frame_size(&f->ss);
-+    f->index -= samples;
-+
-+    /* Find the closest saved position */
-+    PA_LLIST_FOREACH(i, f->saved) {
-+        if (i->index > f->index)
-+            continue;
-+        if (s == NULL || i->index > s->index)
-+            s = i;
-+    }
-+    if (s == NULL) {
-+        pa_log_debug("Rewinding LFE filter %lu samples to position %lli. No saved state found", samples, (long long) f->index);
-+        pa_lfe_filter_update_rate(f, f->ss.rate);
-+        return;
-+    }
-+    pa_log_debug("Rewinding LFE filter %lu samples to position %lli. Found saved state at position %lli",
-+        samples, (long long) f->index, (long long) s->index);
-+    memcpy(f->lr4, s->lr4, sizeof(struct lr4) * f->cm.channels);
-+
-+    /* now fast forward to the actual position */
-+    if (f->index > s->index) {
-+        pa_memchunk x = s->chunk;
-+        x.length = (f->index - s->index) * pa_frame_size(&f->ss);
-+        if (x.length > s->chunk.length) {
-+            pa_log_error("Hole in stream, cannot fast forward LFE filter");
-+            return;
-+        }
-+        f->index = s->index;
-+        process_block(f, &x, false);
-+    }
-+}
-Index: pulseaudio/src/pulsecore/filter/lfe-filter.h
-===================================================================
---- pulseaudio.orig/src/pulsecore/filter/lfe-filter.h	2015-05-13 14:59:58.310147765 +0800
-+++ pulseaudio/src/pulsecore/filter/lfe-filter.h	2015-05-13 14:59:58.306147765 +0800
-@@ -25,13 +25,14 @@
- #include <pulse/sample.h>
- #include <pulse/channelmap.h>
- #include <pulsecore/memchunk.h>
--
-+#include <pulsecore/memblockq.h>
- 
- typedef struct pa_lfe_filter pa_lfe_filter_t;
- 
--pa_lfe_filter_t * pa_lfe_filter_new(const pa_sample_spec* ss, const pa_channel_map* cm, float crossover_freq);
-+pa_lfe_filter_t * pa_lfe_filter_new(const pa_sample_spec* ss, const pa_channel_map* cm, float crossover_freq, size_t maxrewind);
- void pa_lfe_filter_free(pa_lfe_filter_t *);
- void pa_lfe_filter_reset(pa_lfe_filter_t *);
-+void pa_lfe_filter_rewind(pa_lfe_filter_t *, size_t amount);
- pa_memchunk * pa_lfe_filter_process(pa_lfe_filter_t *filter, pa_memchunk *buf);
- void pa_lfe_filter_update_rate(pa_lfe_filter_t *, uint32_t new_rate);
- 
-Index: pulseaudio/src/pulsecore/resampler.c
-===================================================================
---- pulseaudio.orig/src/pulsecore/resampler.c	2015-05-13 14:59:58.310147765 +0800
-+++ pulseaudio/src/pulsecore/resampler.c	2015-05-13 14:59:58.306147765 +0800
-@@ -397,7 +397,8 @@
-     if (lfe_filter_required) {
-         pa_sample_spec wss = r->o_ss;
-         wss.format = r->work_format;
--        r->lfe_filter = pa_lfe_filter_new(&wss, &r->o_cm, (float)crossover_freq);
-+        /* FIXME: For now just hardcode maxrewind to 3 seconds */
-+        r->lfe_filter = pa_lfe_filter_new(&wss, &r->o_cm, (float)crossover_freq, b->rate * 3);
-         pa_log_debug("  lfe filter activated (LR4 type), the crossover_freq = %uHz", crossover_freq);
-     }
- 
diff --git a/debian/patches/0306-resampler-Make-some-basic-functions-for-rewinding.patch b/debian/patches/0306-resampler-Make-some-basic-functions-for-rewinding.patch
deleted file mode 100644
index 0f5e6d5..0000000
--- a/debian/patches/0306-resampler-Make-some-basic-functions-for-rewinding.patch
+++ /dev/null
@@ -1,96 +0,0 @@
-From 7fb531d9369bb8a8edcdf84633e5e455b0fa7e40 Mon Sep 17 00:00:00 2001
-From: David Henningsson <david.henningsson at canonical.com>
-Date: Tue, 24 Mar 2015 10:29:18 +0100
-Subject: [PATCH 306/311] resampler: Make some basic functions for rewinding
-
-The resampler framework just forwards the request to the lfe filter.
-There are no resampler impl that can rewind yet, so just reset the
-resampler impl instead of properly rewinding yet.
-
-Signed-off-by: David Henningsson <david.henningsson at canonical.com>
----
- src/pulsecore/resampler.c     | 18 ++++++++++++++++--
- src/pulsecore/resampler.h     |  3 +++
- src/pulsecore/sink-input.c    |  4 ++--
- src/pulsecore/source-output.c |  2 +-
- 4 files changed, 22 insertions(+), 5 deletions(-)
-
-Index: pulseaudio/src/pulsecore/resampler.c
-===================================================================
---- pulseaudio.orig/src/pulsecore/resampler.c	2015-05-13 15:00:12.066147988 +0800
-+++ pulseaudio/src/pulsecore/resampler.c	2015-05-13 15:00:12.062147988 +0800
-@@ -556,6 +556,20 @@
-     *r->have_leftover = false;
- }
- 
-+void pa_resampler_rewind(pa_resampler *r, size_t out_frames) {
-+    pa_assert(r);
-+
-+    /* For now, we don't have any rewindable resamplers, so we just
-+       reset the resampler instead (and hope that nobody hears the difference). */
-+    if (r->impl.reset)
-+        r->impl.reset(r);
-+
-+    if (r->lfe_filter)
-+        pa_lfe_filter_rewind(r->lfe_filter, out_frames);
-+
-+    *r->have_leftover = false;
-+}
-+
- pa_resample_method_t pa_resampler_get_method(pa_resampler *r) {
-     pa_assert(r);
- 
-@@ -793,8 +807,8 @@
-     } else {
- 
-         /* OK, we shall do the full monty: upmixing and downmixing. Our
--         * algorithm is relatively simple, does not do spacialization, delay
--         * elements or apply lowpass filters for LFE. Patches are always
-+         * algorithm is relatively simple, does not do spacialization, or delay
-+         * elements. LFE filters are done after the remap step. Patches are always
-          * welcome, though. Oh, and it doesn't do any matrix decoding. (Which
-          * probably wouldn't make any sense anyway.)
-          *
-Index: pulseaudio/src/pulsecore/resampler.h
-===================================================================
---- pulseaudio.orig/src/pulsecore/resampler.h	2015-05-13 15:00:12.066147988 +0800
-+++ pulseaudio/src/pulsecore/resampler.h	2015-05-13 15:00:12.062147988 +0800
-@@ -142,6 +142,9 @@
- /* Reinitialize state of the resampler, possibly due to seeking or other discontinuities */
- void pa_resampler_reset(pa_resampler *r);
- 
-+/* Rewind resampler */
-+void pa_resampler_rewind(pa_resampler *r, size_t out_frames);
-+
- /* Return the resampling method of the resampler object */
- pa_resample_method_t pa_resampler_get_method(pa_resampler *r);
- 
-Index: pulseaudio/src/pulsecore/sink-input.c
-===================================================================
---- pulseaudio.orig/src/pulsecore/sink-input.c	2015-05-13 15:00:12.066147988 +0800
-+++ pulseaudio/src/pulsecore/sink-input.c	2015-05-13 15:00:12.062147988 +0800
-@@ -1106,9 +1106,9 @@
-             if (i->thread_info.rewrite_flush)
-                 pa_memblockq_silence(i->thread_info.render_memblockq);
- 
--            /* And reset the resampler */
-+            /* And rewind the resampler */
-             if (i->thread_info.resampler)
--                pa_resampler_reset(i->thread_info.resampler);
-+                pa_resampler_rewind(i->thread_info.resampler, amount);
-         }
-     }
- 
-Index: pulseaudio/src/pulsecore/source-output.c
-===================================================================
---- pulseaudio.orig/src/pulsecore/source-output.c	2015-05-13 15:00:12.066147988 +0800
-+++ pulseaudio/src/pulsecore/source-output.c	2015-05-13 15:00:12.062147988 +0800
-@@ -851,7 +851,7 @@
-             o->process_rewind(o, nbytes);
- 
-         if (o->thread_info.resampler)
--            pa_resampler_reset(o->thread_info.resampler);
-+            pa_resampler_rewind(o->thread_info.resampler, nbytes);
- 
-     } else
-         pa_memblockq_rewind(o->thread_info.delay_memblockq, nbytes);
diff --git a/debian/patches/0307-tests-adding-lfe-filter-test.patch b/debian/patches/0307-tests-adding-lfe-filter-test.patch
deleted file mode 100644
index dfb0d49..0000000
--- a/debian/patches/0307-tests-adding-lfe-filter-test.patch
+++ /dev/null
@@ -1,248 +0,0 @@
-From 98e01c8a9c0e62c9b0a733fc84409d1299392d5b Mon Sep 17 00:00:00 2001
-From: Hui Wang <hui.wang at canonical.com>
-Date: Tue, 24 Mar 2015 10:29:19 +0100
-Subject: [PATCH 307/311] tests: adding lfe-filter-test
-
-so far, this test only includes rewind test, it works as below:
-let lfe-filter process 2 blocks mono lfe channel audio samples, the
-sample format is PA_SAMPLE_S16LE, save the processed data to the temp
-buffer, then rewind the lfe-filter back 1 block and 1.5 blocks
-respectively, reprocess the audio samples from the rewind position,
-then comparing the output data with previously saved data.
-
-Signed-off-by: Hui Wang <hui.wang at canonical.com>
----
- src/Makefile.am             |   8 +-
- src/tests/lfe-filter-test.c | 194 ++++++++++++++++++++++++++++++++++++++++++++
- 2 files changed, 201 insertions(+), 1 deletion(-)
- create mode 100644 src/tests/lfe-filter-test.c
-
-diff --git a/src/Makefile.am b/src/Makefile.am
-index 302c532..d582e57 100644
---- a/src/Makefile.am
-+++ b/src/Makefile.am
-@@ -262,7 +262,8 @@ TESTS_default = \
- 		cpu-sconv-test \
- 		cpu-volume-test \
- 		lock-autospawn-test \
--		mult-s16-test
-+		mult-s16-test \
-+		lfe-filter-test
- 
- TESTS_norun = \
- 		ipacl-test \
-@@ -554,6 +555,11 @@ mult_s16_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la li
- mult_s16_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
- mult_s16_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
- 
-+lfe_filter_test_SOURCES = tests/lfe-filter-test.c
-+lfe_filter_test_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
-+lfe_filter_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
-+lfe_filter_test_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS) $(LIBCHECK_LIBS)
-+
- rtstutter_SOURCES = tests/rtstutter.c
- rtstutter_LDADD = $(AM_LDADD) libpulsecore- at PA_MAJORMINOR@.la libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
- rtstutter_CFLAGS = $(AM_CFLAGS)
-diff --git a/src/tests/lfe-filter-test.c b/src/tests/lfe-filter-test.c
-new file mode 100644
-index 0000000..2c6d597
---- /dev/null
-+++ b/src/tests/lfe-filter-test.c
-@@ -0,0 +1,194 @@
-+/***
-+  This file is part of PulseAudio.
-+
-+  PulseAudio is free software; you can redistribute it and/or modify
-+  it under the terms of the GNU Lesser General Public License as published
-+  by the Free Software Foundation; either version 2.1 of the License,
-+  or (at your option) any later version.
-+
-+  PulseAudio is distributed in the hope that it will be useful, but
-+  WITHOUT ANY WARRANTY; without even the implied warranty of
-+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+  General Public License for more details.
-+
-+  You should have received a copy of the GNU Lesser General Public License
-+  along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
-+***/
-+
-+#ifdef HAVE_CONFIG_H
-+#include <config.h>
-+#endif
-+
-+#include <check.h>
-+
-+#include <pulse/pulseaudio.h>
-+#include <pulse/sample.h>
-+#include <pulsecore/memblock.h>
-+
-+#include <pulsecore/filter/lfe-filter.h>
-+
-+struct lfe_filter_test {
-+    pa_lfe_filter_t *lf;
-+    pa_mempool *pool;
-+    pa_sample_spec *ss;
-+};
-+
-+static uint8_t *ori_sample_ptr;
-+
-+#define ONE_BLOCK_SAMPLES 4096
-+#define TOTAL_SAMPLES 8192
-+
-+static void save_data_block(struct lfe_filter_test *lft, void *d, pa_memblock *blk) {
-+    uint8_t *dst = d, *src;
-+    size_t blk_size = pa_frame_size(lft->ss) * ONE_BLOCK_SAMPLES;
-+
-+    src = pa_memblock_acquire(blk);
-+    memcpy(dst, src, blk_size);
-+    pa_memblock_release(blk);
-+}
-+
-+static pa_memblock* generate_data_block(struct lfe_filter_test *lft, int start) {
-+    pa_memblock *r;
-+    uint8_t *d, *s = ori_sample_ptr;
-+    size_t blk_size = pa_frame_size(lft->ss) * ONE_BLOCK_SAMPLES;
-+
-+    pa_assert_se(r = pa_memblock_new(lft->pool, blk_size));
-+    d = pa_memblock_acquire(r);
-+    memcpy(d, s + start,  blk_size);
-+    pa_memblock_release(r);
-+
-+    return r;
-+}
-+
-+static int compare_data_block(struct lfe_filter_test *lft, void *a, void *b) {
-+    int ret = 0;
-+    uint32_t i;
-+    uint32_t fz = pa_frame_size(lft->ss);
-+    uint8_t *r = a, *u = b;
-+
-+    for (i = 0; i < ONE_BLOCK_SAMPLES * fz; i++) {
-+        if (*r++ != *u++) {
-+            pa_log_error("lfe-filter-test: test failed, the output data in the position 0x%x of a block does not equal!\n", i);
-+            ret = -1;
-+            break;
-+        }
-+    }
-+    return ret;
-+}
-+
-+/* in this test case, we pass two blocks of sample data to lfe-filter, each
-+   block contains 4096 samples, and don't let rewind_samples exceed TOTAL_SAMPLES */
-+static int lfe_filter_rewind_test(struct lfe_filter_test *lft, int rewind_samples)
-+{
-+    int ret = -1, pos, i;
-+    pa_memchunk mc;
-+    uint8_t *outptr;
-+    uint32_t fz = pa_frame_size(lft->ss);
-+
-+    if (rewind_samples > TOTAL_SAMPLES || rewind_samples < TOTAL_SAMPLES - ONE_BLOCK_SAMPLES) {
-+        pa_log_error("lfe-filter-test: Please keep %d samples < rewind_samples < %d samples\n", TOTAL_SAMPLES - ONE_BLOCK_SAMPLES, TOTAL_SAMPLES);
-+        return ret;
-+    }
-+
-+    outptr = pa_xmalloc(fz * TOTAL_SAMPLES);
-+
-+    /* let lfe-filter process all samples first, and save the processed data to the temp buffer,
-+       then rewind back to some position, reprocess some samples and compare the output data with
-+       the processed data saved before. */
-+    for (i = 0; i < TOTAL_SAMPLES / ONE_BLOCK_SAMPLES; i++) {
-+        mc.memblock = generate_data_block(lft, i * ONE_BLOCK_SAMPLES * fz);
-+        mc.length = pa_memblock_get_length(mc.memblock);
-+        mc.index = 0;
-+        pa_lfe_filter_process(lft->lf, &mc);
-+        save_data_block(lft, outptr + i * ONE_BLOCK_SAMPLES * fz, mc.memblock);
-+        pa_memblock_unref(mc.memblock);
-+    }
-+
-+    pa_lfe_filter_rewind(lft->lf, rewind_samples * fz);
-+    pos = (TOTAL_SAMPLES - rewind_samples) * fz;
-+    mc.memblock = generate_data_block(lft, pos);
-+    mc.length = pa_memblock_get_length(mc.memblock);
-+    mc.index = 0;
-+    pa_lfe_filter_process(lft->lf, &mc);
-+    ret = compare_data_block(lft, outptr + pos, pa_memblock_acquire(mc.memblock));
-+    pa_memblock_release(mc.memblock);
-+    pa_memblock_unref(mc.memblock);
-+
-+    pa_xfree(outptr);
-+
-+    return ret;
-+}
-+
-+START_TEST (lfe_filter_test) {
-+    pa_sample_spec a;
-+    int ret = -1;
-+    unsigned i, crossover_freq = 120;
-+    pa_channel_map chmapmono = {1, {PA_CHANNEL_POSITION_LFE}};
-+    struct lfe_filter_test lft;
-+    short *tmp_ptr;
-+
-+    pa_log_set_level(PA_LOG_DEBUG);
-+
-+    a.channels = 1;
-+    a.rate = 44100;
-+    a.format = PA_SAMPLE_S16LE;
-+
-+    lft.ss = &a;
-+    pa_assert_se(lft.pool = pa_mempool_new(false, 0));
-+
-+    /* We prepare pseudo-random input audio samples for lfe-filter rewind testing*/
-+    ori_sample_ptr = pa_xmalloc(pa_frame_size(lft.ss) * TOTAL_SAMPLES);
-+    tmp_ptr = (short *) ori_sample_ptr;
-+    for (i = 0; i < pa_frame_size(lft.ss) * TOTAL_SAMPLES / sizeof(short); i++)
-+        *tmp_ptr++ = random();
-+
-+    /* we create a lfe-filter with cutoff frequency 120Hz and max rewind time 10 seconds */
-+    pa_assert_se(lft.lf = pa_lfe_filter_new(&a, &chmapmono, crossover_freq, a.rate * 10));
-+    /* rewind to a block boundary */
-+    ret = lfe_filter_rewind_test(&lft, ONE_BLOCK_SAMPLES);
-+    if (ret)
-+        pa_log_error("lfe-filer-test: rewind to block boundary test failed!!!");
-+    pa_lfe_filter_free(lft.lf);
-+
-+    /* we create a lfe-filter with cutoff frequency 120Hz and max rewind time 10 seconds */
-+    pa_assert_se(lft.lf = pa_lfe_filter_new(&a, &chmapmono, crossover_freq, a.rate * 10));
-+    /* rewind to the middle position of a block */
-+    ret = lfe_filter_rewind_test(&lft, ONE_BLOCK_SAMPLES + ONE_BLOCK_SAMPLES / 2);
-+    if (ret)
-+        pa_log_error("lfe-filer-test: rewind to middle of block test failed!!!");
-+
-+    pa_xfree(ori_sample_ptr);
-+
-+    pa_lfe_filter_free(lft.lf);
-+
-+    pa_mempool_free(lft.pool);
-+
-+    if (!ret)
-+        pa_log_debug("lfe-filter-test: tests for both rewind to block boundary and rewind to middle position of a block passed!");
-+
-+    fail_unless(ret == 0);
-+}
-+END_TEST
-+
-+int main(int argc, char *argv[]) {
-+    int failed = 0;
-+    Suite *s;
-+    TCase *tc;
-+    SRunner *sr;
-+
-+    if (!getenv("MAKE_CHECK"))
-+        pa_log_set_level(PA_LOG_DEBUG);
-+
-+    s = suite_create("lfe-filter");
-+    tc = tcase_create("lfe-filter");
-+    tcase_add_test(tc, lfe_filter_test);
-+    tcase_set_timeout(tc, 10);
-+    suite_add_tcase(s, tc);
-+
-+    sr = srunner_create(s);
-+    srunner_run_all(sr, CK_NORMAL);
-+    failed = srunner_ntests_failed(sr);
-+    srunner_free(sr);
-+
-+    return (failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-+}
--- 
-1.9.1
-
diff --git a/debian/patches/0308-daemon-conf-enable-the-lfe-remixing-by-default.patch b/debian/patches/0308-daemon-conf-enable-the-lfe-remixing-by-default.patch
deleted file mode 100644
index 5eaf280..0000000
--- a/debian/patches/0308-daemon-conf-enable-the-lfe-remixing-by-default.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-From a9059be749b6043d6cbc5b79652e8a4adda8994e Mon Sep 17 00:00:00 2001
-From: Hui Wang <hui.wang at canonical.com>
-Date: Tue, 24 Mar 2015 10:29:15 +0100
-Subject: [PATCH 308/311] daemon-conf: enable the lfe remixing by default
-
-Since we have a workable lfe filter, it is time to enable the lfe
-remixing by default.
-
-Signed-off-by: Hui Wang <hui.wang at canonical.com>
----
- man/pulse-daemon.conf.5.xml.in | 2 +-
- src/daemon/daemon-conf.c       | 2 +-
- src/daemon/daemon.conf.in      | 2 +-
- 3 files changed, 3 insertions(+), 3 deletions(-)
-
-Index: pulseaudio/man/pulse-daemon.conf.5.xml.in
-===================================================================
---- pulseaudio.orig/man/pulse-daemon.conf.5.xml.in	2015-05-13 15:00:23.030148165 +0800
-+++ pulseaudio/man/pulse-daemon.conf.5.xml.in	2015-05-13 15:00:23.026148165 +0800
-@@ -117,7 +117,7 @@
-       channel is available as well. If no input LFE channel is
-       available the output LFE channel will always be 0. If no output
-       LFE channel is available the signal on the input LFE channel
--      will be ignored. Defaults to <opt>no</opt>.</p>
-+      will be ignored. Defaults to <opt>yes</opt>.</p>
-     </option>
- 
-     <option>
-Index: pulseaudio/src/daemon/daemon-conf.c
-===================================================================
---- pulseaudio.orig/src/daemon/daemon-conf.c	2015-05-13 15:00:23.030148165 +0800
-+++ pulseaudio/src/daemon/daemon-conf.c	2015-05-13 15:00:23.026148165 +0800
-@@ -82,7 +82,7 @@
-     .log_time = false,
-     .resample_method = PA_RESAMPLER_AUTO,
-     .disable_remixing = false,
--    .disable_lfe_remixing = true,
-+    .disable_lfe_remixing = false,
-     .lfe_crossover_freq = 120,
-     .config_file = NULL,
-     .use_pid_file = true,
-Index: pulseaudio/src/daemon/daemon.conf.in
-===================================================================
---- pulseaudio.orig/src/daemon/daemon.conf.in	2015-05-13 15:00:23.030148165 +0800
-+++ pulseaudio/src/daemon/daemon.conf.in	2015-05-13 15:00:23.026148165 +0800
-@@ -54,7 +54,7 @@
- 
- ; resample-method = speex-float-1
- ; enable-remixing = yes
--; enable-lfe-remixing = no
-+; enable-lfe-remixing = yes
- ; lfe-crossover-freq = 120
- 
- flat-volumes = no
diff --git a/debian/patches/0309-resampler-Allow-disabling-the-LFE-filter-by-setting-.patch b/debian/patches/0309-resampler-Allow-disabling-the-LFE-filter-by-setting-.patch
deleted file mode 100644
index 8551782..0000000
--- a/debian/patches/0309-resampler-Allow-disabling-the-LFE-filter-by-setting-.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From c65a606ae73c9f9fa7bed4aade575395f4ff1890 Mon Sep 17 00:00:00 2001
-From: David Henningsson <david.henningsson at canonical.com>
-Date: Mon, 30 Mar 2015 11:10:56 +0200
-Subject: [PATCH 309/311] resampler: Allow disabling the LFE filter by setting
- crossover to 0
-
-When crossover_freq is set to 0, this restores the old behaviour
-of letting the LFE channel be the average of the source channels,
-without additional processing. This can be useful e g in case the
-user already has a hardware crossover.
-
-Signed-off-by: David Henningsson <david.henningsson at canonical.com>
----
- man/pulse-daemon.conf.5.xml.in | 2 +-
- src/pulsecore/resampler.c      | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-Index: pulseaudio/man/pulse-daemon.conf.5.xml.in
-===================================================================
---- pulseaudio.orig/man/pulse-daemon.conf.5.xml.in	2015-05-13 15:00:32.082148312 +0800
-+++ pulseaudio/man/pulse-daemon.conf.5.xml.in	2015-05-13 15:00:32.078148312 +0800
-@@ -122,7 +122,7 @@
- 
-     <option>
-       <p><opt>lfe-crossover-freq=</opt> The crossover frequency (in Hz) for the
--      LFE filter. Defaults to 120 Hz.</p>
-+      LFE filter. Defaults to 120 Hz. Set it to 0 to disable the LFE filter.</p>
-     </option>
- 
-     <option>
-Index: pulseaudio/src/pulsecore/resampler.c
-===================================================================
---- pulseaudio.orig/src/pulsecore/resampler.c	2015-05-13 15:00:32.082148312 +0800
-+++ pulseaudio/src/pulsecore/resampler.c	2015-05-13 15:00:32.078148312 +0800
-@@ -394,7 +394,7 @@
-     if (r->map_required)
-         setup_remap(r, &r->remap, &lfe_filter_required);
- 
--    if (lfe_filter_required) {
-+    if (lfe_filter_required && crossover_freq > 0) {
-         pa_sample_spec wss = r->o_ss;
-         wss.format = r->work_format;
-         /* FIXME: For now just hardcode maxrewind to 3 seconds */
diff --git a/debian/patches/0310-resampler-Rename-lfe_filter_required-to-lfe_remixed.patch b/debian/patches/0310-resampler-Rename-lfe_filter_required-to-lfe_remixed.patch
deleted file mode 100644
index c4b9117..0000000
--- a/debian/patches/0310-resampler-Rename-lfe_filter_required-to-lfe_remixed.patch
+++ /dev/null
@@ -1,92 +0,0 @@
-From 2cfc5df87faa1ba642afa1ccc7f4c9b920139a79 Mon Sep 17 00:00:00 2001
-From: David Henningsson <david.henningsson at canonical.com>
-Date: Mon, 30 Mar 2015 15:12:53 +0200
-Subject: [PATCH 310/311] resampler: Rename "lfe_filter_required" to
- "lfe_remixed"
-
-Just refactoring to make the variable name better.
-
-Signed-off-by: David Henningsson <david.henningsson at canonical.com>
----
- src/pulsecore/resampler.c | 18 +++++++++---------
- 1 file changed, 9 insertions(+), 9 deletions(-)
-
-Index: pulseaudio/src/pulsecore/resampler.c
-===================================================================
---- pulseaudio.orig/src/pulsecore/resampler.c	2015-05-13 15:00:43.758148502 +0800
-+++ pulseaudio/src/pulsecore/resampler.c	2015-05-13 15:00:43.754148501 +0800
-@@ -40,7 +40,7 @@
- 
- static int copy_init(pa_resampler *r);
- 
--static void setup_remap(const pa_resampler *r, pa_remap_t *m, bool *lfe_filter_required);
-+static void setup_remap(const pa_resampler *r, pa_remap_t *m, bool *lfe_remixed);
- static void free_remap(pa_remap_t *m);
- 
- static int (* const init_table[])(pa_resampler *r) = {
-@@ -303,7 +303,7 @@
-         pa_resample_flags_t flags) {
- 
-     pa_resampler *r = NULL;
--    bool lfe_filter_required = false;
-+    bool lfe_remixed = false;
- 
-     pa_assert(pool);
-     pa_assert(a);
-@@ -392,9 +392,9 @@
- 
-     /* set up the remap structure */
-     if (r->map_required)
--        setup_remap(r, &r->remap, &lfe_filter_required);
-+        setup_remap(r, &r->remap, &lfe_remixed);
- 
--    if (lfe_filter_required && crossover_freq > 0) {
-+    if (lfe_remixed && crossover_freq > 0) {
-         pa_sample_spec wss = r->o_ss;
-         wss.format = r->work_format;
-         /* FIXME: For now just hardcode maxrewind to 3 seconds */
-@@ -764,7 +764,7 @@
-     return ON_OTHER;
- }
- 
--static void setup_remap(const pa_resampler *r, pa_remap_t *m, bool *lfe_filter_required) {
-+static void setup_remap(const pa_resampler *r, pa_remap_t *m, bool *lfe_remixed) {
-     unsigned oc, ic;
-     unsigned n_oc, n_ic;
-     bool ic_connected[PA_CHANNELS_MAX];
-@@ -773,7 +773,7 @@
- 
-     pa_assert(r);
-     pa_assert(m);
--    pa_assert(lfe_filter_required);
-+    pa_assert(lfe_remixed);
- 
-     n_oc = r->o_ss.channels;
-     n_ic = r->i_ss.channels;
-@@ -786,7 +786,7 @@
-     memset(m->map_table_i, 0, sizeof(m->map_table_i));
- 
-     memset(ic_connected, 0, sizeof(ic_connected));
--    *lfe_filter_required = false;
-+    *lfe_remixed = false;
- 
-     if (r->flags & PA_RESAMPLER_NO_REMAP) {
-         for (oc = 0; oc < PA_MIN(n_ic, n_oc); oc++)
-@@ -900,7 +900,7 @@
-                     ic_connected[ic] = true;
- 
-                     if (a == PA_CHANNEL_POSITION_MONO && on_lfe(b) && !(r->flags & PA_RESAMPLER_NO_LFE))
--                        *lfe_filter_required = true;
-+                        *lfe_remixed = true;
-                 }
-                 else if (b == PA_CHANNEL_POSITION_MONO) {
-                     m->map_table_f[oc][ic] = 1.0f / (float) n_ic;
-@@ -984,7 +984,7 @@
-                     /* Please note that a channel connected to LFE doesn't
-                      * really count as connected. */
- 
--                    *lfe_filter_required = true;
-+                    *lfe_remixed = true;
-                 }
-             }
-         }
diff --git a/debian/patches/0311-tests-add-tolerant-variation-for-comparing-the-rewin.patch b/debian/patches/0311-tests-add-tolerant-variation-for-comparing-the-rewin.patch
deleted file mode 100644
index 8ceafec..0000000
--- a/debian/patches/0311-tests-add-tolerant-variation-for-comparing-the-rewin.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From a7d41ef0439fe86466c96428af689145b513b913 Mon Sep 17 00:00:00 2001
-From: Hui Wang <hui.wang at canonical.com>
-Date: Mon, 25 May 2015 20:05:30 +0800
-Subject: [PATCH] tests: add tolerant variation for comparing the rewind result
-
-On 32bits OS, this test case fails. The reason is when rewinding to
-the middle of a block, some of float parameters in the saved_state
-are stored in the memory from FPU registers, and those parameters will
-be used for next time to process data with lfe. Here if FPU register
-is over 32bits, the storing from FPU register to memory will introduce
-some variation, and this small variation will introduce small
-variation to the rewinding result.
-
-So adding the tolerant variation for comparing the rewind result, make
-this test case can work on both 64bits OS and 32bits OS.
-
-Signed-off-by: Hui Wang <hui.wang at canonical.com>
----
- src/tests/lfe-filter-test.c | 10 ++++++----
- 1 file changed, 6 insertions(+), 4 deletions(-)
-
-diff --git a/src/tests/lfe-filter-test.c b/src/tests/lfe-filter-test.c
-index 2c6d597..ea8108c 100644
---- a/src/tests/lfe-filter-test.c
-+++ b/src/tests/lfe-filter-test.c
-@@ -37,6 +37,7 @@ static uint8_t *ori_sample_ptr;
- 
- #define ONE_BLOCK_SAMPLES 4096
- #define TOTAL_SAMPLES 8192
-+#define TOLERANT_VARIATION 1
- 
- static void save_data_block(struct lfe_filter_test *lft, void *d, pa_memblock *blk) {
-     uint8_t *dst = d, *src;
-@@ -63,11 +64,12 @@ static pa_memblock* generate_data_block(struct lfe_filter_test *lft, int start)
- static int compare_data_block(struct lfe_filter_test *lft, void *a, void *b) {
-     int ret = 0;
-     uint32_t i;
--    uint32_t fz = pa_frame_size(lft->ss);
--    uint8_t *r = a, *u = b;
-+    uint16_t *r = a, *u = b;
-+
-+    pa_assert(lft->ss->format == PA_SAMPLE_S16NE);
- 
--    for (i = 0; i < ONE_BLOCK_SAMPLES * fz; i++) {
--        if (*r++ != *u++) {
-+    for (i = 0; i < ONE_BLOCK_SAMPLES; i++) {
-+        if (abs(*r++ - *u++) > TOLERANT_VARIATION) {
-             pa_log_error("lfe-filter-test: test failed, the output data in the position 0x%x of a block does not equal!\n", i);
-             ret = -1;
-             break;
--- 
-1.9.1
-
diff --git a/debian/patches/0312-lfe-filter-test-Use-S16NE-format.patch b/debian/patches/0312-lfe-filter-test-Use-S16NE-format.patch
deleted file mode 100644
index e22badb..0000000
--- a/debian/patches/0312-lfe-filter-test-Use-S16NE-format.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From c72c1df911ac6e5f6601aeb39a5e92a84c9d33c7 Mon Sep 17 00:00:00 2001
-From: David Henningsson <david.henningsson at canonical.com>
-Date: Tue, 26 May 2015 08:47:46 +0200
-Subject: [PATCH] lfe-filter-test: Use S16NE format
-
-...otherwise this code will fail on big-endian architectures.
-
-Cc: Hui Wang <hui.wang at canonical.com>
-Signed-off-by: David Henningsson <david.henningsson at canonical.com>
----
- src/tests/lfe-filter-test.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/tests/lfe-filter-test.c b/src/tests/lfe-filter-test.c
-index ea8108c..389a2b9 100644
---- a/src/tests/lfe-filter-test.c
-+++ b/src/tests/lfe-filter-test.c
-@@ -133,7 +133,7 @@ START_TEST (lfe_filter_test) {
- 
-     a.channels = 1;
-     a.rate = 44100;
--    a.format = PA_SAMPLE_S16LE;
-+    a.format = PA_SAMPLE_S16NE;
- 
-     lft.ss = &a;
-     pa_assert_se(lft.pool = pa_mempool_new(false, 0));
--- 
-1.9.1
-
diff --git a/debian/patches/0406-tagstruct-add-copy-method.patch b/debian/patches/0406-tagstruct-add-copy-method.patch
index 0ad1c6c..f80dddb 100644
--- a/debian/patches/0406-tagstruct-add-copy-method.patch
+++ b/debian/patches/0406-tagstruct-add-copy-method.patch
@@ -11,10 +11,10 @@ Originally by Wim Taymans, backported by David Henningsson
 
 Index: pulseaudio/src/pulsecore/tagstruct.c
 ===================================================================
---- pulseaudio.orig/src/pulsecore/tagstruct.c	2015-08-27 17:06:31.000000000 +0200
-+++ pulseaudio/src/pulsecore/tagstruct.c	2015-08-27 17:10:53.302118854 +0200
-@@ -83,6 +83,19 @@
-     return p;
+--- pulseaudio.orig/src/pulsecore/tagstruct.c
++++ pulseaudio/src/pulsecore/tagstruct.c
+@@ -97,6 +97,19 @@ void pa_tagstruct_free(pa_tagstruct*t) {
+         pa_xfree(t);
  }
  
 +pa_tagstruct *pa_tagstruct_copy(pa_tagstruct*t) {
@@ -30,16 +30,16 @@ Index: pulseaudio/src/pulsecore/tagstruct.c
 +    return tc;
 +}
 +
- static void extend(pa_tagstruct*t, size_t l) {
+ static inline void extend(pa_tagstruct*t, size_t l) {
      pa_assert(t);
-     pa_assert(t->dynamic);
+     pa_assert(t->type != PA_TAGSTRUCT_FIXED);
 Index: pulseaudio/src/pulsecore/tagstruct.h
 ===================================================================
---- pulseaudio.orig/src/pulsecore/tagstruct.h	2015-08-27 17:06:31.000000000 +0200
-+++ pulseaudio/src/pulsecore/tagstruct.h	2015-08-27 17:06:39.000000000 +0200
-@@ -64,6 +64,8 @@
+--- pulseaudio.orig/src/pulsecore/tagstruct.h
++++ pulseaudio/src/pulsecore/tagstruct.h
+@@ -64,6 +64,8 @@ pa_tagstruct *pa_tagstruct_new(void);
+ pa_tagstruct *pa_tagstruct_new_fixed(const uint8_t* data, size_t length);
  void pa_tagstruct_free(pa_tagstruct*t);
- uint8_t* pa_tagstruct_free_data(pa_tagstruct*t, size_t *l);
  
 +pa_tagstruct *pa_tagstruct_copy(pa_tagstruct*t);
 +
diff --git a/debian/patches/0407-access-Add-access-control-hooks.patch b/debian/patches/0407-access-Add-access-control-hooks.patch
index 17f3bce..2a27cd9 100644
--- a/debian/patches/0407-access-Add-access-control-hooks.patch
+++ b/debian/patches/0407-access-Add-access-control-hooks.patch
@@ -12,10 +12,10 @@ Add hooks to core to check if certain operations are allowed.
  4 files changed, 111 insertions(+)
  create mode 100644 src/pulsecore/access.h
 
-diff --git a/src/Makefile.am b/src/Makefile.am
-index f96f527..f6897de 100644
---- a/src/Makefile.am
-+++ b/src/Makefile.am
+Index: pulseaudio/src/Makefile.am
+===================================================================
+--- pulseaudio.orig/src/Makefile.am
++++ pulseaudio/src/Makefile.am
 @@ -637,6 +637,7 @@ pkglib_LTLIBRARIES = \
  # to the existing libpulse being linked to libpulsecommon). Duplicating the
  # code allows us to prevent this circular linking.
@@ -24,11 +24,10 @@ index f96f527..f6897de 100644
  		pulse/client-conf.c pulse/client-conf.h \
  		pulse/fork-detect.c pulse/fork-detect.h \
  		pulse/format.c pulse/format.h \
-diff --git a/src/pulsecore/access.h b/src/pulsecore/access.h
-new file mode 100644
-index 0000000..7cd2751
+Index: pulseaudio/src/pulsecore/access.h
+===================================================================
 --- /dev/null
-+++ b/src/pulsecore/access.h
++++ pulseaudio/src/pulsecore/access.h
 @@ -0,0 +1,102 @@
 +#ifndef fooaccesshfoo
 +#define fooaccesshfoo
@@ -132,11 +131,11 @@ index 0000000..7cd2751
 +};
 +
 +#endif
-diff --git a/src/pulsecore/core.c b/src/pulsecore/core.c
-index 0e63bac..9135311 100644
---- a/src/pulsecore/core.c
-+++ b/src/pulsecore/core.c
-@@ -151,6 +151,9 @@ pa_core* pa_core_new(pa_mainloop_api *m, bool shared, size_t shm_size) {
+Index: pulseaudio/src/pulsecore/core.c
+===================================================================
+--- pulseaudio.orig/src/pulsecore/core.c
++++ pulseaudio/src/pulsecore/core.c
+@@ -151,6 +151,9 @@ pa_core* pa_core_new(pa_mainloop_api *m,
      for (j = 0; j < PA_CORE_HOOK_MAX; j++)
          pa_hook_init(&c->hooks[j], c);
  
@@ -155,10 +154,10 @@ index 0e63bac..9135311 100644
  
      pa_xfree(c);
  }
-diff --git a/src/pulsecore/core.h b/src/pulsecore/core.h
-index e69a130..6e7feb4 100644
---- a/src/pulsecore/core.h
-+++ b/src/pulsecore/core.h
+Index: pulseaudio/src/pulsecore/core.h
+===================================================================
+--- pulseaudio.orig/src/pulsecore/core.h
++++ pulseaudio/src/pulsecore/core.h
 @@ -50,6 +50,7 @@ typedef enum pa_suspend_cause {
  #include <pulsecore/source.h>
  #include <pulsecore/core-subscribe.h>
@@ -167,7 +166,7 @@ index e69a130..6e7feb4 100644
  
  typedef enum pa_server_type {
      PA_SERVER_TYPE_UNSET,
-@@ -199,6 +200,8 @@ struct pa_core {
+@@ -207,6 +208,8 @@ struct pa_core {
  
      /* hooks */
      pa_hook hooks[PA_CORE_HOOK_MAX];
@@ -176,6 +175,3 @@ index e69a130..6e7feb4 100644
  };
  
  PA_DECLARE_PUBLIC_CLASS(pa_core);
--- 
-2.1.4
-
diff --git a/debian/patches/0408-protocol-native-add-access-checks.patch b/debian/patches/0408-protocol-native-add-access-checks.patch
index 282249d..050dbb4 100644
--- a/debian/patches/0408-protocol-native-add-access-checks.patch
+++ b/debian/patches/0408-protocol-native-add-access-checks.patch
@@ -22,9 +22,9 @@ and send a reply.
 
 Index: pulseaudio/src/pulsecore/protocol-native.c
 ===================================================================
---- pulseaudio.orig/src/pulsecore/protocol-native.c	2015-08-27 15:32:07.566841210 +0200
-+++ pulseaudio/src/pulsecore/protocol-native.c	2015-08-27 15:33:18.854410782 +0200
-@@ -300,6 +300,7 @@
+--- pulseaudio.orig/src/pulsecore/protocol-native.c
++++ pulseaudio/src/pulsecore/protocol-native.c
+@@ -300,6 +300,7 @@ static void command_set_card_profile(pa_
  static void command_set_sink_or_source_port(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata);
  static void command_set_port_latency_offset(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata);
  static void command_enable_srbchannel(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata);
@@ -32,7 +32,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
  
  static const pa_pdispatch_cb_t command_table[PA_COMMAND_MAX] = {
      [PA_COMMAND_ERROR] = NULL,
-@@ -2014,6 +2015,23 @@
+@@ -2015,6 +2016,23 @@ if (!(expression)) { \
  } \
  } while(0);
  
@@ -56,7 +56,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
  static pa_tagstruct *reply_new(uint32_t tag) {
      pa_tagstruct *reply;
  
-@@ -2091,6 +2109,8 @@
+@@ -2092,6 +2110,8 @@ static void command_create_playback_stre
      CHECK_VALIDITY_GOTO(c->pstream, !sink_name || sink_index == PA_INVALID_INDEX, tag, PA_ERR_INVALID, finish);
      CHECK_VALIDITY_GOTO(c->pstream, pa_cvolume_valid(&volume), tag, PA_ERR_INVALID, finish);
  
@@ -65,7 +65,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
      p = pa_proplist_new();
  
      if (name)
-@@ -2412,6 +2432,8 @@
+@@ -2413,6 +2433,8 @@ static void command_create_record_stream
      CHECK_VALIDITY_GOTO(c->pstream, source_index == PA_INVALID_INDEX || !source_name, tag, PA_ERR_INVALID, finish);
      CHECK_VALIDITY_GOTO(c->pstream, !source_name || source_index == PA_INVALID_INDEX, tag, PA_ERR_INVALID, finish);
  
@@ -74,7 +74,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
      p = pa_proplist_new();
  
      if (name)
-@@ -2617,6 +2639,7 @@
+@@ -2618,6 +2640,7 @@ static void command_exit(pa_pdispatch *p
      }
  
      CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);
@@ -82,7 +82,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
      ret = pa_core_exit(c->protocol->core, false, 0);
      CHECK_VALIDITY(c->pstream, ret >= 0, tag, PA_ERR_ACCESS);
  
-@@ -2935,6 +2958,7 @@
+@@ -2936,6 +2959,7 @@ static void command_stat(pa_pdispatch *p
      }
  
      CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);
@@ -90,7 +90,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
  
      stat = pa_mempool_get_stat(c->protocol->core->mempool);
  
-@@ -3061,6 +3085,8 @@
+@@ -3062,6 +3086,8 @@ static void command_create_upload_stream
      CHECK_VALIDITY(c->pstream, (length % pa_frame_size(&ss)) == 0 && length > 0, tag, PA_ERR_INVALID);
      CHECK_VALIDITY(c->pstream, length <= PA_SCACHE_ENTRY_SIZE_MAX, tag, PA_ERR_TOOLARGE);
  
@@ -99,7 +99,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
      p = pa_proplist_new();
  
      if ((c->version >= 13 && pa_tagstruct_get_proplist(t, p) < 0) ||
-@@ -3159,6 +3185,8 @@
+@@ -3160,6 +3186,8 @@ static void command_play_sample(pa_pdisp
  
      CHECK_VALIDITY(c->pstream, sink, tag, PA_ERR_NOENTITY);
  
@@ -108,7 +108,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
      p = pa_proplist_new();
  
      if ((c->version >= 13 && pa_tagstruct_get_proplist(t, p) < 0) ||
-@@ -3202,6 +3230,8 @@
+@@ -3203,6 +3231,8 @@ static void command_remove_sample(pa_pdi
      CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);
      CHECK_VALIDITY(c->pstream, name && pa_namereg_is_valid_name(name), tag, PA_ERR_INVALID);
  
@@ -117,7 +117,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
      if (pa_scache_remove_item(c->protocol->core, name) < 0) {
          pa_pstream_send_error(c->pstream, tag, PA_ERR_NOENTITY);
          return;
-@@ -3650,6 +3680,8 @@
+@@ -3651,6 +3681,8 @@ static void command_get_info(pa_pdispatc
          return;
      }
  
@@ -126,7 +126,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
      reply = reply_new(tag);
      if (sink)
          sink_fill_tagstruct(c, reply, sink);
-@@ -3710,6 +3742,8 @@
+@@ -3711,6 +3743,8 @@ static void command_get_info_list(pa_pdi
  
      if (i) {
          PA_IDXSET_FOREACH(p, i, idx) {
@@ -135,7 +135,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
              if (command == PA_COMMAND_GET_SINK_INFO_LIST)
                  sink_fill_tagstruct(c, reply, p);
              else if (command == PA_COMMAND_GET_SOURCE_INFO_LIST)
-@@ -3732,6 +3766,11 @@
+@@ -3733,6 +3767,11 @@ static void command_get_info_list(pa_pdi
      }
  
      pa_pstream_send_tagstruct(c->pstream, reply);
@@ -147,7 +147,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
  }
  
  static void command_get_server_info(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {
-@@ -3752,6 +3791,15 @@
+@@ -3753,6 +3792,15 @@ static void command_get_server_info(pa_p
  
      CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);
  
@@ -163,7 +163,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
      reply = reply_new(tag);
      pa_tagstruct_puts(reply, PACKAGE_NAME);
      pa_tagstruct_puts(reply, PACKAGE_VERSION);
-@@ -3767,9 +3815,7 @@
+@@ -3768,9 +3816,7 @@ static void command_get_server_info(pa_p
      fixup_sample_spec(c, &fixed_ss, &c->protocol->core->default_sample_spec);
      pa_tagstruct_put_sample_spec(reply, &fixed_ss);
  
@@ -173,17 +173,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
      pa_tagstruct_puts(reply, def_source ? def_source->name : NULL);
  
      pa_tagstruct_putu32(reply, c->protocol->core->cookie);
-@@ -3786,6 +3832,9 @@
- 
-     pa_native_connection_assert_ref(c);
- 
-+    if (check_access (NULL, PA_COMMAND_SUBSCRIBE_EVENT, 0, NULL, userdata, idx, e, NULL) != PA_HOOK_OK)
-+      return;
-+
-     t = pa_tagstruct_new(NULL, 0);
-     pa_tagstruct_putu32(t, PA_COMMAND_SUBSCRIBE_EVENT);
-     pa_tagstruct_putu32(t, (uint32_t) -1);
-@@ -3888,6 +3937,8 @@
+@@ -3892,6 +3938,8 @@ static void command_set_volume(
  
      client_name = pa_strnull(pa_proplist_gets(c->client->proplist, PA_PROP_APPLICATION_PROCESS_BINARY));
  
@@ -192,7 +182,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
      if (sink) {
          CHECK_VALIDITY(c->pstream, volume.channels == 1 || pa_cvolume_compatible(&volume, &sink->sample_spec), tag, PA_ERR_INVALID);
  
-@@ -3983,6 +4034,8 @@
+@@ -3987,6 +4035,8 @@ static void command_set_mute(
  
      CHECK_VALIDITY(c->pstream, si || so || sink || source, tag, PA_ERR_NOENTITY);
  
@@ -201,7 +191,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
      client_name = pa_strnull(pa_proplist_gets(c->client->proplist, PA_PROP_APPLICATION_PROCESS_BINARY));
  
      if (sink) {
-@@ -4446,6 +4499,7 @@
+@@ -4450,6 +4500,7 @@ static void command_set_default_sink_or_
  
          source = pa_namereg_get(c->protocol->core, s, PA_NAMEREG_SOURCE);
          CHECK_VALIDITY(c->pstream, source, tag, PA_ERR_NOENTITY);
@@ -209,7 +199,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
  
          pa_namereg_set_default_source(c->protocol->core, source);
      } else {
-@@ -4454,6 +4508,7 @@
+@@ -4458,6 +4509,7 @@ static void command_set_default_sink_or_
  
          sink = pa_namereg_get(c->protocol->core, s, PA_NAMEREG_SINK);
          CHECK_VALIDITY(c->pstream, sink, tag, PA_ERR_NOENTITY);
@@ -217,7 +207,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
  
          pa_namereg_set_default_sink(c->protocol->core, sink);
      }
-@@ -4521,6 +4576,7 @@
+@@ -4525,6 +4577,7 @@ static void command_kill(pa_pdispatch *p
  
          client = pa_idxset_get_by_index(c->protocol->core->clients, idx);
          CHECK_VALIDITY(c->pstream, client, tag, PA_ERR_NOENTITY);
@@ -225,7 +215,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
  
          pa_native_connection_ref(c);
          pa_client_kill(client);
-@@ -4530,6 +4586,7 @@
+@@ -4534,6 +4587,7 @@ static void command_kill(pa_pdispatch *p
  
          s = pa_idxset_get_by_index(c->protocol->core->sink_inputs, idx);
          CHECK_VALIDITY(c->pstream, s, tag, PA_ERR_NOENTITY);
@@ -233,7 +223,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
  
          pa_native_connection_ref(c);
          pa_sink_input_kill(s);
-@@ -4540,6 +4597,7 @@
+@@ -4544,6 +4598,7 @@ static void command_kill(pa_pdispatch *p
  
          s = pa_idxset_get_by_index(c->protocol->core->source_outputs, idx);
          CHECK_VALIDITY(c->pstream, s, tag, PA_ERR_NOENTITY);
@@ -241,7 +231,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
  
          pa_native_connection_ref(c);
          pa_source_output_kill(s);
-@@ -4569,6 +4627,8 @@
+@@ -4573,6 +4628,8 @@ static void command_load_module(pa_pdisp
      CHECK_VALIDITY(c->pstream, name && *name && pa_utf8_valid(name) && !strchr(name, '/'), tag, PA_ERR_INVALID);
      CHECK_VALIDITY(c->pstream, !argument || pa_utf8_valid(argument), tag, PA_ERR_INVALID);
  
@@ -250,7 +240,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
      if (!(m = pa_module_load(c->protocol->core, name, argument))) {
          pa_pstream_send_error(c->pstream, tag, PA_ERR_MODINITFAILED);
          return;
-@@ -4597,6 +4657,8 @@
+@@ -4601,6 +4658,8 @@ static void command_unload_module(pa_pdi
      m = pa_idxset_get_by_index(c->protocol->core->modules, idx);
      CHECK_VALIDITY(c->pstream, m, tag, PA_ERR_NOENTITY);
  
@@ -259,7 +249,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
      pa_module_unload_request(m, false);
      pa_pstream_send_simple_ack(c->pstream, tag);
  }
-@@ -4635,6 +4697,7 @@
+@@ -4639,6 +4698,7 @@ static void command_move_stream(pa_pdisp
              sink = pa_namereg_get(c->protocol->core, name_device, PA_NAMEREG_SINK);
  
          CHECK_VALIDITY(c->pstream, si && sink, tag, PA_ERR_NOENTITY);
@@ -267,7 +257,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
  
          if (pa_sink_input_move_to(si, sink, true) < 0) {
              pa_pstream_send_error(c->pstream, tag, PA_ERR_INVALID);
-@@ -4654,6 +4717,7 @@
+@@ -4658,6 +4718,7 @@ static void command_move_stream(pa_pdisp
              source = pa_namereg_get(c->protocol->core, name_device, PA_NAMEREG_SOURCE);
  
          CHECK_VALIDITY(c->pstream, so && source, tag, PA_ERR_NOENTITY);
@@ -275,7 +265,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
  
          if (pa_source_output_move_to(so, source, true) < 0) {
              pa_pstream_send_error(c->pstream, tag, PA_ERR_INVALID);
-@@ -4689,6 +4753,8 @@
+@@ -4693,6 +4754,8 @@ static void command_suspend(pa_pdispatch
  
          if (idx == PA_INVALID_INDEX && name && !*name) {
  
@@ -284,7 +274,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
              pa_log_debug("%s all sinks", b ? "Suspending" : "Resuming");
  
              if (pa_sink_suspend_all(c->protocol->core, b, PA_SUSPEND_USER) < 0) {
-@@ -4705,6 +4771,8 @@
+@@ -4709,6 +4772,8 @@ static void command_suspend(pa_pdispatch
  
              CHECK_VALIDITY(c->pstream, sink, tag, PA_ERR_NOENTITY);
  
@@ -293,7 +283,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
              pa_log_debug("%s of sink %s requested by client %" PRIu32 ".",
                           b ? "Suspending" : "Resuming", sink->name, c->client->index);
  
-@@ -4719,6 +4787,8 @@
+@@ -4723,6 +4788,8 @@ static void command_suspend(pa_pdispatch
  
          if (idx == PA_INVALID_INDEX && name && !*name) {
  
@@ -302,7 +292,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
              pa_log_debug("%s all sources", b ? "Suspending" : "Resuming");
  
              if (pa_source_suspend_all(c->protocol->core, b, PA_SUSPEND_USER) < 0) {
-@@ -4736,6 +4806,8 @@
+@@ -4740,6 +4807,8 @@ static void command_suspend(pa_pdispatch
  
              CHECK_VALIDITY(c->pstream, source, tag, PA_ERR_NOENTITY);
  
@@ -311,7 +301,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
              pa_log_debug("%s of source %s requested by client %" PRIu32 ".",
                           b ? "Suspending" : "Resuming", source->name, c->client->index);
  
-@@ -4779,6 +4851,8 @@
+@@ -4783,6 +4852,8 @@ static void command_extension(pa_pdispat
      CHECK_VALIDITY(c->pstream, m, tag, PA_ERR_NOEXTENSION);
      CHECK_VALIDITY(c->pstream, m->load_once || idx != PA_INVALID_INDEX, tag, PA_ERR_INVALID);
  
@@ -320,7 +310,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
      cb = (pa_native_protocol_ext_cb_t) (unsigned long) pa_hashmap_get(c->protocol->extensions, m);
      CHECK_VALIDITY(c->pstream, cb, tag, PA_ERR_NOEXTENSION);
  
-@@ -4821,6 +4895,8 @@
+@@ -4825,6 +4896,8 @@ static void command_set_card_profile(pa_
  
      CHECK_VALIDITY(c->pstream, profile, tag, PA_ERR_NOENTITY);
  
@@ -329,7 +319,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
      if ((ret = pa_card_set_profile(card, profile, true)) < 0) {
          pa_pstream_send_error(c->pstream, tag, -ret);
          return;
-@@ -4861,6 +4937,8 @@
+@@ -4865,6 +4938,8 @@ static void command_set_sink_or_source_p
  
          CHECK_VALIDITY(c->pstream, sink, tag, PA_ERR_NOENTITY);
  
@@ -338,7 +328,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
          if ((ret = pa_sink_set_port(sink, port, true)) < 0) {
              pa_pstream_send_error(c->pstream, tag, -ret);
              return;
-@@ -4877,6 +4955,8 @@
+@@ -4881,6 +4956,8 @@ static void command_set_sink_or_source_p
  
          CHECK_VALIDITY(c->pstream, source, tag, PA_ERR_NOENTITY);
  
@@ -347,7 +337,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
          if ((ret = pa_source_set_port(source, port, true)) < 0) {
              pa_pstream_send_error(c->pstream, tag, -ret);
              return;
-@@ -4921,6 +5001,8 @@
+@@ -4925,6 +5002,8 @@ static void command_set_port_latency_off
      port = pa_hashmap_get(card->ports, port_name);
      CHECK_VALIDITY(c->pstream, port, tag, PA_ERR_NOENTITY);
  
@@ -356,7 +346,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
      pa_device_port_set_latency_offset(port, offset);
  
      pa_pstream_send_simple_ack(c->pstream, tag);
-@@ -5461,3 +5543,136 @@
+@@ -5465,3 +5544,136 @@ pa_client* pa_native_connection_get_clie
  
      return c->client;
  }
diff --git a/debian/patches/0409-Trust-store-patch.patch b/debian/patches/0409-Trust-store-patch.patch
index bed2290..5f0ad3e 100644
--- a/debian/patches/0409-Trust-store-patch.patch
+++ b/debian/patches/0409-Trust-store-patch.patch
@@ -26,9 +26,9 @@ Signed-off-by: David Henningsson <david.henningsson at canonical.com>
 
 Index: pulseaudio/configure.ac
 ===================================================================
---- pulseaudio.orig/configure.ac	2015-08-27 15:41:43.827251983 +0200
-+++ pulseaudio/configure.ac	2015-08-27 15:41:43.815252328 +0200
-@@ -1384,6 +1384,19 @@
+--- pulseaudio.orig/configure.ac
++++ pulseaudio/configure.ac
+@@ -1399,6 +1399,19 @@ AS_IF([test "x$enable_adrian_aec" != "xn
      [HAVE_ADRIAN_EC=1])
  AM_CONDITIONAL([HAVE_ADRIAN_EC], [test "x$HAVE_ADRIAN_EC" = "x1"])
  
@@ -48,17 +48,17 @@ Index: pulseaudio/configure.ac
  
  
  ###################################
-@@ -1544,6 +1557,7 @@
- AS_IF([test "x$HAVE_ADRIAN_EC" = "x1"], ENABLE_ADRIAN_EC=yes, ENABLE_ADRIAN_EC=no)
+@@ -1568,6 +1581,7 @@ AS_IF([test "x$HAVE_ADRIAN_EC" = "x1"],
  AS_IF([test "x$HAVE_SPEEX" = "x1"], ENABLE_SPEEX=yes, ENABLE_SPEEX=no)
+ AS_IF([test "x$HAVE_SOXR" = "x1"], ENABLE_SOXR=yes, ENABLE_SOXR=no)
  AS_IF([test "x$HAVE_WEBRTC" = "x1"], ENABLE_WEBRTC=yes, ENABLE_WEBRTC=no)
 +AS_IF([test "x$HAVE_TRUST_STORE" = "x1"], ENABLE_TRUST_STORE=yes, ENABLE_TRUST_STORE=no)
  AS_IF([test "x$HAVE_TDB" = "x1"], ENABLE_TDB=yes, ENABLE_TDB=no)
  AS_IF([test "x$HAVE_GDBM" = "x1"], ENABLE_GDBM=yes, ENABLE_GDBM=no)
  AS_IF([test "x$HAVE_SIMPLEDB" = "x1"], ENABLE_SIMPLEDB=yes, ENABLE_SIMPLEDB=no)
-@@ -1606,6 +1620,7 @@
-     Enable Adrian echo canceller:  ${ENABLE_ADRIAN_EC}
+@@ -1632,6 +1646,7 @@ echo "
      Enable speex (resampler, AEC): ${ENABLE_SPEEX}
+     Enable soxr (resampler):       ${ENABLE_SOXR}
      Enable WebRTC echo canceller:  ${ENABLE_WEBRTC}
 +    Enable Ubuntu trust store:     ${ENABLE_TRUST_STORE}
      Enable gcov coverage:          ${ENABLE_GCOV}
@@ -66,9 +66,9 @@ Index: pulseaudio/configure.ac
      Database
 Index: pulseaudio/src/Makefile.am
 ===================================================================
---- pulseaudio.orig/src/Makefile.am	2015-08-27 15:41:43.827251983 +0200
-+++ pulseaudio/src/Makefile.am	2015-08-27 16:41:19.000000000 +0200
-@@ -1064,6 +1064,10 @@
+--- pulseaudio.orig/src/Makefile.am
++++ pulseaudio/src/Makefile.am
+@@ -1072,6 +1072,10 @@ if HAVE_WEBRTC
  modlibexec_LTLIBRARIES += libwebrtc-util.la
  endif
  
@@ -79,7 +79,7 @@ Index: pulseaudio/src/Makefile.am
  if HAVE_ESOUND
  modlibexec_LTLIBRARIES += \
  		libprotocol-esound.la
-@@ -1188,6 +1192,11 @@
+@@ -1196,6 +1200,11 @@ modlibexec_LTLIBRARIES += \
  		module-filter-heuristics.la \
  		module-role-ducking.la
  
@@ -91,7 +91,7 @@ Index: pulseaudio/src/Makefile.am
  if HAVE_ESOUND
  modlibexec_LTLIBRARIES += \
  		module-esound-protocol-tcp.la \
-@@ -1513,6 +1522,7 @@
+@@ -1521,6 +1530,7 @@ SYMDEF_FILES = \
  		module-intended-roles-symdef.h \
  		module-suspend-on-idle-symdef.h \
  		module-echo-cancel-symdef.h \
@@ -99,7 +99,7 @@ Index: pulseaudio/src/Makefile.am
  		module-hal-detect-symdef.h \
  		module-udev-detect-symdef.h \
  		module-systemd-login-symdef.h \
-@@ -2103,6 +2113,20 @@
+@@ -2113,6 +2123,20 @@ module_echo_cancel_la_CFLAGS += -DHAVE_W
  module_echo_cancel_la_LIBADD += libwebrtc-util.la
  endif
  
@@ -122,8 +122,8 @@ Index: pulseaudio/src/Makefile.am
  module_rtp_send_la_LDFLAGS = $(MODULE_LDFLAGS)
 Index: pulseaudio/src/modules/trust-store/module-trust-store.c
 ===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ pulseaudio/src/modules/trust-store/module-trust-store.c	2015-08-27 16:47:51.491242361 +0200
+--- /dev/null
++++ pulseaudio/src/modules/trust-store/module-trust-store.c
 @@ -0,0 +1,225 @@
 +/***
 +    This file is part of PulseAudio.
@@ -352,8 +352,8 @@ Index: pulseaudio/src/modules/trust-store/module-trust-store.c
 +}
 Index: pulseaudio/src/modules/trust-store/truststore.cc
 ===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ pulseaudio/src/modules/trust-store/truststore.cc	2015-08-27 16:41:21.000000000 +0200
+--- /dev/null
++++ pulseaudio/src/modules/trust-store/truststore.cc
 @@ -0,0 +1,74 @@
 +#ifdef HAVE_CONFIG_H
 +#include <config.h>
@@ -431,8 +431,8 @@ Index: pulseaudio/src/modules/trust-store/truststore.cc
 +}
 Index: pulseaudio/src/modules/trust-store/truststore.h
 ===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ pulseaudio/src/modules/trust-store/truststore.h	2015-08-27 15:41:43.819252213 +0200
+--- /dev/null
++++ pulseaudio/src/modules/trust-store/truststore.h
 @@ -0,0 +1,41 @@
 +/***
 +    This file is part of PulseAudio.
@@ -477,9 +477,9 @@ Index: pulseaudio/src/modules/trust-store/truststore.h
 +#endif
 Index: pulseaudio/src/pulsecore/client.c
 ===================================================================
---- pulseaudio.orig/src/pulsecore/client.c	2015-08-27 15:41:43.827251983 +0200
-+++ pulseaudio/src/pulsecore/client.c	2015-08-27 15:41:43.819252213 +0200
-@@ -60,7 +60,7 @@
+--- pulseaudio.orig/src/pulsecore/client.c
++++ pulseaudio/src/pulsecore/client.c
+@@ -60,7 +60,7 @@ pa_client *pa_client_new(pa_core *core,
      if (pa_hook_fire(&core->hooks[PA_CORE_HOOK_CLIENT_NEW], data) < 0)
          return NULL;
  
@@ -488,7 +488,7 @@ Index: pulseaudio/src/pulsecore/client.c
      c->core = core;
      c->proplist = pa_proplist_copy(data->proplist);
      c->driver = pa_xstrdup(pa_path_get_filename(data->driver));
-@@ -69,10 +69,6 @@
+@@ -69,10 +69,6 @@ pa_client *pa_client_new(pa_core *core,
      c->sink_inputs = pa_idxset_new(NULL, NULL);
      c->source_outputs = pa_idxset_new(NULL, NULL);
  
@@ -501,9 +501,9 @@ Index: pulseaudio/src/pulsecore/client.c
      pa_log_info("Created %u \"%s\"", c->index, pa_strnull(pa_proplist_gets(c->proplist, PA_PROP_APPLICATION_NAME)));
 Index: pulseaudio/src/pulsecore/client.h
 ===================================================================
---- pulseaudio.orig/src/pulsecore/client.h	2015-08-27 15:41:43.827251983 +0200
-+++ pulseaudio/src/pulsecore/client.h	2015-08-27 15:41:43.819252213 +0200
-@@ -27,6 +27,7 @@
+--- pulseaudio.orig/src/pulsecore/client.h
++++ pulseaudio/src/pulsecore/client.h
+@@ -27,6 +27,7 @@ typedef struct pa_client pa_client;
  #include <pulse/proplist.h>
  #include <pulsecore/core.h>
  #include <pulsecore/module.h>
@@ -511,7 +511,7 @@ Index: pulseaudio/src/pulsecore/client.h
  
  /* Every connection to the server should have a pa_client
   * attached. That way the user may generate a listing of all connected
-@@ -36,6 +37,9 @@
+@@ -36,6 +37,9 @@ struct pa_client {
      uint32_t index;
      pa_core *core;
  
@@ -523,9 +523,9 @@ Index: pulseaudio/src/pulsecore/client.h
      char *driver;
 Index: pulseaudio/src/pulsecore/creds.h
 ===================================================================
---- pulseaudio.orig/src/pulsecore/creds.h	2015-08-27 15:41:43.827251983 +0200
-+++ pulseaudio/src/pulsecore/creds.h	2015-08-27 15:41:43.819252213 +0200
-@@ -41,6 +41,7 @@
+--- pulseaudio.orig/src/pulsecore/creds.h
++++ pulseaudio/src/pulsecore/creds.h
+@@ -41,6 +41,7 @@ typedef struct pa_cmsg_ancil_data pa_cms
  struct pa_creds {
      gid_t gid;
      uid_t uid;
@@ -535,9 +535,9 @@ Index: pulseaudio/src/pulsecore/creds.h
  /* Struct for handling ancillary data, i e, extra data that can be sent together with a message
 Index: pulseaudio/src/pulsecore/iochannel.c
 ===================================================================
---- pulseaudio.orig/src/pulsecore/iochannel.c	2015-08-27 15:41:43.827251983 +0200
-+++ pulseaudio/src/pulsecore/iochannel.c	2015-08-27 15:41:43.819252213 +0200
-@@ -323,6 +323,7 @@
+--- pulseaudio.orig/src/pulsecore/iochannel.c
++++ pulseaudio/src/pulsecore/iochannel.c
+@@ -323,6 +323,7 @@ ssize_t pa_iochannel_write_with_creds(pa
  
      u = (struct ucred*) CMSG_DATA(&cmsg.hdr);
  
@@ -545,7 +545,7 @@ Index: pulseaudio/src/pulsecore/iochannel.c
      u->pid = getpid();
      if (ucred) {
          u->uid = ucred->uid;
-@@ -437,6 +438,7 @@
+@@ -437,6 +438,7 @@ ssize_t pa_iochannel_read_with_ancil_dat
  
                  ancil_data->creds.gid = u.gid;
                  ancil_data->creds.uid = u.uid;
@@ -555,9 +555,9 @@ Index: pulseaudio/src/pulsecore/iochannel.c
              else if (cmh->cmsg_type == SCM_RIGHTS) {
 Index: pulseaudio/src/pulsecore/protocol-native.c
 ===================================================================
---- pulseaudio.orig/src/pulsecore/protocol-native.c	2015-08-27 15:41:43.827251983 +0200
-+++ pulseaudio/src/pulsecore/protocol-native.c	2015-08-27 15:41:43.823252098 +0200
-@@ -2811,6 +2811,13 @@
+--- pulseaudio.orig/src/pulsecore/protocol-native.c
++++ pulseaudio/src/pulsecore/protocol-native.c
+@@ -2812,6 +2812,13 @@ static void command_auth(pa_pdispatch *p
              do_shm = false;
  
  #ifdef HAVE_CREDS
@@ -571,7 +571,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
      if (do_shm) {
          /* Only enable SHM if both sides are owned by the same
           * user. This is a security measure because otherwise data
-@@ -5623,6 +5630,7 @@
+@@ -5624,6 +5631,7 @@ typedef struct pa_protocol_native_access
  } pa_protocol_native_access_data;
  
  static void check_access_finish_cb(pa_access_data *data, bool res) {
@@ -579,7 +579,7 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
      pa_protocol_native_access_data *d = (pa_protocol_native_access_data *) data;
      pa_native_connection *c = PA_NATIVE_CONNECTION(d->userdata);
  
-@@ -5631,6 +5639,11 @@
+@@ -5632,6 +5640,11 @@ static void check_access_finish_cb(pa_ac
          goto finish;
      }
  
@@ -593,9 +593,9 @@ Index: pulseaudio/src/pulsecore/protocol-native.c
      command_table[d->command](d->pd, d->command, d->tag, d->tc, d->userdata);
 Index: pulseaudio/src/tests/connect-stress.c
 ===================================================================
---- pulseaudio.orig/src/tests/connect-stress.c	2015-08-27 15:41:43.827251983 +0200
-+++ pulseaudio/src/tests/connect-stress.c	2015-08-27 15:41:43.823252098 +0200
-@@ -63,7 +63,7 @@
+--- pulseaudio.orig/src/tests/connect-stress.c
++++ pulseaudio/src/tests/connect-stress.c
+@@ -63,7 +63,7 @@ static const pa_sample_spec sample_spec
  
  static void context_state_callback(pa_context *c, void *userdata);
  
@@ -604,7 +604,7 @@ Index: pulseaudio/src/tests/connect-stress.c
      int ret;
      pa_mainloop_api *api;
  
-@@ -201,7 +201,7 @@
+@@ -201,7 +201,7 @@ START_TEST (connect_stress_test) {
          streams[i] = NULL;
  
      for (i = 0; i < NTESTS; i++) {
@@ -615,9 +615,9 @@ Index: pulseaudio/src/tests/connect-stress.c
          usleep(rand() % 500000);
 Index: pulseaudio/po/POTFILES.in
 ===================================================================
---- pulseaudio.orig/po/POTFILES.in	2015-08-27 10:22:25.000000000 +0200
-+++ pulseaudio/po/POTFILES.in	2015-08-27 15:55:27.000097715 +0200
-@@ -23,6 +23,7 @@
+--- pulseaudio.orig/po/POTFILES.in
++++ pulseaudio/po/POTFILES.in
+@@ -23,6 +23,7 @@ src/modules/gconf/module-gconf.c
  src/modules/jack/module-jack-sink.c
  src/modules/jack/module-jack-source.c
  src/modules/macosx/module-coreaudio-device.c
diff --git a/debian/patches/0410-Add-thread-to-activate-trust-store-interface.patch b/debian/patches/0410-Add-thread-to-activate-trust-store-interface.patch
index 5fc4249..b58bc08 100644
--- a/debian/patches/0410-Add-thread-to-activate-trust-store-interface.patch
+++ b/debian/patches/0410-Add-thread-to-activate-trust-store-interface.patch
@@ -8,11 +8,11 @@ Subject: [PATCH] Add thread to activate trust-store interface
  src/modules/trust-store/truststore.cc        | 19 +++++++++++++++++++
  2 files changed, 20 insertions(+), 13 deletions(-)
 
-diff --git a/src/modules/trust-store/module-trust-store.c b/src/modules/trust-store/module-trust-store.c
-index 5a3dd0b..0fb27e0 100644
---- a/src/modules/trust-store/module-trust-store.c
-+++ b/src/modules/trust-store/module-trust-store.c
-@@ -27,6 +27,7 @@
+Index: pulseaudio/src/modules/trust-store/module-trust-store.c
+===================================================================
+--- pulseaudio.orig/src/modules/trust-store/module-trust-store.c
++++ pulseaudio/src/modules/trust-store/module-trust-store.c
+@@ -28,6 +28,7 @@
  #include <pulsecore/fdsem.h>
  #include <pulsecore/thread.h>
  #include <pulsecore/core-util.h>
@@ -20,7 +20,7 @@ index 5a3dd0b..0fb27e0 100644
  #include <pulse/mainloop-api.h>
  
  #include "module-trust-store-symdef.h"
-@@ -168,18 +169,6 @@ static pa_hook_result_t connect_record_hook(pa_core *core, pa_access_data *d, st
+@@ -170,18 +171,6 @@ static pa_hook_result_t connect_record_h
      return PA_HOOK_CANCEL;
  }
  
@@ -39,7 +39,7 @@ index 5a3dd0b..0fb27e0 100644
  int pa__init(pa_module *m) {
      struct userdata *u;
      pa_trust_store *ts = pa_trust_store_new();
-@@ -199,7 +188,6 @@ int pa__init(pa_module *m) {
+@@ -201,7 +190,6 @@ int pa__init(pa_module *m) {
                   pa_fdsem_get(u->fdsem), PA_IO_EVENT_INPUT, check_fdsem, u));
      pa_fdsem_before_poll(u->fdsem);
  
@@ -47,10 +47,10 @@ index 5a3dd0b..0fb27e0 100644
      return 0;
  }
  
-diff --git a/src/modules/trust-store/truststore.cc b/src/modules/trust-store/truststore.cc
-index ee09038..8645ce5 100644
---- a/src/modules/trust-store/truststore.cc
-+++ b/src/modules/trust-store/truststore.cc
+Index: pulseaudio/src/modules/trust-store/truststore.cc
+===================================================================
+--- pulseaudio.orig/src/modules/trust-store/truststore.cc
++++ pulseaudio/src/modules/trust-store/truststore.cc
 @@ -4,6 +4,7 @@
  
  #include <memory>
@@ -106,6 +106,3 @@ index ee09038..8645ce5 100644
      delete ts;
  }
  
--- 
-2.1.4
-
diff --git a/debian/patches/0415-dynarray-Add-PA_DYNARRAY_FOREACH.patch b/debian/patches/0415-dynarray-Add-PA_DYNARRAY_FOREACH.patch
deleted file mode 100644
index 459d9a8..0000000
--- a/debian/patches/0415-dynarray-Add-PA_DYNARRAY_FOREACH.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-From 360cb6550e6558606091ac8c64028ed9872ba6f9 Mon Sep 17 00:00:00 2001
-From: Tanu Kaskinen <tanu.kaskinen at linux.intel.com>
-Date: Wed, 7 Jan 2015 16:56:50 +0200
-Subject: [PATCH 4/4] dynarray: Add PA_DYNARRAY_FOREACH
-
-The PA_DYNARRAY_FOREACH macro requires that pa_dynarray_get() returns
-NULL if the index is out of bounds.
----
- src/pulsecore/dynarray.c  | 4 +++-
- src/pulsecore/dynarray.h  | 5 +++++
- src/pulsecore/tokenizer.c | 3 ---
- 3 files changed, 8 insertions(+), 4 deletions(-)
-
-Index: pulseaudio/src/pulsecore/dynarray.c
-===================================================================
---- pulseaudio.orig/src/pulsecore/dynarray.c	2015-08-27 17:22:56.068175130 +0200
-+++ pulseaudio/src/pulsecore/dynarray.c	2015-08-27 17:22:56.060175027 +0200
-@@ -72,7 +72,9 @@
- 
- void *pa_dynarray_get(pa_dynarray *array, unsigned i) {
-     pa_assert(array);
--    pa_assert(i < array->n_entries);
-+
-+    if (i >= array->n_entries)
-+        return NULL;
- 
-     return array->data[i];
- }
-Index: pulseaudio/src/pulsecore/dynarray.h
-===================================================================
---- pulseaudio.orig/src/pulsecore/dynarray.h	2015-08-27 17:22:56.068175130 +0200
-+++ pulseaudio/src/pulsecore/dynarray.h	2015-08-27 17:22:56.060175027 +0200
-@@ -46,6 +46,8 @@
- void pa_dynarray_free(pa_dynarray *array);
- 
- void pa_dynarray_append(pa_dynarray *array, void *p);
-+
-+/* Returns the element at index i, or NULL if i is out of bounds. */
- void *pa_dynarray_get(pa_dynarray *array, unsigned i);
- 
- /* Returns the removed item, or NULL if the array is empty. */
-@@ -53,4 +55,7 @@
- 
- unsigned pa_dynarray_size(pa_dynarray *array);
- 
-+#define PA_DYNARRAY_FOREACH(elem, array, idx) \
-+    for ((idx) = 0; ((elem) = pa_dynarray_get(array, idx)); (idx)++)
-+
- #endif
-Index: pulseaudio/src/pulsecore/tokenizer.c
-===================================================================
---- pulseaudio.orig/src/pulsecore/tokenizer.c	2015-08-27 17:22:56.068175130 +0200
-+++ pulseaudio/src/pulsecore/tokenizer.c	2015-08-27 17:22:56.060175027 +0200
-@@ -78,8 +78,5 @@
- 
-     pa_assert(a);
- 
--    if (i >= pa_dynarray_size(a))
--        return NULL;
--
-     return pa_dynarray_get(a, i);
- }
diff --git a/debian/patches/0417-increase-timeout-check-apparmor.patch b/debian/patches/0417-increase-timeout-check-apparmor.patch
index 5dd2c8a..59ca09e 100644
--- a/debian/patches/0417-increase-timeout-check-apparmor.patch
+++ b/debian/patches/0417-increase-timeout-check-apparmor.patch
@@ -1,5 +1,7 @@
---- a/src/modules/trust-store/module-trust-store.c
-+++ b/src/modules/trust-store/module-trust-store.c
+Index: pulseaudio/src/modules/trust-store/module-trust-store.c
+===================================================================
+--- pulseaudio.orig/src/modules/trust-store/module-trust-store.c
++++ pulseaudio/src/modules/trust-store/module-trust-store.c
 @@ -31,6 +31,8 @@
  #include <pulsecore/dynarray.h>
  #include <pulse/mainloop-api.h>
@@ -9,7 +11,7 @@
  #include "module-trust-store-symdef.h"
  
  PA_MODULE_AUTHOR("David Henningsson");
-@@ -76,9 +78,37 @@
+@@ -77,9 +79,37 @@ static struct per_client *per_client_new
      }
  
      pc = pa_xnew0(struct per_client, 1);
@@ -50,7 +52,7 @@
      pc->index = client_index;
      pc->uid = client->creds.uid;
      pc->pid = client->creds.pid;
-@@ -102,10 +132,25 @@
+@@ -103,10 +133,25 @@ static void per_client_free_from_hashmap
  static void thread_func(void *data) {
      struct per_client *pc = data;
  
@@ -79,9 +81,11 @@
      pa_fdsem_post(pc->userdata->fdsem);
  }
  
---- a/src/Makefile.am
-+++ b/src/Makefile.am
-@@ -2122,7 +2122,7 @@
+Index: pulseaudio/src/Makefile.am
+===================================================================
+--- pulseaudio.orig/src/Makefile.am
++++ pulseaudio/src/Makefile.am
+@@ -2132,7 +2132,7 @@ libtruststore_util_la_LIBADD = libpulsec
  libtruststore_util_la_LDFLAGS = -avoid-version
  
  module_trust_store_la_SOURCES = modules/trust-store/module-trust-store.c
diff --git a/debian/patches/series b/debian/patches/series
index 6b5c50c..c21d8ef 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -6,7 +6,6 @@
 0016-nodisplay-autostart.patch
 0022-inotify-wrapper-Quit-daemon-if-pid-file-is-removed.patch
 0023-fixing_snd_mixer_poll_descriptors_count_when_zero.patch
-0099-pa_yes_no.patch
 
 # Ubuntu touch stuff
 0202-dont-probe-ucm.patch
@@ -18,26 +17,10 @@
 0210-module-device-restore-adding-property-to-skip.patch
 0211-corking-a-sink-input-stream-when-stalled.patch
 
-# add lfe filter patchset
-0300-lfe-filter-Import-code-from-the-Chrome-OS-audio-serv.patch
-0301-lfe-filter-Enable-LFE-filter-in-the-resampler.patch
-0302-lfe-filter-Cleanup-and-refactor.patch
-0303-lfe-filter-change-the-crossover-frequency-as-a-param.patch
-0304-memblock-Change-pa_memblock_new_malloced-to-an-inlin.patch
-0305-lfe-filter-Add-rewind-support.patch
-0306-resampler-Make-some-basic-functions-for-rewinding.patch
-0307-tests-adding-lfe-filter-test.patch
-0308-daemon-conf-enable-the-lfe-remixing-by-default.patch
-0309-resampler-Allow-disabling-the-LFE-filter-by-setting-.patch
-0310-resampler-Rename-lfe_filter_required-to-lfe_remixed.patch
-0311-tests-add-tolerant-variation-for-comparing-the-rewin.patch
-0312-lfe-filter-test-Use-S16NE-format.patch
-
 # Ubuntu touch: support for trust-store
 0406-tagstruct-add-copy-method.patch
 0407-access-Add-access-control-hooks.patch
 0408-protocol-native-add-access-checks.patch
 0409-Trust-store-patch.patch
 0410-Add-thread-to-activate-trust-store-interface.patch
-0415-dynarray-Add-PA_DYNARRAY_FOREACH.patch
 0417-increase-timeout-check-apparmor.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-pulseaudio/pulseaudio.git



More information about the pkg-pulseaudio-devel mailing list