audio: Restart the voice call on device change
authorAndreas Schneider <asn@cryptomilk.org>
Tue, 14 Feb 2017 12:00:48 +0000 (13:00 +0100)
committerChristopher N. Hesse <raymanfx@gmail.com>
Fri, 24 Feb 2017 22:50:27 +0000 (22:50 +0000)
When we change the device during a phone call we need to completely
restart it. This is required by the modem.

Change-Id: I902c78bf50dfb5dc3da51fca0fb862f872df86ca

audio/audio_hw.c
audio/voice.c

index 90ed025b532591564fddad7eadd009607ad62516..076a469226c5359cfc9ebc73f74e909b0b28bb75 100644 (file)
@@ -2777,9 +2777,17 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs)
                        (out == adev->primary_output)) {
                 /* Turn on bluetooth if needed */
                 if ((out->devices & AUDIO_DEVICE_OUT_ALL_SCO) && !bt_sco_active) {
+                    select_devices(adev, USECASE_VOICE_CALL);
                     start_voice_session_bt_sco(adev->voice.session);
+                } else {
+                    /*
+                     * When we select different devices we need to restart the
+                     * voice call. The modem closes the stream on its end and
+                     * we do not get any output.
+                     */
+                    stop_voice_call(adev);
+                    start_voice_call(adev);
                 }
-                select_devices(adev, USECASE_VOICE_CALL);
             }
         }
 
index ba7b45b80a2e2f928e41eec9e40f313e2e7e887c..6de05fa35831681ce81fbbd2c4429800568b1958 100644 (file)
@@ -365,6 +365,10 @@ static void voice_session_wb_amr_callback(void *data, int wb_amr_type)
 
             /* TODO Handle wb_amr_type=2 */
 
+            /*
+             * We need stop the PCM and start with the
+             * wide band pcm_config.
+             */
             stop_voice_call(adev);
             start_voice_call(adev);
         }