}
group_ratio = v->is_hal_volume_type ? 1.0 : (double)v->values[stream_direction].current_level / (pa_idxset_size(v->values[stream_direction].idx_volume_values) - 1);
result_ratio = master_ratio * group_ratio * individual_ratio;
- pa_log_debug("role(%s), volume_type(%s) : master_ratio(%f), group_ratio(%f), individual_ratio(%f) => result_ratio(%f)",
+ pa_log_debug("role(%s), volume_type(%s) : master_ratio(%f), group_ratio(%f), individual_ratio(%f) => result_ratio(%f) to HAL",
role, volume_type, master_ratio, group_ratio, individual_ratio, result_ratio);
io_direction = is_sink_input ? DIRECTION_OUT : DIRECTION_IN;
((pa_sink_input*)s)->individual_volume_ratio = ratio;
else
((pa_source_output*)s)->individual_volume_ratio = ratio;
+
+ /* In case of network device, do not apply tizen group volume */
+ if (is_active_device_of_stream(s, stream_type, DEVICE_TYPE_NETWORK))
+ volume_linear = 1.0;
+
apply_individual_ratio(m, s, volume_linear, &cv);
if (stream_type == STREAM_SINK_INPUT)
return 0;
}
+bool is_active_device_of_stream(const void *stream, stream_type_t stream_type, const char *device_type) {
+ const char *active_dev;
+
+ pa_assert(stream);
+ pa_assert(device_type);
+
+ active_dev = pa_proplist_gets(GET_STREAM_PROPLIST(stream, stream_type), PA_PROP_MEDIA_ROUTE_AUTO_ACTIVE_DEV);
+ if (pa_safe_streq(active_dev, device_type)) {
+ pa_log_info("stream(%p)'s active_dev(%s) is same as device_type(%s)", stream, active_dev, device_type);
+ return true;
+ }
+
+ return false;
+}
+
static void set_media_active_device(pa_stream_manager *m) {
pa_tz_device *playback_device, *capture_device;
stream_info *media_info;
}
} else if (command == PROCESS_COMMAND_UPDATE_VOLUME) {
- if (is_new_data)
+ if (is_new_data) {
si_volume_type_str = pa_proplist_gets(GET_STREAM_NEW_PROPLIST(stream, type), PA_PROP_MEDIA_TIZEN_VOLUME_TYPE);
- else
+ } else {
si_volume_type_str = pa_proplist_gets(GET_STREAM_PROPLIST(stream, type), PA_PROP_MEDIA_TIZEN_VOLUME_TYPE);
+ if (si_volume_type_str && is_active_device_of_stream(stream, STREAM_SINK_INPUT, DEVICE_TYPE_NETWORK)) {
+ /* In case of network device, reset the volume of this sink-input. */
+ pa_cvolume cv;
+ pa_cvolume_reset(&cv, ((pa_sink_input*)stream)->sample_spec.channels) ;
+ pa_sink_input_set_volume((pa_sink_input*)stream, &cv, true, true);
+ pa_log_debug("This stream belongs to a network device, reset volume.");
+ goto finish;
+ }
+ }
if (!si_volume_type_str)
goto finish;
pa_log_debug("sink-input(%p, index:%u)", i, i->index);
set_volume_mute_by_idx(m, i->index, STREAM_SINK_INPUT, true);
+ process_stream(m, i, STREAM_SINK_INPUT, PROCESS_COMMAND_UPDATE_VOLUME, false);
return PA_HOOK_OK;
}
pa_log_debug("is new_device[%s] available for role[%s]/stream_type[%d]:%d", new_device_type, role, stream_type, *available);
}
-static bool is_active_device_of_stream(const void *stream, stream_type_t stream_type, const char *device_type) {
- const char *active_dev;
-
- pa_assert(stream);
- pa_assert(device_type);
-
- active_dev = pa_proplist_gets(GET_STREAM_PROPLIST(stream, stream_type), PA_PROP_MEDIA_ROUTE_AUTO_ACTIVE_DEV);
- if (pa_safe_streq(active_dev, device_type)) {
- pa_log_info("stream(%p)'s active_dev(%s) is same as device_type(%s)", stream, active_dev, device_type);
- return true;
- }
-
- return false;
-}
-
/* Re-trigger for routing update for streams using auto route type */
static void process_stream_as_device_change_for_auto_route(pa_stream_manager *m, void *stream, stream_type_t stream_type,
bool is_connected, pa_tz_device *device) {
if (check_name_is_vstream(s, STREAM_SINK_INPUT, false)) {
pa_log_debug(" -- *** keep null sink for a virtual stream");
} else {
+ pa_proplist_sets(GET_STREAM_PROPLIST(s, STREAM_SINK_INPUT), PA_PROP_MEDIA_ROUTE_AUTO_ACTIVE_DEV, device_type);
pa_sink_input_move_to(s, sink, false);
pa_log_debug(" -- *** sink-input(%p,%u) moves to sink(%p,%s), new device(%s)",
s, ((pa_sink_input*)s)->index, sink, sink->name, device_type);
if (check_name_is_vstream(s, STREAM_SOURCE_OUTPUT, false)) {
pa_log_debug(" -- *** keep null source for a virtual stream");
} else {
+ pa_proplist_sets(GET_STREAM_PROPLIST(s, STREAM_SOURCE_OUTPUT), PA_PROP_MEDIA_ROUTE_AUTO_ACTIVE_DEV, device_type);
pa_source_output_move_to(s, source, false);
pa_log_debug(" -- *** source-output(%p,%u) moves to source(%p,%s), new device(%s)",
s, ((pa_source_output*)s)->index, source, source->name, device_type);