If it is set to NULL, SOUND_MANAGER_ERROR_POLICY will be returned when calling sound_manager_acquire_focus().
[Version] Release 0.3.62
[Profile] Common
[Issue Type] Policy
Change-Id: I725d6227580327ac529fe572009747501446a91b
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
* related to playback or recording.(e.g. player, wav-player, audio-io, etc.)
*
* @param[in] stream_type The type of stream
- * @param[in] callback The focus state change callback function (mandatory)
- * @param[in] user_data The user data to be passed to the callback function
+ * @param[in] callback The focus state change callback function (optional, this can be null)
+ * @param[in] user_data The user data to be passed to the callback function (optional, this can be null)
* @param[out] stream_info The handle of stream information
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SOUND_MANAGER_ERROR_INVALID_STATE Invalid state
* @retval #SOUND_MANAGER_ERROR_POLICY Noncompliance with the sound system policy
* @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
- * @pre Call sound_manager_create_stream_information() before calling this function.
+ * @pre Call sound_manager_create_stream_information() with its parameter for sound_stream_focus_state_changed_cb before calling this function.
* @see sound_manager_create_stream_information()
* @see sound_manager_destroy_stream_information()
* @see sound_manager_release_focus()
Name: capi-media-sound-manager
Summary: Sound Manager library
-Version: 0.3.61
+Version: 0.3.62
Release: 0
Group: Multimedia/API
License: Apache-2.0
LOGI(">> enter");
SM_NULL_ARG_CHECK(stream_info);
- SM_NULL_ARG_CHECK(callback);
if (g_session_interrupt_cb_table.is_registered)
return _convert_sound_manager_error_code(__func__, MM_ERROR_SOUND_INTERNAL);
SM_INSTANCE_CHECK(stream_h);
- if (stream_h->is_focus_unavailable)
+ if (stream_h->is_focus_unavailable) {
+ LOGE("acquiring focus is not allowed for this strema type(%s)", stream_h->stream_type);
return _convert_sound_manager_error_code(__func__, MM_ERROR_POLICY_INTERNAL);
+ }
+
+ if (stream_h->user_cb == NULL) {
+ LOGE("focus state changed callback should be set before acquiring focus");
+ return _convert_sound_manager_error_code(__func__, MM_ERROR_POLICY_INTERNAL);
+ }
ret = mm_sound_acquire_focus(stream_h->index, (mm_sound_focus_type_e)focus_mask, extra_info);
if (ret == MM_ERROR_NONE) {
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;