Unset focus watch callback when sound stream info is set 69/117169/1
authorJeongmo Yang <jm80.yang@samsung.com>
Tue, 28 Feb 2017 02:37:41 +0000 (11:37 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Fri, 3 Mar 2017 05:53:29 +0000 (14:53 +0900)
Sound signal to unset focus watch callback is missed or the reading session is failed because of some reason.
This patch unset focus watch callback explicitly when sound stream info is set,
because it means sound focus related function should be controlled by application.

[Version] 0.10.107
[Profile] Common
[Issue Type] Update
[Dependency module] N/A
[Test] [M(T) - Boot=(OK), sdb=(OK), Home=(OK), Touch=(OK), Version=tizen-3.0-mobile_20170227.2]

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

index b487f485e90edc58844c3733f6a27cab72fbcef2..670ca6488af5cfed73030005bd19c21a9ec1c880 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-camcorder
 Summary:    Camera and recorder library
-Version:    0.10.108
+Version:    0.10.109
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index 10c62131c88dcd877ed2e3b2ff005b92b4c4dccc..70b608afb4c46409e7b0922777aef2e8a4b7cf50 100644 (file)
@@ -4604,7 +4604,7 @@ 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 focus id %d, subscribe id %u",
+       _mmcam_dbg_warn("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 */
@@ -4682,13 +4682,6 @@ bool _mmcamcorder_commit_sound_stream_info(MMHandleType handle, int attr_idx, co
                return FALSE;
        }
 
-       sc = MMF_CAMCORDER_SUBCONTEXT(handle);
-       if (!sc || !sc->encode_element ||
-           !sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst) {
-               _mmcam_dbg_log("audiosrc element is not initialized, it will be set later");
-               return TRUE;
-       }
-
        mm_camcorder_get_attributes(handle, NULL,
                MMCAM_SOUND_STREAM_INDEX, &stream_index,
                NULL);
@@ -4697,7 +4690,17 @@ bool _mmcamcorder_commit_sound_stream_info(MMHandleType handle, int attr_idx, co
                return FALSE;
        }
 
-       _mmcam_dbg_log("Commit : sound stream info - type %s, index %d", stream_type, stream_index);
+       /* unset watch callback if existed */
+       _mmcamcorder_sound_signal_callback(MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS, 1, (void *)handle);
+
+       sc = MMF_CAMCORDER_SUBCONTEXT(handle);
+       if (!sc || !sc->encode_element ||
+           !sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst) {
+               _mmcam_dbg_warn("audiosrc element is not initialized, it will be set later");
+               return TRUE;
+       }
+
+       _mmcam_dbg_warn("Commit : sound stream info - type %s, index %d", stream_type, stream_index);
 
        return _mmcamcorder_set_sound_stream_info(sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst, stream_type, stream_index);
 }
index 7dd6f6b23fb5b77622678cea6378d8981963a66c..287a0033a3c9cae32a53d502704e55b1e964bfbd 100644 (file)
@@ -2865,7 +2865,7 @@ bool _mmcamcorder_set_sound_stream_info(GstElement *element, char *stream_type,
                "props,media.role=%s, media.parent_id=%d",
                stream_type, stream_index);
 
-       _mmcam_dbg_log("stream type %s, index %d -> [%s]", stream_type, stream_index, stream_props);
+       _mmcam_dbg_warn("stream type %s, index %d -> [%s]", stream_type, stream_index, stream_props);
 
        props = gst_structure_from_string(stream_props, NULL);
        if (!props) {
index a32c6991227e40829f18933d23e3dfd58e38872a..61e71a62346460c5b0f0b8c1a311d807e02dc702 100644 (file)
@@ -3353,9 +3353,22 @@ void _mmcamcorder_sound_signal_callback(mm_sound_signal_name_t signal, int value
        _MMCAMCORDER_LOCK_ASM(hcamcorder);
 
        if (signal == MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS && value == 1) {
-               _mmcam_dbg_warn("watch cb id %d", hcamcorder->sound_focus_watch_id);
+               _mmcam_dbg_warn("focus id %d, focus watch id %d",
+                       hcamcorder->sound_focus_id, hcamcorder->sound_focus_watch_id);
+
+               /* unregister focus related callback */
+               if (hcamcorder->sound_focus_id > 0) {
+                       if (hcamcorder->acquired_focus > 0) {
+                               mm_sound_release_focus(hcamcorder->sound_focus_id, hcamcorder->acquired_focus, NULL);
+                               _mmcam_dbg_warn("release acquired focus [focus %d] done", hcamcorder->acquired_focus);
+                               hcamcorder->acquired_focus = 0;
+                       }
+
+                       mm_sound_unregister_focus(hcamcorder->sound_focus_id);
+                       _mmcam_dbg_warn("unregister sound focus done");
+                       hcamcorder->sound_focus_id = 0;
+               }
 
-               /* unregister watch callback */
                if (hcamcorder->sound_focus_watch_id > 0) {
                        mm_sound_unset_focus_watch_callback(hcamcorder->sound_focus_watch_id);
                        _mmcam_dbg_warn("unset watch cb done");