aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYannick Gicquel <yannick.gicquel@iot.bzh>2016-10-03 16:57:59 +0200
committerYannick Gicquel <yannick.gicquel@iot.bzh>2016-10-03 17:37:22 +0200
commita43a56b5a2db1a351f95d18fb328447055299367 (patch)
treeded7e7c5d15b1af16d08bb1d12f13daa9b905076
parent5dae1a2f483d8e111d5603528853c2e441136742 (diff)
pulseaudio: add volumeramp patchset
Those patchs are a rebased version of patchset: https://lists.freedesktop.org/archives/pulseaudio-discuss/2016-August/026797.html Change-Id: I367686217a2af409c46c2aab0be62c01a058d2f1 Signed-off-by: Yannick Gicquel <yannick.gicquel@iot.bzh>
-rw-r--r--meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-8.0/0001-install-files-for-a-module-development.patch78
-rw-r--r--meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-8.0/0002-volume-ramp-additions-to-the-low-level-infra.patch566
-rw-r--r--meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-8.0/0003-volume-ramp-adding-volume-ramping-to-sink-input.patch189
-rw-r--r--meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-8.0/0004-sink-input-Code-cleanup-regarding-volume-ramping.patch62
-rw-r--r--meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-8.0/0005-sink-input-volume-Add-support-for-volume-ramp-factor.patch299
-rw-r--r--meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-8.0/0006-sink-input-Remove-pa_sink_input_set_volume_ramp.patch63
-rw-r--r--meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio_8.0.bbappend26
7 files changed, 1267 insertions, 16 deletions
diff --git a/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-8.0/0001-install-files-for-a-module-development.patch b/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-8.0/0001-install-files-for-a-module-development.patch
new file mode 100644
index 000000000..8c5f9efd4
--- /dev/null
+++ b/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-8.0/0001-install-files-for-a-module-development.patch
@@ -0,0 +1,78 @@
+From 53281e2d11f84e2dae0704e0167369710ee2cb30 Mon Sep 17 00:00:00 2001
+From: Yannick Gicquel <yannick.gicquel@iot.bzh>
+Date: Fri, 23 Sep 2016 14:26:03 +0200
+Subject: [PATCH 1/6] install files for a module development
+
+Signed-off-by: Yannick Gicquel <yannick.gicquel@iot.bzh>
+---
+ Makefile.am | 14 +++++++++++++-
+ configure.ac | 1 +
+ pulseaudio-module-devel.pc.in | 12 ++++++++++++
+ 3 files changed, 26 insertions(+), 1 deletion(-)
+ create mode 100644 pulseaudio-module-devel.pc.in
+
+diff --git a/Makefile.am b/Makefile.am
+index 13bc469..f0d68a2 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -53,7 +53,16 @@ dist_vapi_DATA = \
+ vala/libpulse-simple.deps vala/libpulse-simple.vapi
+
+ pkgconfigdir = $(libdir)/pkgconfig
+-pkgconfig_DATA = libpulse.pc libpulse-simple.pc
++pkgconfig_DATA = libpulse.pc libpulse-simple.pc pulseaudio-module-devel.pc
++
++moduledev_DATA = pulsecore-config.h $(top_srcdir)/src/pulsecore/*.h
++moduledevdir = $(includedir)/pulsemodule/pulsecore
++
++moduledevfilter_DATA = $(top_srcdir)/src/pulsecore/filter/*.h
++moduledevfilterdir = $(includedir)/pulsemodule/pulsecore/filter
++
++moduledevinternal_DATA = src/pulse/internal.h src/pulse/client-conf.h src/pulse/fork-detect.h
++moduledevinternaldir = $(includedir)/pulsemodule/pulse
+
+ if HAVE_GLIB20
+ pkgconfig_DATA += \
+@@ -107,6 +116,9 @@ dist-hook:
+ check-daemon:
+ $(MAKE) -C src check-daemon
+
++pulsecore-config.h: config.h
++ cp $< $@
++
+ .PHONY: homepage distcleancheck doxygen
+
+ # see git-version-gen
+diff --git a/configure.ac b/configure.ac
+index 9250c05..f9201ee 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1502,6 +1502,7 @@ man/pulse-client.conf.5.xml
+ man/default.pa.5.xml
+ man/pulse-cli-syntax.5.xml
+ man/start-pulseaudio-x11.1.xml
++pulseaudio-module-devel.pc
+ ])
+
+ AC_CONFIG_FILES([src/esdcompat:src/daemon/esdcompat.in], [chmod +x src/esdcompat])
+diff --git a/pulseaudio-module-devel.pc.in b/pulseaudio-module-devel.pc.in
+new file mode 100644
+index 0000000..85aadbc
+--- /dev/null
++++ b/pulseaudio-module-devel.pc.in
+@@ -0,0 +1,12 @@
++prefix=@prefix@
++exec_prefix=@exec_prefix@
++libdir=@libdir@
++includedir=@includedir@
++modlibexecdir=@modlibexecdir@
++
++Name: pulseaudio-module-devel
++Description: PulseAudio Module Development Interface
++Version: @PACKAGE_VERSION@
++Libs: -L${libdir} -L${libdir}/pulseaudio -L${modlibexecdir} -lpulsecommon-@PA_MAJORMINOR@ -lpulsecore-@PA_MAJORMINOR@ -lprotocol-native
++Libs.private:
++Cflags: -I${includedir}/pulsemodule -D_REENTRANT
+--
+1.9.1
+
diff --git a/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-8.0/0002-volume-ramp-additions-to-the-low-level-infra.patch b/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-8.0/0002-volume-ramp-additions-to-the-low-level-infra.patch
new file mode 100644
index 000000000..9cee6f5de
--- /dev/null
+++ b/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-8.0/0002-volume-ramp-additions-to-the-low-level-infra.patch
@@ -0,0 +1,566 @@
+From 7757059ffc6e63ea20ba9013682d72d619e7aefc Mon Sep 17 00:00:00 2001
+From: Sangchul Lee <sangchul1011@gmail.com>
+Date: Sat, 27 Aug 2016 21:33:16 +0900
+Subject: [PATCH 2/6] volume ramp: additions to the low level infra
+
+The original patch is
+ - https://review.tizen.org/git/?p=platform/upstream/pulseaudio.git;a=commit;h=df1c4275ed79e0b708c75b92f9d247e0492bc1f0
+ - by Jaska Uimonen <jaska.uimonen <at> helsinki.fi>
+
+Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
+---
+ src/map-file | 4 +
+ src/pulse/def.h | 13 ++-
+ src/pulse/volume.c | 74 ++++++++++++-
+ src/pulse/volume.h | 33 ++++++
+ src/pulsecore/mix.c | 310 ++++++++++++++++++++++++++++++++++++++++++++++++++++
+ src/pulsecore/mix.h | 27 +++++
+ 6 files changed, 459 insertions(+), 2 deletions(-)
+
+diff --git a/src/map-file b/src/map-file
+index 93a62b8..ef9b57d 100644
+--- a/src/map-file
++++ b/src/map-file
+@@ -138,6 +138,10 @@ pa_cvolume_max_mask;
+ pa_cvolume_merge;
+ pa_cvolume_min;
+ pa_cvolume_min_mask;
++pa_cvolume_ramp_equal;
++pa_cvolume_ramp_init;
++pa_cvolume_ramp_set;
++pa_cvolume_ramp_channel_ramp_set;
+ pa_cvolume_remap;
+ pa_cvolume_scale;
+ pa_cvolume_scale_mask;
+diff --git a/src/pulse/def.h b/src/pulse/def.h
+index 680bdc9..bc3cedd 100644
+--- a/src/pulse/def.h
++++ b/src/pulse/def.h
+@@ -347,11 +347,15 @@ typedef enum pa_stream_flags {
+ * consider absolute when the sink is in flat volume mode,
+ * relative otherwise. \since 0.9.20 */
+
+- PA_STREAM_PASSTHROUGH = 0x80000U
++ PA_STREAM_PASSTHROUGH = 0x80000U,
+ /**< Used to tag content that will be rendered by passthrough sinks.
+ * The data will be left as is and not reformatted, resampled.
+ * \since 1.0 */
+
++ PA_STREAM_START_RAMP_MUTED = 0x100000U
++ /**< Used to tag content that the stream will be started ramp volume
++ * muted so that you can nicely fade it in */
++
+ } pa_stream_flags_t;
+
+ /** \cond fulldocs */
+@@ -380,6 +384,7 @@ typedef enum pa_stream_flags {
+ #define PA_STREAM_FAIL_ON_SUSPEND PA_STREAM_FAIL_ON_SUSPEND
+ #define PA_STREAM_RELATIVE_VOLUME PA_STREAM_RELATIVE_VOLUME
+ #define PA_STREAM_PASSTHROUGH PA_STREAM_PASSTHROUGH
++#define PA_STREAM_START_RAMP_MUTED PA_STREAM_START_RAMP_MUTED
+
+ /** \endcond */
+
+@@ -1047,6 +1052,12 @@ typedef enum pa_port_available {
+ /** \endcond */
+ #endif
+
++/** \cond fulldocs */
++#define PA_VOLUMER_RAMP_TYPE_LINEAR PA_VOLUMER_RAMP_TYPE_LINEAR
++#define PA_VOLUMER_RAMP_TYPE_LOGARITHMIC PA_VOLUMER_RAMP_TYPE_LOGARITHMIC
++#define PA_VOLUMER_RAMP_TYPE_CUBIC PA_VOLUMER_RAMP_TYPE_CUBIC
++/** \endcond */
++
+ PA_C_DECL_END
+
+ #endif
+diff --git a/src/pulse/volume.c b/src/pulse/volume.c
+index 1667b94..85072c1 100644
+--- a/src/pulse/volume.c
++++ b/src/pulse/volume.c
+@@ -445,7 +445,10 @@ int pa_cvolume_channels_equal_to(const pa_cvolume *a, pa_volume_t v) {
+ unsigned c;
+ pa_assert(a);
+
+- pa_return_val_if_fail(pa_cvolume_valid(a), 0);
++ if (pa_cvolume_valid(a) == 0)
++ abort();
++
++ /* pa_return_val_if_fail(pa_cvolume_valid(a), 0); */
+ pa_return_val_if_fail(PA_VOLUME_IS_VALID(v), 0);
+
+ for (c = 0; c < a->channels; c++)
+@@ -977,3 +980,72 @@ pa_cvolume* pa_cvolume_dec(pa_cvolume *v, pa_volume_t dec) {
+
+ return pa_cvolume_scale(v, m);
+ }
++
++int pa_cvolume_ramp_equal(const pa_cvolume_ramp *a, const pa_cvolume_ramp *b) {
++ int i;
++ pa_assert(a);
++ pa_assert(b);
++
++ if (PA_UNLIKELY(a == b))
++ return 1;
++
++ if (a->channels != b->channels)
++ return 0;
++
++ for (i = 0; i < a->channels; i++) {
++ if (a->ramps[i].type != b->ramps[i].type ||
++ a->ramps[i].length != b->ramps[i].length ||
++ a->ramps[i].target != b->ramps[i].target)
++ return 0;
++ }
++
++ return 1;
++}
++
++pa_cvolume_ramp* pa_cvolume_ramp_init(pa_cvolume_ramp *ramp) {
++ unsigned c;
++
++ pa_assert(ramp);
++
++ ramp->channels = 0;
++
++ for (c = 0; c < PA_CHANNELS_MAX; c++) {
++ ramp->ramps[c].type = PA_VOLUME_RAMP_TYPE_LINEAR;
++ ramp->ramps[c].length = 0;
++ ramp->ramps[c].target = PA_VOLUME_INVALID;
++ }
++
++ return ramp;
++}
++
++pa_cvolume_ramp* pa_cvolume_ramp_set(pa_cvolume_ramp *ramp, unsigned channels, pa_volume_ramp_type_t type, long time, pa_volume_t vol) {
++ int i;
++
++ pa_assert(ramp);
++ pa_assert(channels > 0);
++ pa_assert(time >= 0);
++ pa_assert(channels <= PA_CHANNELS_MAX);
++
++ ramp->channels = (uint8_t) channels;
++
++ for (i = 0; i < ramp->channels; i++) {
++ ramp->ramps[i].type = type;
++ ramp->ramps[i].length = time;
++ ramp->ramps[i].target = PA_CLAMP_VOLUME(vol);
++ }
++
++ return ramp;
++}
++
++pa_cvolume_ramp* pa_cvolume_ramp_channel_ramp_set(pa_cvolume_ramp *ramp, unsigned channel, pa_volume_ramp_type_t type, long time, pa_volume_t vol) {
++
++ pa_assert(ramp);
++ pa_assert(channel <= ramp->channels);
++ pa_assert(time >= 0);
++
++ ramp->ramps[channel].type = type;
++ ramp->ramps[channel].length = time;
++ ramp->ramps[channel].target = PA_CLAMP_VOLUME(vol);
++
++ return ramp;
++}
+diff --git a/src/pulse/volume.h b/src/pulse/volume.h
+index 8cf4fa4..2ae3451 100644
+--- a/src/pulse/volume.h
++++ b/src/pulse/volume.h
+@@ -431,6 +431,39 @@ pa_cvolume* pa_cvolume_inc(pa_cvolume *v, pa_volume_t inc);
+ * the channels are kept. \since 0.9.16 */
+ pa_cvolume* pa_cvolume_dec(pa_cvolume *v, pa_volume_t dec);
+
++/** Volume ramp type
++*/
++typedef enum pa_volume_ramp_type {
++ PA_VOLUME_RAMP_TYPE_LINEAR = 0, /**< linear */
++ PA_VOLUME_RAMP_TYPE_LOGARITHMIC = 1, /**< logarithmic */
++ PA_VOLUME_RAMP_TYPE_CUBIC = 2,
++} pa_volume_ramp_type_t;
++
++/** A structure encapsulating a volume ramp */
++typedef struct pa_volume_ramp_t {
++ pa_volume_ramp_type_t type;
++ long length;
++ pa_volume_t target;
++} pa_volume_ramp_t;
++
++/** A structure encapsulating a multichannel volume ramp */
++typedef struct pa_cvolume_ramp {
++ uint8_t channels;
++ pa_volume_ramp_t ramps[PA_CHANNELS_MAX];
++} pa_cvolume_ramp;
++
++/** Return non-zero when *a == *b */
++int pa_cvolume_ramp_equal(const pa_cvolume_ramp *a, const pa_cvolume_ramp *b);
++
++/** Init volume ramp struct */
++pa_cvolume_ramp* pa_cvolume_ramp_init(pa_cvolume_ramp *ramp);
++
++/** Set first n channels of ramp struct to certain value */
++pa_cvolume_ramp* pa_cvolume_ramp_set(pa_cvolume_ramp *ramp, unsigned channel, pa_volume_ramp_type_t type, long time, pa_volume_t vol);
++
++/** Set individual channel in the channel struct */
++pa_cvolume_ramp* pa_cvolume_ramp_channel_ramp_set(pa_cvolume_ramp *ramp, unsigned channel, pa_volume_ramp_type_t type, long time, pa_volume_t vol);
++
+ PA_C_DECL_END
+
+ #endif
+diff --git a/src/pulsecore/mix.c b/src/pulsecore/mix.c
+index 59622d7..1e4cc1e 100644
+--- a/src/pulsecore/mix.c
++++ b/src/pulsecore/mix.c
+@@ -724,3 +724,313 @@ void pa_volume_memchunk(
+
+ pa_memblock_release(c->memblock);
+ }
++
++static void calc_linear_integer_volume_no_mapping(int32_t linear[], float volume[], unsigned nchannels) {
++ unsigned channel, padding;
++
++ pa_assert(linear);
++ pa_assert(volume);
++
++ for (channel = 0; channel < nchannels; channel++)
++ linear[channel] = (int32_t) lrint(volume[channel] * 0x10000U);
++
++ for (padding = 0; padding < VOLUME_PADDING; padding++, channel++)
++ linear[channel] = linear[padding];
++}
++
++static void calc_linear_float_volume_no_mapping(float linear[], float volume[], unsigned nchannels) {
++ unsigned channel, padding;
++
++ pa_assert(linear);
++ pa_assert(volume);
++
++ for (channel = 0; channel < nchannels; channel++)
++ linear[channel] = volume[channel];
++
++ for (padding = 0; padding < VOLUME_PADDING; padding++, channel++)
++ linear[channel] = linear[padding];
++}
++
++typedef void (*pa_calc_volume_no_mapping_func_t) (void *volumes, float *volume, int channels);
++
++static const pa_calc_volume_no_mapping_func_t calc_volume_table_no_mapping[] = {
++ [PA_SAMPLE_U8] = (pa_calc_volume_no_mapping_func_t) calc_linear_integer_volume_no_mapping,
++ [PA_SAMPLE_ALAW] = (pa_calc_volume_no_mapping_func_t) calc_linear_integer_volume_no_mapping,
++ [PA_SAMPLE_ULAW] = (pa_calc_volume_no_mapping_func_t) calc_linear_integer_volume_no_mapping,
++ [PA_SAMPLE_S16LE] = (pa_calc_volume_no_mapping_func_t) calc_linear_integer_volume_no_mapping,
++ [PA_SAMPLE_S16BE] = (pa_calc_volume_no_mapping_func_t) calc_linear_integer_volume_no_mapping,
++ [PA_SAMPLE_FLOAT32LE] = (pa_calc_volume_no_mapping_func_t) calc_linear_float_volume_no_mapping,
++ [PA_SAMPLE_FLOAT32BE] = (pa_calc_volume_no_mapping_func_t) calc_linear_float_volume_no_mapping,
++ [PA_SAMPLE_S32LE] = (pa_calc_volume_no_mapping_func_t) calc_linear_integer_volume_no_mapping,
++ [PA_SAMPLE_S32BE] = (pa_calc_volume_no_mapping_func_t) calc_linear_integer_volume_no_mapping,
++ [PA_SAMPLE_S24LE] = (pa_calc_volume_no_mapping_func_t) calc_linear_integer_volume_no_mapping,
++ [PA_SAMPLE_S24BE] = (pa_calc_volume_no_mapping_func_t) calc_linear_integer_volume_no_mapping,
++ [PA_SAMPLE_S24_32LE] = (pa_calc_volume_no_mapping_func_t) calc_linear_integer_volume_no_mapping,
++ [PA_SAMPLE_S24_32BE] = (pa_calc_volume_no_mapping_func_t) calc_linear_integer_volume_no_mapping
++};
++
++static const unsigned format_sample_size_table[] = {
++ [PA_SAMPLE_U8] = 1,
++ [PA_SAMPLE_ALAW] = 1,
++ [PA_SAMPLE_ULAW] = 1,
++ [PA_SAMPLE_S16LE] = 2,
++ [PA_SAMPLE_S16BE] = 2,
++ [PA_SAMPLE_FLOAT32LE] = 4,
++ [PA_SAMPLE_FLOAT32BE] = 4,
++ [PA_SAMPLE_S32LE] = 4,
++ [PA_SAMPLE_S32BE] = 4,
++ [PA_SAMPLE_S24LE] = 3,
++ [PA_SAMPLE_S24BE] = 3,
++ [PA_SAMPLE_S24_32LE] = 4,
++ [PA_SAMPLE_S24_32BE] = 4
++};
++
++static float calc_volume_ramp_linear(pa_volume_ramp_int_t *ramp) {
++ pa_assert(ramp);
++ pa_assert(ramp->length > 0);
++
++ /* basic linear interpolation */
++ return ramp->start + (ramp->length - ramp->left) * (ramp->end - ramp->start) / (float) ramp->length;
++}
++
++static float calc_volume_ramp_logarithmic(pa_volume_ramp_int_t *ramp) {
++ float x_val, s, e;
++ long temp;
++
++ pa_assert(ramp);
++ pa_assert(ramp->length > 0);
++
++ if (ramp->end > ramp->start) {
++ temp = ramp->left;
++ s = ramp->end;
++ e = ramp->start;
++ } else {
++ temp = ramp->length - ramp->left;
++ s = ramp->start;
++ e = ramp->end;
++ }
++
++ x_val = temp == 0 ? 0.0 : powf(temp, 10);
++
++ /* base 10 logarithmic interpolation */
++ return s + x_val * (e - s) / powf(ramp->length, 10);
++}
++
++static float calc_volume_ramp_cubic(pa_volume_ramp_int_t *ramp) {
++ float x_val, s, e;
++ long temp;
++
++ pa_assert(ramp);
++ pa_assert(ramp->length > 0);
++
++ if (ramp->end > ramp->start) {
++ temp = ramp->left;
++ s = ramp->end;
++ e = ramp->start;
++ } else {
++ temp = ramp->length - ramp->left;
++ s = ramp->start;
++ e = ramp->end;
++ }
++
++ x_val = temp == 0 ? 0.0 : cbrtf(temp);
++
++ /* cubic interpolation */
++ return s + x_val * (e - s) / cbrtf(ramp->length);
++}
++
++typedef float (*pa_calc_volume_ramp_func_t) (pa_volume_ramp_int_t *);
++
++static const pa_calc_volume_ramp_func_t calc_volume_ramp_table[] = {
++ [PA_VOLUME_RAMP_TYPE_LINEAR] = (pa_calc_volume_ramp_func_t) calc_volume_ramp_linear,
++ [PA_VOLUME_RAMP_TYPE_LOGARITHMIC] = (pa_calc_volume_ramp_func_t) calc_volume_ramp_logarithmic,
++ [PA_VOLUME_RAMP_TYPE_CUBIC] = (pa_calc_volume_ramp_func_t) calc_volume_ramp_cubic
++};
++
++static void calc_volume_ramps(pa_cvolume_ramp_int *ram, float *vol)
++{
++ int i;
++
++ for (i = 0; i < ram->channels; i++) {
++ if (ram->ramps[i].left <= 0) {
++ if (ram->ramps[i].target == PA_VOLUME_NORM) {
++ vol[i] = 1.0;
++ }
++ } else {
++ vol[i] = ram->ramps[i].curr = calc_volume_ramp_table[ram->ramps[i].type] (&ram->ramps[i]);
++ ram->ramps[i].left--;
++ }
++ }
++}
++
++void pa_volume_ramp_memchunk(
++ pa_memchunk *c,
++ const pa_sample_spec *spec,
++ pa_cvolume_ramp_int *ramp) {
++
++ void *ptr;
++ volume_val linear[PA_CHANNELS_MAX + VOLUME_PADDING];
++ float vol[PA_CHANNELS_MAX + VOLUME_PADDING];
++ pa_do_volume_func_t do_volume;
++ long length_in_frames;
++ int i;
++
++ pa_assert(c);
++ pa_assert(spec);
++ pa_assert(pa_frame_aligned(c->length, spec));
++ pa_assert(ramp);
++
++ length_in_frames = c->length / format_sample_size_table[spec->format] / spec->channels;
++
++ if (pa_memblock_is_silence(c->memblock)) {
++ for (i = 0; i < ramp->channels; i++) {
++ if (ramp->ramps[i].length > 0)
++ ramp->ramps[i].length -= length_in_frames;
++ }
++ return;
++ }
++
++ if (spec->format < 0 || spec->format >= PA_SAMPLE_MAX) {
++ pa_log_warn("Unable to change volume of format");
++ return;
++ }
++
++ do_volume = pa_get_volume_func(spec->format);
++ pa_assert(do_volume);
++
++ ptr = (uint8_t*) pa_memblock_acquire(c->memblock) + c->index;
++
++ for (i = 0; i < length_in_frames; i++) {
++ calc_volume_ramps(ramp, vol);
++ calc_volume_table_no_mapping[spec->format] ((void *)linear, vol, spec->channels);
++
++ /* we only process one frame per iteration */
++ do_volume (ptr, (void *)linear, spec->channels, format_sample_size_table[spec->format] * spec->channels);
++
++ /* pa_log_debug("1: %d 2: %d", linear[0], linear[1]); */
++
++ ptr = (uint8_t*)ptr + format_sample_size_table[spec->format] * spec->channels;
++ }
++
++ pa_memblock_release(c->memblock);
++}
++
++pa_cvolume_ramp_int* pa_cvolume_ramp_convert(const pa_cvolume_ramp *src, pa_cvolume_ramp_int *dst, int sample_rate) {
++
++ int i, j, channels, remaining_channels;
++ float temp;
++
++ if (dst->channels < src->channels) {
++ channels = dst->channels;
++ remaining_channels = 0;
++ }
++ else {
++ channels = src->channels;
++ remaining_channels = dst->channels;
++ }
++
++ for (i = 0; i < channels; i++) {
++ dst->ramps[i].type = src->ramps[i].type;
++ /* ms to samples */
++ dst->ramps[i].length = src->ramps[i].length * sample_rate / 1000;
++ dst->ramps[i].left = dst->ramps[i].length;
++ dst->ramps[i].start = dst->ramps[i].end;
++ dst->ramps[i].target = src->ramps[i].target;
++ /* scale to pulse internal mapping so that when ramp is over there's no glitch in volume */
++ temp = src->ramps[i].target / (float)0x10000U;
++ dst->ramps[i].end = temp * temp * temp;
++ }
++
++ j = i;
++
++ for (i--; j < remaining_channels; j++) {
++ dst->ramps[j].type = dst->ramps[i].type;
++ dst->ramps[j].length = dst->ramps[i].length;
++ dst->ramps[j].left = dst->ramps[i].left;
++ dst->ramps[j].start = dst->ramps[i].start;
++ dst->ramps[j].target = dst->ramps[i].target;
++ dst->ramps[j].end = dst->ramps[i].end;
++ }
++
++ return dst;
++}
++
++bool pa_cvolume_ramp_active(pa_cvolume_ramp_int *ramp) {
++ int i;
++
++ for (i = 0; i < ramp->channels; i++) {
++ if (ramp->ramps[i].left > 0)
++ return true;
++ }
++
++ return false;
++}
++
++bool pa_cvolume_ramp_target_active(pa_cvolume_ramp_int *ramp) {
++ int i;
++
++ for (i = 0; i < ramp->channels; i++) {
++ if (ramp->ramps[i].target != PA_VOLUME_NORM)
++ return true;
++ }
++
++ return false;
++}
++
++pa_cvolume * pa_cvolume_ramp_get_targets(pa_cvolume_ramp_int *ramp, pa_cvolume *volume) {
++ int i = 0;
++
++ volume->channels = ramp->channels;
++
++ for (i = 0; i < ramp->channels; i++)
++ volume->values[i] = ramp->ramps[i].target;
++
++ return volume;
++}
++
++pa_cvolume_ramp_int* pa_cvolume_ramp_start_from(pa_cvolume_ramp_int *src, pa_cvolume_ramp_int *dst) {
++ int i;
++
++ for (i = 0; i < src->channels; i++) {
++ /* if new vols are invalid, copy old ramp i.e. no effect */
++ if (dst->ramps[i].target == PA_VOLUME_INVALID)
++ dst->ramps[i] = src->ramps[i];
++ /* if there's some old ramp still left */
++ else if (src->ramps[i].left > 0)
++ dst->ramps[i].start = src->ramps[i].curr;
++ }
++
++ return dst;
++}
++
++pa_cvolume_ramp_int* pa_cvolume_ramp_int_init(pa_cvolume_ramp_int *src, pa_volume_t vol, int channels) {
++ int i;
++ float temp;
++
++ src->channels = channels;
++
++ for (i = 0; i < channels; i++) {
++ src->ramps[i].type = PA_VOLUME_RAMP_TYPE_LINEAR;
++ src->ramps[i].length = 0;
++ src->ramps[i].left = 0;
++ if (vol == PA_VOLUME_NORM) {
++ src->ramps[i].start = 1.0;
++ src->ramps[i].end = 1.0;
++ src->ramps[i].curr = 1.0;
++ }
++ else if (vol == PA_VOLUME_MUTED) {
++ src->ramps[i].start = 0.0;
++ src->ramps[i].end = 0.0;
++ src->ramps[i].curr = 0.0;
++ }
++ else {
++ temp = vol / (float)0x10000U;
++ src->ramps[i].start = temp * temp * temp;
++ src->ramps[i].end = src->ramps[i].start;
++ src->ramps[i].curr = src->ramps[i].start;
++ }
++ src->ramps[i].target = vol;
++ }
++
++ return src;
++}
+diff --git a/src/pulsecore/mix.h b/src/pulsecore/mix.h
+index 8102bcd..0f86b6f 100644
+--- a/src/pulsecore/mix.h
++++ b/src/pulsecore/mix.h
+@@ -59,4 +59,31 @@ void pa_volume_memchunk(
+ const pa_sample_spec *spec,
+ const pa_cvolume *volume);
+
++typedef struct pa_volume_ramp_int_t {
++ pa_volume_ramp_type_t type;
++ long length;
++ long left;
++ float start;
++ float end;
++ float curr;
++ pa_volume_t target;
++} pa_volume_ramp_int_t;
++
++typedef struct pa_cvolume_ramp_int {
++ uint8_t channels;
++ pa_volume_ramp_int_t ramps[PA_CHANNELS_MAX];
++} pa_cvolume_ramp_int;
++
++pa_cvolume_ramp_int* pa_cvolume_ramp_convert(const pa_cvolume_ramp *src, pa_cvolume_ramp_int *dst, int sample_rate);
++bool pa_cvolume_ramp_active(pa_cvolume_ramp_int *ramp);
++bool pa_cvolume_ramp_target_active(pa_cvolume_ramp_int *ramp);
++pa_cvolume_ramp_int* pa_cvolume_ramp_start_from(pa_cvolume_ramp_int *src, pa_cvolume_ramp_int *dst);
++pa_cvolume_ramp_int* pa_cvolume_ramp_int_init(pa_cvolume_ramp_int *src, pa_volume_t vol, int channels);
++pa_cvolume * pa_cvolume_ramp_get_targets(pa_cvolume_ramp_int *ramp, pa_cvolume *volume);
++
++void pa_volume_ramp_memchunk(
++ pa_memchunk *c,
++ const pa_sample_spec *spec,
++ pa_cvolume_ramp_int *ramp);
++
+ #endif
+--
+1.9.1
+
diff --git a/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-8.0/0003-volume-ramp-adding-volume-ramping-to-sink-input.patch b/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-8.0/0003-volume-ramp-adding-volume-ramping-to-sink-input.patch
new file mode 100644
index 000000000..eb485ca7c
--- /dev/null
+++ b/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-8.0/0003-volume-ramp-adding-volume-ramping-to-sink-input.patch
@@ -0,0 +1,189 @@
+From e4469df7c69316b49cad93dd288badc98fa1cad5 Mon Sep 17 00:00:00 2001
+From: Sangchul Lee <sangchul1011@gmail.com>
+Date: Sat, 27 Aug 2016 21:33:17 +0900
+Subject: [PATCH 3/6] volume ramp: adding volume ramping to sink-input
+
+The original patch is
+ - https://review.tizen.org/git/?p=platform/upstream/pulseaudio.git;a=commit;h=98042248fd67ce0ab3807c5c472c0d5d8b0f99d3
+ - by Jaska Uimonen <jaska.uimonen <at> helsinki.fi>
+
+Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
+---
+ src/pulsecore/sink-input.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++
+ src/pulsecore/sink-input.h | 11 ++++++++-
+ 2 files changed, 71 insertions(+), 1 deletion(-)
+
+diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
+index 8ec63b5..cc8953f 100644
+--- a/src/pulsecore/sink-input.c
++++ b/src/pulsecore/sink-input.c
+@@ -526,6 +526,11 @@ int pa_sink_input_new(
+ reset_callbacks(i);
+ i->userdata = NULL;
+
++ if (data->flags & PA_SINK_INPUT_START_RAMP_MUTED)
++ pa_cvolume_ramp_int_init(&i->ramp, PA_VOLUME_MUTED, data->sample_spec.channels);
++ else
++ pa_cvolume_ramp_int_init(&i->ramp, PA_VOLUME_NORM, data->sample_spec.channels);
++
+ i->thread_info.state = i->state;
+ i->thread_info.attached = false;
+ pa_atomic_store(&i->thread_info.drained, 1);
+@@ -542,6 +547,8 @@ int pa_sink_input_new(
+ i->thread_info.playing_for = 0;
+ i->thread_info.direct_outputs = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
+
++ i->thread_info.ramp = i->ramp;
++
+ pa_assert_se(pa_idxset_put(core->sink_inputs, i, &i->index) == 0);
+ pa_assert_se(pa_idxset_put(i->sink->inputs, pa_sink_input_ref(i), NULL) == 0);
+
+@@ -923,6 +930,8 @@ void pa_sink_input_peek(pa_sink_input *i, size_t slength /* in sink bytes */, pa
+ while (tchunk.length > 0) {
+ pa_memchunk wchunk;
+ bool nvfs = need_volume_factor_sink;
++ pa_cvolume target;
++ pa_bool_t tmp;
+
+ wchunk = tchunk;
+ pa_memblock_ref(wchunk.memblock);
+@@ -959,6 +968,16 @@ void pa_sink_input_peek(pa_sink_input *i, size_t slength /* in sink bytes */, pa
+ pa_volume_memchunk(&wchunk, &i->sink->sample_spec, &i->volume_factor_sink);
+ }
+
++ /* check for possible volume ramp */
++ if (pa_cvolume_ramp_active(&i->thread_info.ramp)) {
++ pa_memchunk_make_writable(&wchunk, 0);
++ pa_volume_ramp_memchunk(&wchunk, &i->sink->sample_spec, &(i->thread_info.ramp));
++ } else if ((tmp = pa_cvolume_ramp_target_active(&(i->thread_info.ramp)))) {
++ pa_memchunk_make_writable(&wchunk, 0);
++ pa_cvolume_ramp_get_targets(&i->thread_info.ramp, &target);
++ pa_volume_memchunk(&wchunk, &i->sink->sample_spec, &target);
++ }
++
+ pa_memblockq_push_align(i->thread_info.render_memblockq, &wchunk);
+ } else {
+ pa_memchunk rchunk;
+@@ -975,6 +994,16 @@ void pa_sink_input_peek(pa_sink_input *i, size_t slength /* in sink bytes */, pa
+ pa_volume_memchunk(&rchunk, &i->sink->sample_spec, &i->volume_factor_sink);
+ }
+
++ /* check for possible volume ramp */
++ if (pa_cvolume_ramp_active(&(i->thread_info.ramp))) {
++ pa_memchunk_make_writable(&rchunk, 0);
++ pa_volume_ramp_memchunk(&rchunk, &i->sink->sample_spec, &(i->thread_info.ramp));
++ } else if (pa_cvolume_ramp_target_active(&(i->thread_info.ramp))) {
++ pa_memchunk_make_writable(&rchunk, 0);
++ pa_cvolume_ramp_get_targets(&i->thread_info.ramp, &target);
++ pa_volume_memchunk(&rchunk, &i->sink->sample_spec, &target);
++ }
++
+ pa_memblockq_push_align(i->thread_info.render_memblockq, &rchunk);
+ pa_memblock_unref(rchunk.memblock);
+ }
+@@ -1339,6 +1368,31 @@ int pa_sink_input_remove_volume_factor(pa_sink_input *i, const char *key) {
+ return 0;
+ }
+
++/* Called from main thread */
++void pa_sink_input_set_volume_ramp(
++ pa_sink_input *i,
++ const pa_cvolume_ramp *ramp,
++ pa_bool_t send_msg,
++ pa_bool_t save) {
++
++ pa_sink_input_assert_ref(i);
++ pa_assert_ctl_context();
++ pa_assert(PA_SINK_INPUT_IS_LINKED(i->state));
++ pa_assert(ramp);
++
++ pa_cvolume_ramp_convert(ramp, &i->ramp, i->sample_spec.rate);
++
++ pa_log_debug("setting volume ramp with target vol:%d and length:%ld",
++ i->ramp.ramps[0].target,
++ i->ramp.ramps[0].length);
++
++
++ /* This tells the sink that volume ramp changed */
++ if (send_msg)
++ pa_assert_se(pa_asyncmsgq_send(i->sink->asyncmsgq, PA_MSGOBJECT(i), PA_SINK_INPUT_MESSAGE_SET_VOLUME_RAMP,
++ NULL, 0, NULL) == 0);
++}
++
+ /* Called from main context */
+ static void set_real_ratio(pa_sink_input *i, const pa_cvolume *v) {
+ pa_sink_input_assert_ref(i);
+@@ -1932,6 +1986,13 @@ int pa_sink_input_process_msg(pa_msgobject *o, int code, void *userdata, int64_t
+ }
+ return 0;
+
++ case PA_SINK_INPUT_MESSAGE_SET_VOLUME_RAMP:
++ /* we have ongoing ramp where we take current start values */
++ pa_cvolume_ramp_start_from(&i->thread_info.ramp, &i->ramp);
++ i->thread_info.ramp = i->ramp;
++ pa_sink_input_request_rewind(i, 0, true, false, false);
++ return 0;
++
+ case PA_SINK_INPUT_MESSAGE_SET_SOFT_MUTE:
+ if (i->thread_info.muted != i->muted) {
+ i->thread_info.muted = i->muted;
+diff --git a/src/pulsecore/sink-input.h b/src/pulsecore/sink-input.h
+index 86deab2..6e1b211 100644
+--- a/src/pulsecore/sink-input.h
++++ b/src/pulsecore/sink-input.h
+@@ -32,6 +32,7 @@
+ #include <pulsecore/client.h>
+ #include <pulsecore/sink.h>
+ #include <pulsecore/core.h>
++#include <pulsecore/mix.h>
+
+ typedef enum pa_sink_input_state {
+ PA_SINK_INPUT_INIT, /*< The stream is not active yet, because pa_sink_input_put() has not been called yet */
+@@ -58,7 +59,8 @@ typedef enum pa_sink_input_flags {
+ PA_SINK_INPUT_DONT_INHIBIT_AUTO_SUSPEND = 256,
+ PA_SINK_INPUT_NO_CREATE_ON_SUSPEND = 512,
+ PA_SINK_INPUT_KILL_ON_SUSPEND = 1024,
+- PA_SINK_INPUT_PASSTHROUGH = 2048
++ PA_SINK_INPUT_PASSTHROUGH = 2048,
++ PA_SINK_INPUT_START_RAMP_MUTED = 4096,
+ } pa_sink_input_flags_t;
+
+ struct pa_sink_input {
+@@ -121,6 +123,9 @@ struct pa_sink_input {
+ * this.*/
+ bool save_sink:1, save_volume:1, save_muted:1;
+
++ /* for volume ramps */
++ pa_cvolume_ramp_int ramp;
++
+ pa_resample_method_t requested_resample_method, actual_resample_method;
+
+ /* Returns the chunk of audio data and drops it from the
+@@ -249,6 +254,8 @@ struct pa_sink_input {
+ pa_usec_t requested_sink_latency;
+
+ pa_hashmap *direct_outputs;
++
++ pa_cvolume_ramp_int ramp;
+ } thread_info;
+
+ void *userdata;
+@@ -265,6 +272,7 @@ enum {
+ PA_SINK_INPUT_MESSAGE_SET_STATE,
+ PA_SINK_INPUT_MESSAGE_SET_REQUESTED_LATENCY,
+ PA_SINK_INPUT_MESSAGE_GET_REQUESTED_LATENCY,
++ PA_SINK_INPUT_MESSAGE_SET_VOLUME_RAMP,
+ PA_SINK_INPUT_MESSAGE_MAX
+ };
+
+@@ -370,6 +378,7 @@ void pa_sink_input_set_volume(pa_sink_input *i, const pa_cvolume *volume, bool s
+ void pa_sink_input_add_volume_factor(pa_sink_input *i, const char *key, const pa_cvolume *volume_factor);
+ int pa_sink_input_remove_volume_factor(pa_sink_input *i, const char *key);
+ pa_cvolume *pa_sink_input_get_volume(pa_sink_input *i, pa_cvolume *volume, bool absolute);
++void pa_sink_input_set_volume_ramp(pa_sink_input *i, const pa_cvolume_ramp *ramp, pa_bool_t send_msg, pa_bool_t save);
+
+ void pa_sink_input_set_mute(pa_sink_input *i, bool mute, bool save);
+
+--
+1.9.1
+
diff --git a/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-8.0/0004-sink-input-Code-cleanup-regarding-volume-ramping.patch b/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-8.0/0004-sink-input-Code-cleanup-regarding-volume-ramping.patch
new file mode 100644
index 000000000..64d7b141d
--- /dev/null
+++ b/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-8.0/0004-sink-input-Code-cleanup-regarding-volume-ramping.patch
@@ -0,0 +1,62 @@
+From 49d8943b151a73be3dd726561a720c0f4bfdccac Mon Sep 17 00:00:00 2001
+From: Sangchul Lee <sangchul1011@gmail.com>
+Date: Sat, 27 Aug 2016 21:33:18 +0900
+Subject: [PATCH 4/6] sink-input: Code cleanup regarding volume ramping
+
+Remove unused parameter of pa_sink_input_set_volume_ramp().
+Use bool instead of pa_bool_t.
+
+Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
+---
+ src/pulsecore/sink-input.c | 7 ++-----
+ src/pulsecore/sink-input.h | 2 +-
+ 2 files changed, 3 insertions(+), 6 deletions(-)
+
+diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
+index cc8953f..e1968e0 100644
+--- a/src/pulsecore/sink-input.c
++++ b/src/pulsecore/sink-input.c
+@@ -931,7 +931,6 @@ void pa_sink_input_peek(pa_sink_input *i, size_t slength /* in sink bytes */, pa
+ pa_memchunk wchunk;
+ bool nvfs = need_volume_factor_sink;
+ pa_cvolume target;
+- pa_bool_t tmp;
+
+ wchunk = tchunk;
+ pa_memblock_ref(wchunk.memblock);
+@@ -972,7 +971,7 @@ void pa_sink_input_peek(pa_sink_input *i, size_t slength /* in sink bytes */, pa
+ if (pa_cvolume_ramp_active(&i->thread_info.ramp)) {
+ pa_memchunk_make_writable(&wchunk, 0);
+ pa_volume_ramp_memchunk(&wchunk, &i->sink->sample_spec, &(i->thread_info.ramp));
+- } else if ((tmp = pa_cvolume_ramp_target_active(&(i->thread_info.ramp)))) {
++ } else if ((pa_cvolume_ramp_target_active(&(i->thread_info.ramp)))) {
+ pa_memchunk_make_writable(&wchunk, 0);
+ pa_cvolume_ramp_get_targets(&i->thread_info.ramp, &target);
+ pa_volume_memchunk(&wchunk, &i->sink->sample_spec, &target);
+@@ -1372,9 +1371,7 @@ int pa_sink_input_remove_volume_factor(pa_sink_input *i, const char *key) {
+ void pa_sink_input_set_volume_ramp(
+ pa_sink_input *i,
+ const pa_cvolume_ramp *ramp,
+- pa_bool_t send_msg,
+- pa_bool_t save) {
+-
++ bool send_msg) {
+ pa_sink_input_assert_ref(i);
+ pa_assert_ctl_context();
+ pa_assert(PA_SINK_INPUT_IS_LINKED(i->state));
+diff --git a/src/pulsecore/sink-input.h b/src/pulsecore/sink-input.h
+index 6e1b211..92f61c3 100644
+--- a/src/pulsecore/sink-input.h
++++ b/src/pulsecore/sink-input.h
+@@ -378,7 +378,7 @@ void pa_sink_input_set_volume(pa_sink_input *i, const pa_cvolume *volume, bool s
+ void pa_sink_input_add_volume_factor(pa_sink_input *i, const char *key, const pa_cvolume *volume_factor);
+ int pa_sink_input_remove_volume_factor(pa_sink_input *i, const char *key);
+ pa_cvolume *pa_sink_input_get_volume(pa_sink_input *i, pa_cvolume *volume, bool absolute);
+-void pa_sink_input_set_volume_ramp(pa_sink_input *i, const pa_cvolume_ramp *ramp, pa_bool_t send_msg, pa_bool_t save);
++void pa_sink_input_set_volume_ramp(pa_sink_input *i, const pa_cvolume_ramp *ramp, bool send_msg);
+
+ void pa_sink_input_set_mute(pa_sink_input *i, bool mute, bool save);
+
+--
+1.9.1
+
diff --git a/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-8.0/0005-sink-input-volume-Add-support-for-volume-ramp-factor.patch b/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-8.0/0005-sink-input-volume-Add-support-for-volume-ramp-factor.patch
new file mode 100644
index 000000000..e371b7ec5
--- /dev/null
+++ b/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-8.0/0005-sink-input-volume-Add-support-for-volume-ramp-factor.patch
@@ -0,0 +1,299 @@
+From a98e78ccc4f12d6efad2832a09202651e2a8b6cd Mon Sep 17 00:00:00 2001
+From: Sangchul Lee <sangchul1011@gmail.com>
+Date: Sat, 27 Aug 2016 21:33:19 +0900
+Subject: [PATCH 5/6] sink-input, volume: Add support for volume ramp factor
+
+Previously, using pa_sink_input_set_volume_ramp() is hard to manage
+if there are several callers. These new volume ramp factor APIs make it
+easy for caller to use and to set more than one volume ramp factor.
+New volume ramp factor will be applied by the multiplication of the other
+ramp factors that have been already set.
+
+APIs are added as below.
+ - pa_sink_input_add_volume_ramp_factor()
+ - pa_sink_input_remove_volume_ramp_factor()
+ - pa_cvolume_ramp_compatible()
+ - pa_sw_cvolume_ramp_multiply()
+ - pa_cvolume_ramp_valid()
+
+Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
+---
+ src/map-file | 3 ++
+ src/pulse/volume.c | 44 ++++++++++++++++++
+ src/pulse/volume.h | 9 ++++
+ src/pulsecore/sink-input.c | 108 +++++++++++++++++++++++++++++++++++++++++++++
+ src/pulsecore/sink-input.h | 5 +++
+ 5 files changed, 169 insertions(+)
+
+diff --git a/src/map-file b/src/map-file
+index ef9b57d..7577c14 100644
+--- a/src/map-file
++++ b/src/map-file
+@@ -142,6 +142,8 @@ pa_cvolume_ramp_equal;
+ pa_cvolume_ramp_init;
+ pa_cvolume_ramp_set;
+ pa_cvolume_ramp_channel_ramp_set;
++pa_cvolume_ramp_compatible;
++pa_cvolume_ramp_valid;
+ pa_cvolume_remap;
+ pa_cvolume_scale;
+ pa_cvolume_scale_mask;
+@@ -344,6 +346,7 @@ pa_sw_cvolume_divide_scalar;
+ pa_sw_cvolume_multiply;
+ pa_sw_cvolume_multiply_scalar;
+ pa_sw_cvolume_snprint_dB;
++pa_sw_cvolume_ramp_multiply;
+ pa_sw_volume_divide;
+ pa_sw_volume_from_dB;
+ pa_sw_volume_from_linear;
+diff --git a/src/pulse/volume.c b/src/pulse/volume.c
+index 85072c1..8d99150 100644
+--- a/src/pulse/volume.c
++++ b/src/pulse/volume.c
+@@ -1049,3 +1049,47 @@ pa_cvolume_ramp* pa_cvolume_ramp_channel_ramp_set(pa_cvolume_ramp *ramp, unsigne
+
+ return ramp;
+ }
++
++int pa_cvolume_ramp_compatible(const pa_cvolume_ramp *ramp, const pa_sample_spec *ss) {
++
++ pa_assert(ramp);
++ pa_assert(ss);
++
++ pa_return_val_if_fail(pa_cvolume_ramp_valid(ramp), 0);
++ pa_return_val_if_fail(pa_sample_spec_valid(ss), 0);
++
++ return ramp->channels == ss->channels;
++}
++
++pa_cvolume_ramp *pa_sw_cvolume_ramp_multiply(pa_cvolume_ramp *dest, const pa_cvolume_ramp *a, const pa_cvolume_ramp *b) {
++ unsigned i;
++
++ pa_assert(dest);
++ pa_assert(a);
++ pa_assert(b);
++
++ pa_return_val_if_fail(pa_cvolume_ramp_valid(a), NULL);
++ pa_return_val_if_fail(pa_cvolume_ramp_valid(b), NULL);
++
++ for (i = 0; i < a->channels && i < b->channels; i++)
++ dest->ramps[i].target = pa_sw_volume_multiply(a->ramps[i].target, b->ramps[i].target);
++
++ dest->channels = (uint8_t) i;
++
++ return dest;
++}
++
++int pa_cvolume_ramp_valid(const pa_cvolume_ramp *ramp) {
++ unsigned c;
++
++ pa_assert(ramp);
++
++ if (!pa_channels_valid(ramp->channels))
++ return 0;
++
++ for (c = 0; c < ramp->channels; c++)
++ if (!PA_VOLUME_IS_VALID(ramp->ramps[c].target))
++ return 0;
++
++ return 1;
++}
+diff --git a/src/pulse/volume.h b/src/pulse/volume.h
+index 2ae3451..65fcb08 100644
+--- a/src/pulse/volume.h
++++ b/src/pulse/volume.h
+@@ -458,12 +458,21 @@ int pa_cvolume_ramp_equal(const pa_cvolume_ramp *a, const pa_cvolume_ramp *b);
+ /** Init volume ramp struct */
+ pa_cvolume_ramp* pa_cvolume_ramp_init(pa_cvolume_ramp *ramp);
+
++/** Set the volume ramp of the first n channels to PA_VOLUME_NORM */
++#define pa_cvolume_ramp_reset(a, n, t, l) pa_cvolume_ramp_set((a), (n), (t), (l), PA_VOLUME_NORM)
++
+ /** Set first n channels of ramp struct to certain value */
+ pa_cvolume_ramp* pa_cvolume_ramp_set(pa_cvolume_ramp *ramp, unsigned channel, pa_volume_ramp_type_t type, long time, pa_volume_t vol);
+
+ /** Set individual channel in the channel struct */
+ pa_cvolume_ramp* pa_cvolume_ramp_channel_ramp_set(pa_cvolume_ramp *ramp, unsigned channel, pa_volume_ramp_type_t type, long time, pa_volume_t vol);
+
++int pa_cvolume_ramp_compatible(const pa_cvolume_ramp *ramp, const pa_sample_spec *ss);
++
++int pa_cvolume_ramp_valid(const pa_cvolume_ramp *ramp);
++
++pa_cvolume_ramp *pa_sw_cvolume_ramp_multiply(pa_cvolume_ramp *dest, const pa_cvolume_ramp *a, const pa_cvolume_ramp *b);
++
+ PA_C_DECL_END
+
+ #endif
+diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
+index e1968e0..6f89aa1 100644
+--- a/src/pulsecore/sink-input.c
++++ b/src/pulsecore/sink-input.c
+@@ -53,6 +53,11 @@ struct volume_factor_entry {
+ pa_cvolume volume;
+ };
+
++struct volume_ramp_factor_entry {
++ char *key;
++ pa_cvolume_ramp ramp;
++};
++
+ static struct volume_factor_entry *volume_factor_entry_new(const char *key, const pa_cvolume *volume) {
+ struct volume_factor_entry *entry;
+
+@@ -83,6 +88,37 @@ static void volume_factor_from_hashmap(pa_cvolume *v, pa_hashmap *items, uint8_t
+ pa_sw_cvolume_multiply(v, v, &entry->volume);
+ }
+
++static struct volume_ramp_factor_entry *volume_ramp_factor_entry_new(const char *key, const pa_cvolume_ramp *ramp) {
++ struct volume_ramp_factor_entry *entry;
++
++ pa_assert(key);
++ pa_assert(ramp);
++
++ entry = pa_xnew(struct volume_ramp_factor_entry, 1);
++ entry->key = pa_xstrdup(key);
++
++ entry->ramp = *ramp;
++
++ return entry;
++}
++
++static void volume_ramp_factor_entry_free(struct volume_ramp_factor_entry *ramp_entry) {
++ pa_assert(ramp_entry);
++
++ pa_xfree(ramp_entry->key);
++ pa_xfree(ramp_entry);
++}
++
++static void volume_ramp_factor_from_hashmap(pa_cvolume_ramp *r, pa_hashmap *items, uint8_t channels, pa_volume_ramp_type_t type, long length) {
++ struct volume_ramp_factor_entry *entry;
++ void *state = NULL;
++
++ pa_cvolume_ramp_reset(r, channels, type, length);
++ PA_HASHMAP_FOREACH(entry, items, state)
++ pa_sw_cvolume_ramp_multiply(r, r, &entry->ramp);
++
++}
++
+ static void sink_input_free(pa_object *o);
+ static void set_real_ratio(pa_sink_input *i, const pa_cvolume *v);
+
+@@ -500,6 +536,8 @@ int pa_sink_input_new(
+ i->volume_factor_sink_items = data->volume_factor_sink_items;
+ data->volume_factor_sink_items = NULL;
+ volume_factor_from_hashmap(&i->volume_factor_sink, i->volume_factor_sink_items, i->sink->sample_spec.channels);
++ i->ramp_factor_items = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL,
++ (pa_free_cb_t) volume_ramp_factor_entry_free);
+
+ i->real_ratio = i->reference_ratio = data->volume;
+ pa_cvolume_reset(&i->soft_volume, i->sample_spec.channels);
+@@ -764,6 +802,9 @@ static void sink_input_free(pa_object *o) {
+ if (i->volume_factor_sink_items)
+ pa_hashmap_free(i->volume_factor_sink_items);
+
++ if (i->ramp_factor_items)
++ pa_hashmap_free(i->ramp_factor_items);
++
+ pa_xfree(i->driver);
+ pa_xfree(i);
+ }
+@@ -1367,6 +1408,73 @@ int pa_sink_input_remove_volume_factor(pa_sink_input *i, const char *key) {
+ return 0;
+ }
+
++void pa_sink_input_add_volume_ramp_factor(pa_sink_input *i, const char *key, const pa_cvolume_ramp *ramp_factor, bool send_msg) {
++ struct volume_ramp_factor_entry *r;
++
++ pa_sink_input_assert_ref(i);
++ pa_assert_ctl_context();
++ pa_assert(PA_SINK_INPUT_IS_LINKED(i->state));
++ pa_assert(ramp_factor);
++ pa_assert(key);
++ pa_assert(pa_cvolume_ramp_valid(ramp_factor));
++ pa_assert(ramp_factor->channels == 1 || pa_cvolume_ramp_compatible(ramp_factor, &i->sample_spec));
++
++ r = volume_ramp_factor_entry_new(key, ramp_factor);
++ if (!pa_cvolume_ramp_compatible(ramp_factor, &i->sample_spec))
++ pa_cvolume_ramp_set(&r->ramp, i->sample_spec.channels, ramp_factor->ramps[0].type, ramp_factor->ramps[0].length, ramp_factor->ramps[0].target);
++
++ pa_assert_se(pa_hashmap_put(i->ramp_factor_items, r->key, r) >= 0);
++ if (pa_hashmap_size(i->ramp_factor_items) == 1)
++ pa_cvolume_ramp_set(&i->ramp_factor, i->sample_spec.channels, r->ramp.ramps[0].type, r->ramp.ramps[0].length, r->ramp.ramps[0].target);
++ else
++ pa_sw_cvolume_ramp_multiply(&i->ramp_factor, &i->ramp_factor, &r->ramp);
++
++ pa_cvolume_ramp_convert(&i->ramp_factor, &i->ramp, i->sample_spec.rate);
++
++ if (send_msg)
++ pa_assert_se(pa_asyncmsgq_send(i->sink->asyncmsgq, PA_MSGOBJECT(i), PA_SINK_INPUT_MESSAGE_SET_VOLUME_RAMP, NULL, 0, NULL) == 0);
++
++ return 0;
++}
++
++/* Returns 0 if an entry was removed and -1 if no entry for the given key was
++ * found. */
++int pa_sink_input_remove_volume_ramp_factor(pa_sink_input *i, const char *key, bool send_msg) {
++ struct volume_ramp_factor_entry *r;
++
++ pa_sink_input_assert_ref(i);
++ pa_assert(key);
++ pa_assert_ctl_context();
++ pa_assert(PA_SINK_INPUT_IS_LINKED(i->state));
++
++ r = pa_hashmap_remove(i->ramp_factor_items, key);
++ if (!r)
++ return -1;
++
++ switch (pa_hashmap_size(i->ramp_factor_items)) {
++ case 0:
++ pa_cvolume_ramp_reset(&i->ramp_factor, i->sample_spec.channels, r->ramp.ramps[0].type, r->ramp.ramps[0].length);
++ break;
++ case 1: {
++ struct volume_ramp_factor_entry *rf;
++ rf = pa_hashmap_first(i->ramp_factor_items);
++ pa_cvolume_ramp_set(&i->ramp_factor, i->sample_spec.channels, r->ramp.ramps[0].type, r->ramp.ramps[0].length, rf->ramp.ramps[0].target);
++ break;
++ }
++ default:
++ volume_ramp_factor_from_hashmap(&i->ramp_factor, i->ramp_factor_items, i->ramp_factor.channels, i->ramp_factor.ramps[0].type, i->ramp_factor.ramps[0].length);
++ }
++
++ volume_ramp_factor_entry_free(r);
++
++ pa_cvolume_ramp_convert(&i->ramp_factor, &i->ramp, i->sample_spec.rate);
++
++ if (send_msg)
++ pa_assert_se(pa_asyncmsgq_send(i->sink->asyncmsgq, PA_MSGOBJECT(i), PA_SINK_INPUT_MESSAGE_SET_VOLUME_RAMP, NULL, 0, NULL) == 0);
++
++ return 0;
++}
++
+ /* Called from main thread */
+ void pa_sink_input_set_volume_ramp(
+ pa_sink_input *i,
+diff --git a/src/pulsecore/sink-input.h b/src/pulsecore/sink-input.h
+index 92f61c3..5430d53 100644
+--- a/src/pulsecore/sink-input.h
++++ b/src/pulsecore/sink-input.h
+@@ -113,6 +113,9 @@ struct pa_sink_input {
+ pa_cvolume volume_factor_sink; /* A second volume factor in format of the sink this stream is connected to. */
+ pa_hashmap *volume_factor_sink_items;
+
++ pa_cvolume_ramp ramp_factor;
++ pa_hashmap *ramp_factor_items;
++
+ bool volume_writable:1;
+
+ bool muted:1;
+@@ -379,6 +382,8 @@ void pa_sink_input_add_volume_factor(pa_sink_input *i, const char *key, const pa
+ int pa_sink_input_remove_volume_factor(pa_sink_input *i, const char *key);
+ pa_cvolume *pa_sink_input_get_volume(pa_sink_input *i, pa_cvolume *volume, bool absolute);
+ void pa_sink_input_set_volume_ramp(pa_sink_input *i, const pa_cvolume_ramp *ramp, bool send_msg);
++void pa_sink_input_add_volume_ramp_factor(pa_sink_input *i, const char *key, const pa_cvolume_ramp *ramp_factor, bool send_msg);
++int pa_sink_input_remove_volume_ramp_factor(pa_sink_input *i, const char *key, bool send_msg);
+
+ void pa_sink_input_set_mute(pa_sink_input *i, bool mute, bool save);
+
+--
+1.9.1
+
diff --git a/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-8.0/0006-sink-input-Remove-pa_sink_input_set_volume_ramp.patch b/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-8.0/0006-sink-input-Remove-pa_sink_input_set_volume_ramp.patch
new file mode 100644
index 000000000..50110bd14
--- /dev/null
+++ b/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio-8.0/0006-sink-input-Remove-pa_sink_input_set_volume_ramp.patch
@@ -0,0 +1,63 @@
+From ac9a99505fd768b66dd92e9091e80b576cabc00d Mon Sep 17 00:00:00 2001
+From: Sangchul Lee <sangchul1011@gmail.com>
+Date: Sat, 27 Aug 2016 21:33:20 +0900
+Subject: [PATCH 6/6] sink-input: Remove pa_sink_input_set_volume_ramp()
+
+Please use pa_sink_input_add_volume_ramp_factor() or
+pa_sink_input_remove_volume_ramp_factor() instead of it.
+
+Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
+---
+ src/pulsecore/sink-input.c | 23 -----------------------
+ src/pulsecore/sink-input.h | 1 -
+ 2 files changed, 24 deletions(-)
+
+diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
+index 6f89aa1..4c7c568 100644
+--- a/src/pulsecore/sink-input.c
++++ b/src/pulsecore/sink-input.c
+@@ -1475,29 +1475,6 @@ int pa_sink_input_remove_volume_ramp_factor(pa_sink_input *i, const char *key, b
+ return 0;
+ }
+
+-/* Called from main thread */
+-void pa_sink_input_set_volume_ramp(
+- pa_sink_input *i,
+- const pa_cvolume_ramp *ramp,
+- bool send_msg) {
+- pa_sink_input_assert_ref(i);
+- pa_assert_ctl_context();
+- pa_assert(PA_SINK_INPUT_IS_LINKED(i->state));
+- pa_assert(ramp);
+-
+- pa_cvolume_ramp_convert(ramp, &i->ramp, i->sample_spec.rate);
+-
+- pa_log_debug("setting volume ramp with target vol:%d and length:%ld",
+- i->ramp.ramps[0].target,
+- i->ramp.ramps[0].length);
+-
+-
+- /* This tells the sink that volume ramp changed */
+- if (send_msg)
+- pa_assert_se(pa_asyncmsgq_send(i->sink->asyncmsgq, PA_MSGOBJECT(i), PA_SINK_INPUT_MESSAGE_SET_VOLUME_RAMP,
+- NULL, 0, NULL) == 0);
+-}
+-
+ /* Called from main context */
+ static void set_real_ratio(pa_sink_input *i, const pa_cvolume *v) {
+ pa_sink_input_assert_ref(i);
+diff --git a/src/pulsecore/sink-input.h b/src/pulsecore/sink-input.h
+index 5430d53..5fef3d5 100644
+--- a/src/pulsecore/sink-input.h
++++ b/src/pulsecore/sink-input.h
+@@ -381,7 +381,6 @@ void pa_sink_input_set_volume(pa_sink_input *i, const pa_cvolume *volume, bool s
+ void pa_sink_input_add_volume_factor(pa_sink_input *i, const char *key, const pa_cvolume *volume_factor);
+ int pa_sink_input_remove_volume_factor(pa_sink_input *i, const char *key);
+ pa_cvolume *pa_sink_input_get_volume(pa_sink_input *i, pa_cvolume *volume, bool absolute);
+-void pa_sink_input_set_volume_ramp(pa_sink_input *i, const pa_cvolume_ramp *ramp, bool send_msg);
+ void pa_sink_input_add_volume_ramp_factor(pa_sink_input *i, const char *key, const pa_cvolume_ramp *ramp_factor, bool send_msg);
+ int pa_sink_input_remove_volume_ramp_factor(pa_sink_input *i, const char *key, bool send_msg);
+
+--
+1.9.1
+
diff --git a/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio_8.0.bbappend b/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio_8.0.bbappend
index f7223e3e6..458c40fe3 100644
--- a/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio_8.0.bbappend
+++ b/meta-ivi-common/recipes-multimedia/pulseaudio/pulseaudio_8.0.bbappend
@@ -1,19 +1,13 @@
-FILESEXTRAPATHS_prepend := "${THISDIR}/pulseaudio:"
-
-SRC_URI += " file://0008-install-files-for-a-module-development.patch"
-
-SRC_URI_needtocheckforkrogoth += " \
- file://0010-volume-ramp-additions-to-the-low-level-infra.patch \
- file://0011-volume-ramp-adding-volume-ramping-to-sink-input.patch \
- file://0012-volume-ramp-add-volume-ramping-to-sink.patch \
- file://0013-add-internal-corking-state-for-sink-input.patch \
- file://0020-core-util-Add-pa_join.patch \
- file://0021-dynarray-Add-pa_dynarray_get_raw_array.patch \
- file://0022-device-port-Add-pa_device_port.active.patch \
- file://0030-volume-api-Add-libvolume-api.patch \
- file://0031-Add-module-main-volume-policy.patch \
- file://0039-main-volume-policy-adapt-to-pa6rev.patch \
- "
+FILESEXTRAPATHS_prepend := "${THISDIR}/pulseaudio-8.0:"
+
+SRC_URI += " \
+ file://0001-install-files-for-a-module-development.patch \
+ file://0002-volume-ramp-additions-to-the-low-level-infra.patch \
+ file://0003-volume-ramp-adding-volume-ramping-to-sink-input.patch \
+ file://0004-sink-input-Code-cleanup-regarding-volume-ramping.patch \
+ file://0005-sink-input-volume-Add-support-for-volume-ramp-factor.patch \
+ file://0006-sink-input-Remove-pa_sink_input_set_volume_ramp.patch;apply=no \
+"
PACKAGES =+ " pulseaudio-module-dev"