Some internal stream types do not support for focus. In these cases, the focus callback signifies nothing.
[Version] Release 0.3.49
[Profile] Common
[Issue Type] Code enhancement
Change-Id: I24b74cdbfd0f31cc25a50a347372f6e86dd8bdd1
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
* @details To apply the stream policy according to this stream information, this handle should be passed to other APIs\n
* related to playback or recording. (e.g., player, wav-player, audio-io, etc.)
* @param[in] stream_type The type of stream for internal usage
- * @param[in] callback The focus state change callback function (mandatory)
+ * @param[in] callback The focus state change callback function
* @param[in] user_data The user data to be passed to the callback function
* @param[out] stream_info The handle of stream information
*
Name: capi-media-sound-manager
Summary: Sound Manager library
-Version: 0.3.48
+Version: 0.3.49
Release: 0
Group: Multimedia/API
License: Apache-2.0
memset(stream_h, 0, sizeof(sound_stream_info_s));
ret = _convert_stream_type(stream_type, &stream_h->stream_type);
if (ret == MM_ERROR_NONE) {
- _set_focus_availability(stream_h);
ret = _make_pa_connection_and_register_focus(stream_h, callback, user_data);
if (ret == MM_ERROR_NONE) {
*stream_info = (sound_stream_info_h)stream_h;
LOGI(">> enter");
SM_NULL_ARG_CHECK(stream_info);
- SM_NULL_ARG_CHECK(callback);
SM_ENTER_CRITICAL_SECTION_WITH_RETURN(&g_stream_info_count_mutex, MM_ERROR_SOUND_INTERNAL);
ret = _convert_stream_type_for_internal(stream_type, &stream_h->stream_type);
if (ret == MM_ERROR_NONE) {
_set_focus_availability(stream_h);
+ if (!stream_h->is_focus_unavailable && !callback) {
+ ret = MM_ERROR_INVALID_ARGUMENT;
+ goto LEAVE;
+ }
ret = _make_pa_connection_and_register_focus(stream_h, callback, user_data);
if (!ret) {
*stream_info = (sound_stream_info_h)stream_h;
pa_threaded_mainloop_unlock(stream_h->pa_mainloop);
/* register focus */
- ret = mm_sound_register_focus(stream_h->index, stream_h->stream_type, _focus_state_change_callback, user_data);
- if (ret == MM_ERROR_NONE) {
- int i = 0;
- stream_h->user_cb = callback;
- stream_h->user_data = user_data;
- for (i = 0; i < SOUND_STREAM_INFO_ARR_MAX; i++) {
- if (sound_stream_info_arr[i] == NULL) {
- sound_stream_info_arr[i] = stream_h;
- break;
+ if (!stream_h->is_focus_unavailable) {
+ ret = mm_sound_register_focus(stream_h->index, stream_h->stream_type, _focus_state_change_callback, user_data);
+ if (ret == MM_ERROR_NONE) {
+ int i = 0;
+ stream_h->user_cb = callback;
+ stream_h->user_data = user_data;
+ for (i = 0; i < SOUND_STREAM_INFO_ARR_MAX; i++) {
+ if (sound_stream_info_arr[i] == NULL) {
+ sound_stream_info_arr[i] = stream_h;
+ break;
+ }
}
- }
- if (i == SOUND_STREAM_INFO_ARR_MAX) {
- LOGE("client sound stream info array is full");
- ret = mm_sound_unregister_focus(stream_h->index);
+ if (i == SOUND_STREAM_INFO_ARR_MAX) {
+ LOGE("client sound stream info array is full");
+ ret = mm_sound_unregister_focus(stream_h->index);
+ goto PA_ERROR;
+ }
+ } else {
+ LOGE("failed to register focus, ret(0x%x)", ret);
+ /* disconnect */
goto PA_ERROR;
}
- } else {
- LOGE("failed to register focus, ret(0x%x)", ret);
- /* disconnect */
- goto PA_ERROR;
}
goto SUCCESS;
PA_ERROR_WITH_UNLOCK:
}
/* unregister focus */
- ret = mm_sound_unregister_focus(stream_h->index);
- if (ret)
- LOGE("failed to unregister focus, ret(0x%x)", ret);
+ if (!stream_h->is_focus_unavailable) {
+ ret = mm_sound_unregister_focus(stream_h->index);
+ if (ret)
+ LOGE("failed to unregister focus, ret(0x%x)", ret);
+ }
for (i = 0; i < AVAIL_DEVICES_MAX; i++) {
if (stream_h->stream_conf_info.avail_in_devices[i])
else if (g_menu_state == CURRENT_STATUS_UNSET_DEVICE_INFO_CHANGED_CB)
g_print("*** press enter to unset device information changed cb\n");
else if (g_menu_state == CURRENT_STATUS_CREATE_STREAM_INFO)
- g_print("*** input stream type to create stream information\n(0:media, 1:system, 2:alarm, 3:notification, 4:emergency, 5:ringtone-call, 6:voice-call, 7:voip, 8:media-ext-only, 9:loopback)\n");
+ g_print("*** input stream type to create stream information\n(0:media, 1:system, 2:alarm, 3:notification, 4:emergency, 5:ringtone-call, 6:voice-call, 7:voip, 8:media-ext-only, 9:loopback, 10:solo)\n");
else if (g_menu_state == CURRENT_STATUS_ADD_DEVICE_FOR_STREAM_ROUTING)
g_print("*** input device type to add (0:built-in mic, 1:built-in spk, 2:built-in rcv, 3:audio-jack, 4:bt, 5:usb)\n");
else if (g_menu_state == CURRENT_STATUS_REMOVE_DEVICE_FOR_STREAM_ROUTING)
case 9: /* loopback */
type = SOUND_STREAM_TYPE_LOOPBACK;
break;
+ case 10: /* solo */
+ type = SOUND_STREAM_TYPE_SOLO;
+ break;
default:
type = SOUND_STREAM_TYPE_MEDIA;
break;
type == (int)SOUND_STREAM_TYPE_VOICE_CALL ||
type == (int)SOUND_STREAM_TYPE_LOOPBACK)
ret = sound_manager_create_stream_information_internal(type, focus_callback, NULL, &g_stream_info_h);
+ else if (type == (int)SOUND_STREAM_TYPE_SOLO)
+ ret = sound_manager_create_stream_information_internal(type, NULL, NULL, &g_stream_info_h);
else
ret = sound_manager_create_stream_information(type, focus_callback, NULL, &g_stream_info_h);