audio-hal: qahw_api: Adding changes to get dsp latency for KPI

Change-Id: If24f85d0bb864a65b3733b8e8c4c8744a241a8f3
diff --git a/qahw_api/test/qahw_playback_test.c b/qahw_api/test/qahw_playback_test.c
index 73950ae..b26a951 100644
--- a/qahw_api/test/qahw_playback_test.c
+++ b/qahw_api/test/qahw_playback_test.c
@@ -2347,7 +2347,7 @@
         qap_out_hal_handle = load_hal(stream->output_device);
         if (qap_out_hal_handle == NULL) {
             fprintf(stderr, "Failed log load HAL\n");
-            return;
+            goto exit;
         }
 
         file_name = (char*) check_for_playlist(kvp_string);
diff --git a/qahw_api/test/qahw_playback_test.h b/qahw_api/test/qahw_playback_test.h
index c710145..92805bb 100644
--- a/qahw_api/test/qahw_playback_test.h
+++ b/qahw_api/test/qahw_playback_test.h
@@ -152,6 +152,7 @@
 #define qap_wrapper_get_cmd_string_from_arg_array(argc, argv, status)    (0)
 #define qap_wrapper_start_stream (stream_data)                           (0)
 #define is_qap_session_active(argc, argv, kvp_string)                    (0)
+#define get_play_list(fp, stream_param, num_of_streams, kvp_str)         (0)
 #define check_for_playlist(kvp_string)                                   (0)
 #define start_playback_through_qap(kvp_string, num_of_streams,\
                                          qap_out_hal_handle_t)           (0)
@@ -169,6 +170,7 @@
 void *qap_wrapper_start_stream (void* stream_data);
 void get_file_format(stream_config *stream_info);
 bool is_qap_session_active(int argc, char* argv[], char *kvp_string);
+void get_play_list(FILE *fp, stream_config (*stream_param)[], int *num_of_streams, char *kvp_str[]);
 char* check_for_playlist(char *kvp_string);
 int start_playback_through_qap(char * kvp_string, int num_of_streams,\
                                 qahw_module_handle_t *qap_out_hal_handle_t);
diff --git a/qahw_api/test/qap_wrapper_extn.c b/qahw_api/test/qap_wrapper_extn.c
index 36a12b0..349aa16 100644
--- a/qahw_api/test/qap_wrapper_extn.c
+++ b/qahw_api/test/qap_wrapper_extn.c
@@ -108,6 +108,7 @@
 bool has_system_input = false;
 char session_kv_pairs[256];
 bool stream_close = false;
+uint32_t dsp_latency = 0;
 
 
 static void update_combo_dev_kvpairs()
@@ -229,6 +230,8 @@
     fprintf(stdout, "cold time latency %lf ms, avg cont time latency %lf ms,"
             "total cont time latency %f ms, total count %d\n",
             cold_time_latency, cont_time_latency, total_lat, cnt);
+    if (dsp_latency)
+        fprintf(stdout, "Dsp latency = %lu ms \n", dsp_latency);
 }
 
 static void qap_wrapper_read_frame_size_from_file(qap_audio_buffer_t *buffer, FILE *fp_framesize)
@@ -831,6 +834,8 @@
                                 if (bytes_written == -1) {
                                     ALOGE("%s::%d write failed in hal", __func__, __LINE__);
                                 }
+                            if (kpi_mode && data_callback_count == 6)
+                                dsp_latency = qahw_out_get_latency(qap_out_hdmi_handle);
                         }
                         if (kpi_mode && data_callback_count == 1) {
                              gettimeofday(&tcold_stop, NULL);
@@ -893,6 +898,8 @@
                                 if (bytes_written == -1) {
                                     ALOGE("%s::%d write failed in hal", __func__, __LINE__);
                                 }
+                            if (kpi_mode && data_callback_count == 6)
+                                dsp_latency = qahw_out_get_latency(qap_out_hp_handle);
                         }
                         if (kpi_mode && data_callback_count == 1) {
                              gettimeofday(&tcold_stop, NULL);
@@ -968,6 +975,8 @@
                                 if (bytes_written == -1) {
                                     ALOGE("%s::%d write failed in hal", __func__, __LINE__);
                                 }
+                            if (kpi_mode && data_callback_count == 6)
+                                dsp_latency = qahw_out_get_latency(qap_out_spk_handle);
                         }
                         if (kpi_mode && data_callback_count == 1) {
                              gettimeofday(&tcold_stop, NULL);