Merge "hal: add support for voip_out_stream_count key in get_parameters"
diff --git a/hal/voice_extn/compress_voip.c b/hal/voice_extn/compress_voip.c
index a89ec2d..5c87c9c 100644
--- a/hal/voice_extn/compress_voip.c
+++ b/hal/voice_extn/compress_voip.c
@@ -60,6 +60,7 @@
     struct pcm *pcm_tx;
     struct stream_out *out_stream;
     int ref_count;
+    int out_stream_count;
 };
 
 #define MODE_IS127              0x2
@@ -76,12 +77,14 @@
 #define AUDIO_PARAMETER_KEY_VOIP_DTX_MODE           "dtx_on"
 #define AUDIO_PARAMETER_VALUE_VOIP_TRUE             "true"
 #define AUDIO_PARAMETER_KEY_VOIP_CHECK              "voip_flag"
+#define AUDIO_PARAMETER_KEY_VOIP_OUT_STREAM_COUNT   "voip_out_stream_count"
 
 static struct voip_data voip_data = {
   .pcm_rx = NULL,
   .pcm_tx = NULL,
   .out_stream = NULL,
-  .ref_count = 0
+  .ref_count = 0,
+  .out_stream_count = 0
 };
 
 static int voip_set_volume(struct audio_device *adev, int volume);
@@ -453,6 +456,22 @@
     return ret;
 }
 
+void voice_extn_compress_voip_get_parameters(const struct audio_device *adev,
+                                             struct str_parms *query,
+                                             struct str_parms *reply)
+{
+    int ret;
+    char value[32]={0};
+    char *str = NULL;
+
+    ret = str_parms_get_str(query, AUDIO_PARAMETER_KEY_VOIP_OUT_STREAM_COUNT,
+                            value, sizeof(value));
+    if (ret >= 0) {
+        str_parms_add_int(reply, AUDIO_PARAMETER_KEY_VOIP_OUT_STREAM_COUNT,
+                          voip_data.out_stream_count);
+    }
+}
+
 void voice_extn_compress_voip_out_get_parameters(struct stream_out *out,
                                                  struct str_parms *query,
                                                  struct str_parms *reply)
@@ -554,6 +573,7 @@
 
     ret = voip_stop_call(adev);
     voip_data.out_stream = NULL;
+    voip_data.out_stream_count--;
 
     ALOGV("%s: exit: status(%d)", __func__, ret);
     return ret;
@@ -574,6 +594,7 @@
         out->config = pcm_config_voip_nb;
 
     voip_data.out_stream = out;
+    voip_data.out_stream_count++;
 
     ret = voip_set_mode(out->dev, out->format);
 
diff --git a/hal/voice_extn/voice_extn.c b/hal/voice_extn/voice_extn.c
index bbf3325..b8bc2df 100644
--- a/hal/voice_extn/voice_extn.c
+++ b/hal/voice_extn/voice_extn.c
@@ -505,6 +505,8 @@
         }
         str_parms_add_str(reply, AUDIO_PARAMETER_KEY_ALL_CALL_STATES, value);
     }
+    voice_extn_compress_voip_get_parameters(adev, query, reply);
+
     ALOGV("%s: exit: returns \"%s\"", __func__, str_parms_to_str(reply));
 }
 
diff --git a/hal/voice_extn/voice_extn.h b/hal/voice_extn/voice_extn.h
index cae1efb..f7d20e4 100644
--- a/hal/voice_extn/voice_extn.h
+++ b/hal/voice_extn/voice_extn.h
@@ -130,6 +130,9 @@
                                             snd_device_t *in_snd_device);
 int voice_extn_compress_voip_set_parameters(struct audio_device *adev,
                                              struct str_parms *parms);
+void voice_extn_compress_voip_get_parameters(const struct audio_device *adev,
+                                             struct str_parms *query,
+                                             struct str_parms *reply);
 
 void voice_extn_compress_voip_out_get_parameters(struct stream_out *out,
                                                  struct str_parms *query,
@@ -217,6 +220,13 @@
     return -ENOSYS;
 }
 
+static void voice_extn_compress_voip_get_parameters(const struct audio_device *adev,
+                                                    struct str_parms *query,
+                                                    struct str_parms *reply)
+{
+    ALOGE("%s: COMPRESS_VOIP_ENABLED is not defined", __func__);
+}
+
 static void voice_extn_compress_voip_out_get_parameters(struct stream_out *out,
                                                         struct str_parms *query,
                                                         struct str_parms *reply)