stream-manager-volume: fix svace defect (UNINIT.LOCAL_VAR.EX) 46/205646/2 accepted/tizen/unified/20190508.234057 submit/tizen/20190508.075429
authorSeungbae Shin <seungbae.shin@samsung.com>
Wed, 8 May 2019 07:08:02 +0000 (16:08 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Wed, 8 May 2019 07:52:27 +0000 (16:52 +0900)
[Version] 11.1.43
[Issue type] SVACE

Change-Id: I7e170c4af028d113d8007abea4cdeed3e25ff7e9

src/stream-manager-volume.c

index aeb6b5e..10cda8e 100644 (file)
@@ -295,12 +295,13 @@ void apply_individual_ratio(pa_stream_manager *m, pa_object *stream, double volu
         volume = pa_sw_volume_from_linear(volume_linear) * individual_ratio;
         result = pa_cvolume_set(result, channels, volume);
         result_linear = pa_sw_volume_to_linear(volume);
+        stream_type = is_sink_input ? STREAM_SINK_INPUT : STREAM_SOURCE_OUTPUT;
+        index = GET_STREAM_INDEX(stream, stream_type);
 
         pa_log_info("apply the individual ratio[%f] to stream[idx:%u], result volume linear[%f]",
-                        individual_ratio, index, result_linear);
+                individual_ratio, index, result_linear);
 
         /* Here's calculation before calling HAL API */
-        stream_type = is_sink_input ? STREAM_SINK_INPUT : STREAM_SOURCE_OUTPUT;
         if (!(volume_type = pa_proplist_gets(GET_STREAM_PROPLIST(stream, stream_type), PA_PROP_MEDIA_TIZEN_VOLUME_TYPE))) {
             pa_log_error("no volume type");
             return;
@@ -322,7 +323,6 @@ void apply_individual_ratio(pa_stream_manager *m, pa_object *stream, double volu
         pa_log_debug("role(%s), volume_type(%s) : master_ratio(%f), group_ratio(%f), individual_ratio(%f) => result_ratio(%f)",
                     role, volume_type, master_ratio, group_ratio, individual_ratio, result_ratio);
 
-        index = GET_STREAM_INDEX(stream, stream_type);
         io_direction = is_sink_input ? DIRECTION_OUT : DIRECTION_IN;
 
         pa_hal_interface_set_volume_ratio(m->hal, role, io_direction, index, result_ratio);