Moved the space checking code at proper place. 49/141349/5
authoryogesh manav <yogesh.m@samsung.com>
Mon, 31 Jul 2017 05:57:44 +0000 (11:27 +0530)
committerJeongmo Yang <jm80.yang@samsung.com>
Tue, 29 Aug 2017 10:44:11 +0000 (19:44 +0900)
fixed the coding syntax warnings
Fix for following scenario
1. If recording location is set in mmc card and during audio/video recording if user remove the mmc card, then muse-server used to crash.
2. while recording if device space is over then internally mm-camcorder start dropping the frame, but if in background data copy is in progress
   using MTP, then there is chance that there is no space to write the file header also. as it may be occupied by the data copy.
   so before doing the commit, check the minimum space availability in destination storage type.

[Version] 0.10.132
[Profile] Common
[Issue Type] Bug fix
[Dependency module] N/A

Change-Id: I9ebecd03ff8bb5c7b6782a1d807717090fcd4b6c
Signed-off-by: yogesh manav <yogesh.m@samsung.com>
packaging/libmm-camcorder.spec
src/mm_camcorder_audiorec.c
src/mm_camcorder_videorec.c

index 167cd9a..0e97076 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-camcorder
 Summary:    Camera and recorder library
-Version:    0.10.131
+Version:    0.10.132
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index 14b2337..f0df3e4 100644 (file)
@@ -532,7 +532,7 @@ _mmcamcorder_audio_command(MMHandleType handle, int command)
        case _MMCamcorder_CMD_COMMIT:
        {
                int count = 0;
-
+               guint64 free_space = 0;
                _mmcam_dbg_log("_MMCamcorder_CMD_COMMIT");
 
                if (info->b_commiting) {
@@ -557,6 +557,13 @@ _mmcamcorder_audio_command(MMHandleType handle, int command)
                        usleep(_MMCAMCORDER_FRAME_WAIT_TIME);
                }
 
+               _mmcamcorder_get_freespace(hcamcorder->storage_info.type, &free_space);
+               if (free_space < _MMCAMCORDER_AUDIO_MINIMUM_SPACE) {
+                       _mmcam_dbg_warn("_MMCamcorder_CMD_COMMIT out of storage [%" G_GUINT64_FORMAT "]", free_space);
+                       ret = MM_ERROR_OUT_OF_STORAGE;
+                       goto _ERR_CAMCORDER_AUDIO_COMMAND;
+               }
+
                if (audioSrc) {
                        if (gst_element_send_event(audioSrc, gst_event_new_eos()) == FALSE) {
                                _mmcam_dbg_err("send EOS failed");
index 5d1f681..aad50b2 100644 (file)
@@ -1071,6 +1071,8 @@ int _mmcamcorder_video_command(MMHandleType handle, int command)
        }
        case _MMCamcorder_CMD_COMMIT:
        {
+               guint64 free_space;
+
                if (info->b_commiting) {
                        _mmcam_dbg_err("now on commiting previous file!!(command : %d)", command);
                        return MM_ERROR_CAMCORDER_CMD_IS_RUNNING;
@@ -1140,6 +1142,13 @@ int _mmcamcorder_video_command(MMHandleType handle, int command)
                info->push_encoding_buffer = PUSH_ENCODING_BUFFER_STOP;
                _mmcam_dbg_log("block push buffer to appsrc");
 
+               _mmcamcorder_get_freespace(hcamcorder->storage_info.type, &free_space);
+               if (free_space < _MMCAMCORDER_MINIMUM_SPACE) {
+                       _mmcam_dbg_warn("_MMCamcorder_CMD_COMMIT out of storage [%" G_GUINT64_FORMAT "]", free_space);
+                       ret = MM_ERROR_OUT_OF_STORAGE;
+                       goto _ERR_CAMCORDER_VIDEO_COMMAND;
+               }
+
                if (sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst != NULL) {
                        if (gst_element_send_event(sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst, gst_event_new_eos())) {
                                _mmcam_dbg_warn("VIDEO: send eos to appsrc done");