Skip DPM check if audio is disabled when start recording 28/128228/1
authorJeongmo Yang <jm80.yang@samsung.com>
Mon, 8 May 2017 06:31:20 +0000 (15:31 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Mon, 8 May 2017 06:31:20 +0000 (15:31 +0900)
[Version] 0.10.120
[Profile] Common
[Issue Type] Update
[Dependency module] N/A
[Test] [M(T) - Boot=(OK), sdb=(OK), Home=(OK), Touch=(OK), Version=tizen-unified_20170502.4]

Change-Id: I819d004faafe0a2d2b0f3bd72db7b938549f3db9
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
packaging/libmm-camcorder.spec
src/mm_camcorder_internal.c
src/mm_camcorder_videorec.c

index 2acb96b..3cd3508 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-camcorder
 Summary:    Camera and recorder library
-Version:    0.10.119
+Version:    0.10.120
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index 60c2dd1..e0a4e73 100644 (file)
@@ -1773,18 +1773,22 @@ int _mmcamcorder_record(MMHandleType handle)
 {
        int ret = MM_ERROR_NONE;
        int state = MM_CAMCORDER_STATE_NONE;
+       int audio_disable = FALSE;
        int dpm_mic_state = DPM_ALLOWED;
 
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+       _MMCamcorderSubContext *sc = NULL;
 
        _mmcam_dbg_log("");
 
-       if (!hcamcorder) {
+       if (!hcamcorder || !MMF_CAMCORDER_SUBCONTEXT(hcamcorder)) {
                _mmcam_dbg_err("Not initialized");
                ret = MM_ERROR_CAMCORDER_NOT_INITIALIZED;
                return ret;
        }
 
+       sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+
        if (!_MMCAMCORDER_TRYLOCK_CMD(hcamcorder)) {
                _mmcam_dbg_err("Another command is running.");
                ret = MM_ERROR_CAMCORDER_CMD_IS_RUNNING;
@@ -1801,8 +1805,15 @@ int _mmcamcorder_record(MMHandleType handle)
        /* initialize error code */
        hcamcorder->error_code = MM_ERROR_NONE;
 
+       /* get audio disable */
+       mm_camcorder_get_attributes(handle, NULL,
+               MMCAM_AUDIO_DISABLE, &sc->audio_disable,
+               NULL);
+
+       sc->audio_disable |= sc->is_modified_rate;
+
        /* check mic policy from DPM */
-       if (hcamcorder->dpm_handle) {
+       if (hcamcorder->dpm_handle && sc->audio_disable == FALSE) {
                if (dpm_restriction_get_microphone_state(hcamcorder->dpm_handle, &dpm_mic_state) == DPM_ERROR_NONE) {
                        _mmcam_dbg_log("DPM mic state %d", dpm_mic_state);
                        if (dpm_mic_state == DPM_DISALLOWED) {
@@ -1817,7 +1828,8 @@ int _mmcamcorder_record(MMHandleType handle)
                        _mmcam_dbg_err("get DPM mic state failed, keep going...");
                }
        } else {
-               _mmcam_dbg_warn("NULL dpm_handle");
+               _mmcam_dbg_warn("skip dpm check - handle %p, audio disable %d",
+                       hcamcorder->dpm_handle, sc->audio_disable);
        }
 
        ret = hcamcorder->command((MMHandleType)hcamcorder, _MMCamcorder_CMD_RECORD);
index fee3fe5..995ec2a 100644 (file)
@@ -130,7 +130,6 @@ int _mmcamcorder_create_recorder_pipeline(MMHandleType handle)
 {
        int i = 0;
        int err = MM_ERROR_NONE;
-       int audio_disable = FALSE;
        const char* gst_element_rsink_name = NULL;
 
        GstBus *bus = NULL;
@@ -165,16 +164,13 @@ int _mmcamcorder_create_recorder_pipeline(MMHandleType handle)
 
        /* get audio disable */
        mm_camcorder_get_attributes(handle, NULL,
-               MMCAM_AUDIO_DISABLE, &audio_disable,
+               MMCAM_AUDIO_DISABLE, &sc->audio_disable,
                NULL);
 
-       if (sc->is_modified_rate || audio_disable)
-               sc->audio_disable = TRUE;
-       else
-               sc->audio_disable = FALSE;
+       _mmcam_dbg_log("MMCAM_AUDIO_DISABLE %d, is_modified_rate %d",
+               sc->audio_disable, sc->is_modified_rate);
 
-       _mmcam_dbg_log("AUDIO DISABLE : %d (is_modified_rate %d, audio_disable %d)",
-               sc->audio_disable, sc->is_modified_rate, audio_disable);
+       sc->audio_disable |= sc->is_modified_rate;
 
        if (sc->audio_disable == FALSE) {
                /* create audiosrc bin */