audio: Restart the voice call on device change

When we change the device during a phone call we need to completely
restart it. This is required by the modem.

Change-Id: I902c78bf50dfb5dc3da51fca0fb862f872df86ca
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index 90ed025..076a469 100644
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -2777,9 +2777,17 @@
                        (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);
             }
         }
 
diff --git a/audio/voice.c b/audio/voice.c
index ba7b45b..6de05fa 100644
--- a/audio/voice.c
+++ b/audio/voice.c
@@ -365,6 +365,10 @@
 
             /* 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);
         }