1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
a8103fa pulse: Don't lock the mainloop in NULL
ext/pulse/pulsesink.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++-
ext/pulse/pulsesrc.c | 9 ++++++++
2 files changed, 58 insertions(+), 1 deletions(-)
diff --git a/ext/pulse/pulsesink.c b/ext/pulse/pulsesink.c
index e39b672..8d5f0fe 100644
--- a/ext/pulse/pulsesink.c
+++ b/ext/pulse/pulsesink.c
@@ -1692,6 +1692,9 @@ gst_pulsesink_set_volume (GstPulseSink * psink, gdouble volume)
GstPulseRingBuffer *pbuf;
uint32_t idx;
+ if (!psink->mainloop)
+ goto no_mainloop;
+
pa_threaded_mainloop_lock (psink->mainloop);
GST_DEBUG_OBJECT (psink, "setting volume to %f", volume);
@@ -1720,6 +1723,14 @@ unlock:
return;
/* ERRORS */
+no_mainloop:
+ {
+ psink->volume = volume;
+ psink->volume_set = TRUE;
+
+ GST_DEBUG_OBJECT (psink, "we have no mainloop");
+ return;
+ }
no_buffer:
{
psink->volume = volume;
@@ -1749,6 +1760,9 @@ gst_pulsesink_set_mute (GstPulseSink * psink, gboolean mute)
GstPulseRingBuffer *pbuf;
uint32_t idx;
+ if (!psink->mainloop)
+ goto no_mainloop;
+
pa_threaded_mainloop_lock (psink->mainloop);
GST_DEBUG_OBJECT (psink, "setting mute state to %d", mute);
@@ -1775,6 +1789,14 @@ unlock:
return;
/* ERRORS */
+no_mainloop:
+ {
+ psink->mute = mute;
+ psink->mute_set = TRUE;
+
+ GST_DEBUG_OBJECT (psink, "we have no mainloop");
+ return;
+ }
no_buffer:
{
psink->mute = mute;
@@ -1833,6 +1855,9 @@ gst_pulsesink_get_volume (GstPulseSink * psink)
gdouble v = DEFAULT_VOLUME;
uint32_t idx;
+ if (!psink->mainloop)
+ goto no_mainloop;
+
pa_threaded_mainloop_lock (psink->mainloop);
pbuf = GST_PULSERING_BUFFER_CAST (GST_BASE_AUDIO_SINK (psink)->ringbuffer);
@@ -1852,9 +1877,9 @@ gst_pulsesink_get_volume (GstPulseSink * psink)
goto unlock;
}
+unlock:
v = psink->volume;
-unlock:
if (o)
pa_operation_unref (o);
@@ -1868,6 +1893,12 @@ unlock:
return v;
/* ERRORS */
+no_mainloop:
+ {
+ v = psink->volume;
+ GST_DEBUG_OBJECT (psink, "we have no mainloop");
+ return v;
+ }
no_buffer:
{
GST_DEBUG_OBJECT (psink, "we have no ringbuffer");
@@ -1895,6 +1926,9 @@ gst_pulsesink_get_mute (GstPulseSink * psink)
uint32_t idx;
gboolean mute = FALSE;
+ if (!psink->mainloop)
+ goto no_mainloop;
+
pa_threaded_mainloop_lock (psink->mainloop);
mute = psink->mute;
@@ -1924,6 +1958,12 @@ unlock:
return mute;
/* ERRORS */
+no_mainloop:
+ {
+ mute = psink->mute;
+ GST_DEBUG_OBJECT (psink, "we have no mainloop");
+ return mute;
+ }
no_buffer:
{
GST_DEBUG_OBJECT (psink, "we have no ringbuffer");
@@ -1976,6 +2016,9 @@ gst_pulsesink_device_description (GstPulseSink * psink)
pa_operation *o = NULL;
gchar *t;
+ if (!psink->mainloop)
+ goto no_mainloop;
+
pa_threaded_mainloop_lock (psink->mainloop);
pbuf = GST_PULSERING_BUFFER_CAST (GST_BASE_AUDIO_SINK (psink)->ringbuffer);
if (pbuf == NULL || pbuf->stream == NULL)
@@ -2002,6 +2045,11 @@ unlock:
return t;
/* ERRORS */
+no_mainloop:
+ {
+ GST_DEBUG_OBJECT (psink, "we have no mainloop");
+ return NULL;
+ }
no_buffer:
{
GST_DEBUG_OBJECT (psink, "we have no ringbuffer");
diff --git a/ext/pulse/pulsesrc.c b/ext/pulse/pulsesrc.c
index b3126f4..2f1aacd 100644
--- a/ext/pulse/pulsesrc.c
+++ b/ext/pulse/pulsesrc.c
@@ -396,6 +396,9 @@ gst_pulsesrc_device_description (GstPulseSrc * pulsesrc)
pa_operation *o = NULL;
gchar *t;
+ if (!pulsesrc->mainloop)
+ goto no_mainloop;
+
pa_threaded_mainloop_lock (pulsesrc->mainloop);
if (!pulsesrc->stream)
@@ -429,6 +432,12 @@ unlock:
pa_threaded_mainloop_unlock (pulsesrc->mainloop);
return t;
+
+no_mainloop:
+ {
+ GST_DEBUG_OBJECT (pulsesrc, "have no mainloop");
+ return NULL;
+ }
}
static void
--
1.7.2
|