Fix crash when destroy if capture sound played callback is not called 06/104306/1 accepted/tizen/common/20161214.160455 accepted/tizen/ivi/20161214.015311 accepted/tizen/mobile/20161214.014820 accepted/tizen/tv/20161214.015105 accepted/tizen/wearable/20161214.015208 submit/tizen/20161213.083228
authorJeongmo Yang <jm80.yang@samsung.com>
Tue, 13 Dec 2016 05:06:37 +0000 (14:06 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Tue, 13 Dec 2016 05:06:37 +0000 (14:06 +0900)
[Version] 0.10.98
[Profile] Common
[Issue Type] Fix crash
[Dependency module] N/A
[Test] [M(T) - Boot=(OK), sdb=(OK), Home=(OK), Touch=(OK), Version=tizen-3.0-mobile_20161212.2]

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

index 7ba7407..08c7e33 100644 (file)
@@ -1,7 +1,7 @@
 Name:       libmm-camcorder
 Summary:    Camera and recorder library
-Version:    0.10.97
-Release:    1
+Version:    0.10.98
+Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
index c2c6d20..3eb1590 100644 (file)
@@ -3782,7 +3782,8 @@ void __mmcamcorder_force_stop(mmf_camcorder_t *hcamcorder)
                        _mmcam_dbg_warn("Stop recording.");
 
                        while ((itr_cnt--) && ((result = _mmcamcorder_commit((MMHandleType)hcamcorder)) != MM_ERROR_NONE)) {
-                               _mmcam_dbg_warn("Can't commit.(%x)", result);
+                               _mmcam_dbg_warn("Can't commit.(%x), cancel it.", result);
+                               _mmcamcorder_cancel((MMHandleType)hcamcorder);
                        }
 
                        break;
index 48abcf8..961670c 100644 (file)
@@ -170,6 +170,7 @@ gboolean _mmcamcorder_sound_finalize(MMHandleType handle)
 int _mmcamcorder_sound_solo_play(MMHandleType handle, const char *sample_name, gboolean sync_play)
 {
        int sound_enable = TRUE;
+       int current_state = MM_CAMCORDER_STATE_NONE;
 
        mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
 
@@ -179,6 +180,12 @@ int _mmcamcorder_sound_solo_play(MMHandleType handle, const char *sample_name, g
 
        _mmcamcorder_sound_solo_play_wait(handle);
 
+       current_state = _mmcamcorder_get_state(handle);
+       if (current_state < MM_CAMCORDER_STATE_PREPARE) {
+               _mmcam_dbg_warn("invalid state %d", current_state);
+               return FALSE;
+       }
+
        /* check sound play enable */
        mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL,
                "capture-sound-enable", &sound_enable,
@@ -222,7 +229,7 @@ void _mmcamcorder_sound_solo_play_wait(MMHandleType handle)
 
                _mmcam_dbg_log("Wait for signal");
 
-               end_time = g_get_monotonic_time() + (2 * G_TIME_SPAN_SECOND);
+               end_time = g_get_monotonic_time() + G_TIME_SPAN_SECOND;
 
                if (g_cond_wait_until(&hcamcorder->gdbus_info_solo_sound.sync_cond,
                        &hcamcorder->gdbus_info_solo_sound.sync_mutex, end_time)) {