Merge lp:~tiagosh/telepathy-ofono/fix-create-context-if-null into lp:telepathy-ofono

Proposed by Tiago Salem Herrmann
Status: Merged
Approved by: Gustavo Pichorim Boiko
Approved revision: 155
Merged at revision: 157
Proposed branch: lp:~tiagosh/telepathy-ofono/fix-create-context-if-null
Merge into: lp:telepathy-ofono
Diff against target: 78 lines (+13/-5)
2 files modified
qpulseaudioengine.cpp (+12/-4)
qpulseaudioengine.h (+1/-1)
To merge this branch: bzr merge lp:~tiagosh/telepathy-ofono/fix-create-context-if-null
Reviewer Review Type Date Requested Status
Gustavo Pichorim Boiko (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+266138@code.launchpad.net

Commit message

Check and create PA context before using it.

Description of the change

Check and create PA context before using it.
This bug is reproduced on devices where telepathy-ofono starts before pulseaudio.

--Checklist--
Are there any related MPs required for this MP to build/function as expected? Please list.
No

Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes)
Yes

Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator?
Yes

Did you successfully run all tests found in your component's Test Plan (https://wiki.ubuntu.com/Process/Merges/TestPlan/<package-name>) on device or emulator?
Yes

If you changed the UI, was the change specified/approved by design?
N/A

If you changed UI labels, did you update the pot file?
N/A

If you changed the packaging (debian), did you add a core-dev as a reviewer to this MP?
N/A

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Gustavo Pichorim Boiko (boiko) wrote :

Did you perform an exploratory manual test run of the code change and any related functionality on device or emulator?
Yes

Did CI run pass? If not, please explain why.
Yes

Have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut?
Yes

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qpulseaudioengine.cpp'
2--- qpulseaudioengine.cpp 2015-07-21 13:49:54 +0000
3+++ qpulseaudioengine.cpp 2015-07-28 18:12:53 +0000
4@@ -131,13 +131,13 @@
5 createPulseContext();
6 }
7
8-void QPulseAudioEngineWorker::createPulseContext()
9+bool QPulseAudioEngineWorker::createPulseContext()
10 {
11 bool keepGoing = true;
12 bool ok = true;
13
14 if (m_context)
15- return;
16+ return true;
17
18 m_mainLoopApi = pa_threaded_mainloop_get_api(m_mainLoop);
19
20@@ -149,14 +149,14 @@
21 if (!m_context) {
22 qWarning("Unable to create new pulseaudio context");
23 pa_threaded_mainloop_unlock(m_mainLoop);
24- return;
25+ return false;
26 }
27
28 if (pa_context_connect(m_context, NULL, PA_CONTEXT_NOAUTOSPAWN, NULL) < 0) {
29 qWarning("Unable to create a connection to the pulseaudio context");
30 pa_threaded_mainloop_unlock(m_mainLoop);
31 releasePulseContext();
32- return;
33+ return false;
34 }
35
36 pa_threaded_mainloop_wait(m_mainLoop);
37@@ -203,6 +203,7 @@
38 }
39
40 pa_threaded_mainloop_unlock(m_mainLoop);
41+ return true;
42 }
43
44
45@@ -510,6 +511,9 @@
46
47 void QPulseAudioEngineWorker::setCallMode(CallStatus callstatus, AudioMode audiomode)
48 {
49+ if (!createPulseContext()) {
50+ return;
51+ }
52 CallStatus p_callstatus = m_callstatus;
53 AudioMode p_audiomode = m_audiomode;
54 AudioModes p_availableAudioModes = m_availableAudioModes;
55@@ -614,6 +618,10 @@
56
57 void QPulseAudioEngineWorker::setMicMute(bool muted)
58 {
59+ if (!createPulseContext()) {
60+ return;
61+ }
62+
63 m_micmute = muted;
64
65 if (m_callstatus == CallEnded)
66
67=== modified file 'qpulseaudioengine.h'
68--- qpulseaudioengine.h 2015-07-14 18:00:20 +0000
69+++ qpulseaudioengine.h 2015-07-28 18:12:53 +0000
70@@ -60,7 +60,7 @@
71
72 pa_threaded_mainloop *mainloop() { return m_mainLoop; }
73 pa_context *context() { return m_context; }
74- void createPulseContext(void);
75+ bool createPulseContext(void);
76 int setupVoiceCall(void);
77 void restoreVoiceCall(void);
78 /* Callbacks to be used internally */

Subscribers

People subscribed via source and target branches