Merge lp:~rsalveti/telepathy-ofono/set_default_voicecall_volume into lp:telepathy-ofono

Proposed by Ricardo Salveti
Status: Merged
Approved by: Tiago Salem Herrmann
Approved revision: 100
Merged at revision: 98
Proposed branch: lp:~rsalveti/telepathy-ofono/set_default_voicecall_volume
Merge into: lp:telepathy-ofono
Diff against target: 82 lines (+25/-3)
2 files modified
qpulseaudioengine.cpp (+24/-3)
qpulseaudioengine.h (+1/-0)
To merge this branch: bzr merge lp:~rsalveti/telepathy-ofono/set_default_voicecall_volume
Reviewer Review Type Date Requested Status
Tiago Salem Herrmann (community) Approve
PS Jenkins bot continuous-integration Approve
Ubuntu Phablet Team Pending
Review via email: mp+231290@code.launchpad.net

Commit message

qpulseaudioengine: set default voicecall volume

Description of the change

qpulseaudioengine: set default voicecall volume

--Checklist--
Are there any related MPs required for this MP to build/function as expected? Please list.
Yes, all available in silo 02 (https://launchpad.net/~ci-train-ppa-service/+archive/ubuntu/landing-002)

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/telepathy-ofono) on device or emulator?
Yes

If you changed the UI, was the change specified/approved by design?
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)
99. By Ricardo Salveti

Don't mess with the internal call status variable

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ricardo Salveti (rsalveti) wrote :

Please make sure to install the extra packages (pulse and ubuntu-touch-session) available at https://launchpad.net/~ci-train-ppa-service/+archive/ubuntu/landing-002.

This MR is also available in the same silo.

100. By Ricardo Salveti

qpulseaudioengine: no need to make bt a special case for voice volume

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Tiago Salem Herrmann (tiagosh) wrote :

looks good to me.

--Checklist--

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 2014-08-04 15:47:30 +0000
3+++ qpulseaudioengine.cpp 2014-08-19 06:45:34 +0000
4@@ -26,6 +26,9 @@
5 #define PULSEAUDIO_PROFILE_HSP "hsp"
6 #define PULSEAUDIO_PROFILE_A2DP "a2dp"
7
8+/* Default initial value also used by android */
9+#define DEFAULT_VOICECALL_VOLUME 0.35
10+
11 QT_BEGIN_NAMESPACE
12
13 static void contextStateCallbackInit(pa_context *context, void *userdata)
14@@ -353,6 +356,17 @@
15 return true;
16 }
17
18+void QPulseAudioEngine::setSinkVolume(const char *sink_name, const double volume)
19+{
20+ pa_cvolume cv;
21+ pa_volume_t v = pa_sw_volume_from_linear(volume);
22+
23+ qDebug("Setting sink '%s' volume to '%f'", sink_name, volume);
24+
25+ pa_cvolume_set(&cv, 2, v);
26+ pa_operation_unref(pa_context_set_sink_volume_by_name(m_context, sink_name, &cv, success_cb, this));
27+}
28+
29 void QPulseAudioEngine::setupVoiceCall()
30 {
31 pa_operation *o;
32@@ -428,21 +442,23 @@
33
34 void QPulseAudioEngine::setCallMode(QPulseAudioEngine::CallStatus callstatus, QPulseAudioEngine::CallMode callmode)
35 {
36+ CallStatus p_callstatus = m_callstatus;
37 pa_operation *o;
38
39 /* Check if we need to save the current pulseaudio state (e.g. when starting a call) */
40- if ((callstatus != CallEnded) && (m_callstatus == CallEnded)) {
41+ if ((callstatus != CallEnded) && (p_callstatus == CallEnded)) {
42 setupVoiceCall();
43 }
44
45- /* If we have an active call, update internal state (used later when updating sink/source ports */
46+ /* If we have an active call, update internal state (used later when updating sink/source ports) */
47 m_callstatus = callstatus;
48 m_callmode = callmode;
49
50 /* Switch the virtual card mode when call is active and not active
51 * This needs to be done before sink/source gets updated, because after changing mode
52 * it will automatically move to input/output-parking */
53- if ((m_callstatus == CallActive) && (m_voicecallcard != "") && (m_voicecallprofile != "")) {
54+ if ((m_callstatus == CallActive) && (p_callstatus != CallActive) &&
55+ (m_voicecallcard != "") && (m_voicecallprofile != "")) {
56 qDebug("Setting PulseAudio card '%s' profile '%s'",
57 m_voicecallcard.c_str(), m_voicecallprofile.c_str());
58 o = pa_context_set_card_profile_by_name(m_context,
59@@ -482,6 +498,11 @@
60 if (!handleOperation(o, "pa_context_set_sink_port_by_name"))
61 return;
62 }
63+ /* Identify initial voice volume for the used port.
64+ * Set to a default fixed value when starting and when changing ports */
65+ if ((m_callstatus == CallActive) && (m_nametoset != "") &&
66+ ((p_callstatus != CallActive) || (m_valuetoset != "")))
67+ setSinkVolume(m_nametoset.c_str(), DEFAULT_VOICECALL_VOLUME);
68
69 /* Same for source */
70 m_nametoset = m_valuetoset = "";
71
72=== modified file 'qpulseaudioengine.h'
73--- qpulseaudioengine.h 2014-08-04 01:52:02 +0000
74+++ qpulseaudioengine.h 2014-08-19 06:45:34 +0000
75@@ -54,6 +54,7 @@
76 void restoreVoiceCall(void);
77 void setCallMode(CallStatus callstatus, CallMode callmode);
78 void setMicMute(bool muted); /* True if muted, false if unmuted */
79+ void setSinkVolume(const char *sink_name, const double volume);
80
81 /* These four are only used internally */
82 void cardInfoCallback(const pa_card_info *card);

Subscribers

People subscribed via source and target branches