[PATCH 1/2] Initialise write_volume

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The callback should also be reset in reset_calbacks().
The extra check in _volume_change_apply() is needed because when the sink is unlinked the callbacks are reset,
but there still may be pending volume changes.
---
 src/pulsecore/sink.c   |    3 +++
 src/pulsecore/source.c |    3 +++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 6277698..62a64b5 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -174,6 +174,7 @@ static void reset_callbacks(pa_sink *s) {
     s->set_state = NULL;
     s->get_volume = NULL;
     s->set_volume = NULL;
+    s->write_volume = NULL;
     s->get_mute = NULL;
     s->set_mute = NULL;
     s->request_rewind = NULL;
@@ -3350,6 +3351,8 @@ pa_bool_t pa_sink_volume_change_apply(pa_sink *s, pa_usec_t *usec_to_next) {
     pa_bool_t ret = FALSE;
 
     pa_assert(s);
+    if (!PA_SINK_IS_LINKED(s->state))
+        return ret;
     pa_assert(s->write_volume);
 
     while (s->thread_info.volume_changes && now >= s->thread_info.volume_changes->at) {
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index 31ce39d..f0641ed 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -144,6 +144,7 @@ static void reset_callbacks(pa_source *s) {
     s->set_state = NULL;
     s->get_volume = NULL;
     s->set_volume = NULL;
+    s->write_volume = NULL;
     s->get_mute = NULL;
     s->set_mute = NULL;
     s->update_requested_latency = NULL;
@@ -2533,6 +2534,8 @@ pa_bool_t pa_source_volume_change_apply(pa_source *s, pa_usec_t *usec_to_next) {
     pa_bool_t ret = FALSE;
 
     pa_assert(s);
+    if (!PA_SOURCE_IS_LINKED(s->state))
+        return ret;
     pa_assert(s->write_volume);
 
     while (s->thread_info.volume_changes && now >= s->thread_info.volume_changes->at) {
-- 
1.7.4.1



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux