X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fmm_camcorder_attribute.c;h=03936ca19e674be40a96804040c58086d65f96d8;hb=567f5bf506bdb602829ae3aab4e5a798bfcc2aaf;hp=e67998576d4f4a4b9b716d17bc3f17b43c757fa1;hpb=58b89b47284e82422eb4b49e13311bf25444f5f6;p=platform%2Fcore%2Fmultimedia%2Flibmm-camcorder.git diff --git a/src/mm_camcorder_attribute.c b/src/mm_camcorder_attribute.c index e679985..03936ca 100644 --- a/src/mm_camcorder_attribute.c +++ b/src/mm_camcorder_attribute.c @@ -1576,6 +1576,17 @@ _mmcamcorder_alloc_attribute(MMHandleType handle, MMCamPreset *info) {0}, {0}, NULL, + }, + { + MM_CAM_GDBUS_CONNECTION, + "gdbus-connection", + MMF_VALUE_TYPE_DATA, + MM_ATTRS_FLAG_RW, + {(void*)NULL}, + MM_ATTRS_VALID_TYPE_NONE, + {0}, + {0}, + NULL, } }; @@ -4522,41 +4533,64 @@ bool _mmcamcorder_commit_pid_for_sound_focus(MMHandleType handle, int attr_idx, new_pid = value->value.i_val; - _mmcam_dbg_log("Commit : pid %d, current sound_focus_register %d, sound_focus_id %d", - new_pid, hcamcorder->sound_focus_register, hcamcorder->sound_focus_id); + _mmcam_dbg_log("Commit : pid %d, current focus id %d, subscribe id %u", + new_pid, hcamcorder->sound_focus_id, hcamcorder->sound_focus_subscribe_id); + + /* unregister sound focus and unsubscribe sound signal before set new one */ + if (hcamcorder->sound_focus_id > 0) { + mm_sound_unregister_focus(hcamcorder->sound_focus_id); + _mmcam_dbg_log("unregister sound focus done"); + hcamcorder->sound_focus_id = 0; + } - /* unregister sound focus before set new one */ - if (hcamcorder->sound_focus_register && hcamcorder->sound_focus_id > 0) { - if (MM_ERROR_NONE != mm_sound_unregister_focus(hcamcorder->sound_focus_id)) { - _mmcam_dbg_err("mm_sound_unregister_focus[id %d] failed", hcamcorder->sound_focus_id); + if (hcamcorder->sound_focus_subscribe_id > 0) { + mm_sound_unsubscribe_signal(hcamcorder->sound_focus_subscribe_id); + _mmcam_dbg_log("unsubscribe sound signal done"); + hcamcorder->sound_focus_subscribe_id = 0; + } + + ret = _mm_session_util_read_information(new_pid, &hcamcorder->session_type, &hcamcorder->session_flags); + if (ret == MM_ERROR_NONE) { + if (hcamcorder->session_type == MM_SESSION_TYPE_REPLACED_BY_STREAM) { + hcamcorder->sound_focus_register = FALSE; + _mmcam_dbg_warn("no need to use sound focus internally"); } else { - _mmcam_dbg_log("mm_sound_unregister_focus[id %d] done", hcamcorder->sound_focus_id); + ret = mm_sound_focus_get_id(&hcamcorder->sound_focus_id); + if (ret != MM_ERROR_NONE) { + _mmcam_dbg_err("mm_sound_focus_get_id failed"); + hcamcorder->error_code = MM_ERROR_POLICY_BLOCKED; + return FALSE; + } + + ret = mm_sound_register_focus_for_session(hcamcorder->sound_focus_id, + new_pid, "media", _mmcamcorder_sound_focus_cb, hcamcorder); + if (ret != MM_ERROR_NONE) { + _mmcam_dbg_err("mm_sound_register_focus_for_session failed 0x%x", ret); + hcamcorder->sound_focus_id = 0; + hcamcorder->error_code = MM_ERROR_POLICY_BLOCKED; + return FALSE; + } + + hcamcorder->sound_focus_register = TRUE; + + _mmcam_dbg_log("mm_sound_register_focus_for_session done - id %d, session type %d, flags 0x%x", + hcamcorder->sound_focus_id, hcamcorder->session_type, hcamcorder->session_flags); } } else { - _mmcam_dbg_log("no need to unregister sound focus"); - } + hcamcorder->session_type = 0; + hcamcorder->session_flags = 0; + hcamcorder->sound_focus_register = TRUE; - /* register sound focus */ - if (hcamcorder->sound_focus_register) { - hcamcorder->sound_focus_id = 0; - if (MM_ERROR_NONE != mm_sound_focus_get_id(&hcamcorder->sound_focus_id)) { - _mmcam_dbg_err("mm_sound_focus_get_uniq failed"); - hcamcorder->error_code = MM_ERROR_POLICY_BLOCKED; - return FALSE; - } + _mmcam_dbg_warn("read session info failed. sound focus watch cb will be set."); - ret = mm_sound_register_focus_for_session(hcamcorder->sound_focus_id, - new_pid, "media", _mmcamcorder_sound_focus_cb, hcamcorder); + ret = mm_sound_subscribe_signal_for_daemon(MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS, + new_pid, &hcamcorder->sound_focus_subscribe_id, + (mm_sound_signal_callback)_mmcamcorder_sound_signal_callback, (void*)hcamcorder); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("mm_sound_register_focus failed"); + _mmcam_dbg_err("subscribe sound signal failed [0x%x]", ret); hcamcorder->error_code = MM_ERROR_POLICY_BLOCKED; return FALSE; } - - _mmcam_dbg_log("mm_sound_register_focus done - id %d, session type %d, flags 0x%x", - hcamcorder->sound_focus_id, hcamcorder->session_type, hcamcorder->session_flags); - } else { - _mmcam_dbg_log("no need to register sound focus"); } return TRUE;