From: Jeongmo Yang Date: Wed, 2 Dec 2015 09:05:57 +0000 (+0900) Subject: Release version 0.10.19 X-Git-Tag: accepted/tizen/mobile/20151207.123650^0 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fmultimedia%2Flibmm-camcorder.git;a=commitdiff_plain;h=c3da37534dbf4f62cb89c38fac8a7bac1b9a2d2e Release version 0.10.19 1. Fix Svace issues Change-Id: I1ba1386026469ce56731bd2005cf92aea286905f Signed-off-by: Jeongmo Yang --- diff --git a/packaging/libmm-camcorder.spec b/packaging/libmm-camcorder.spec index 8139b64..d9bd1cf 100644 --- a/packaging/libmm-camcorder.spec +++ b/packaging/libmm-camcorder.spec @@ -2,7 +2,7 @@ Name: libmm-camcorder Summary: Camera and recorder library -Version: 0.10.18 +Version: 0.10.19 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 diff --git a/src/mm_camcorder_audiorec.c b/src/mm_camcorder_audiorec.c index c005178..19fceb3 100644 --- a/src/mm_camcorder_audiorec.c +++ b/src/mm_camcorder_audiorec.c @@ -737,7 +737,7 @@ __mmcamcorder_get_decibel(unsigned char* raw, int size, MMCamcorderAudioFormat f } if (count > 0) { - rms = sqrt( square_sum/count ); + rms = sqrt( (double)square_sum/(double)count ); if (depthByte == 1) { db = 20 * log10( rms/MAX_AMPLITUDE_MEAN_08BIT ); } else { diff --git a/src/mm_camcorder_client.c b/src/mm_camcorder_client.c index b8b0c00..d131ab3 100644 --- a/src/mm_camcorder_client.c +++ b/src/mm_camcorder_client.c @@ -1166,20 +1166,16 @@ __mmcamcorder_client_gstreamer_init(camera_conf * conf) /* release */ for (i = 0; i < *argc; i++) { if (argv[i]) { - free(argv[i]); + g_free(argv[i]); argv[i] = NULL; } } - if (argv) { - free(argv); - argv = NULL; - } + free(argv); + argv = NULL; - if (argc) { - free(argc); - argc = NULL; - } + free(argc); + argc = NULL; return ret; diff --git a/src/mm_camcorder_configure.c b/src/mm_camcorder_configure.c index d42b5eb..2119fc9 100644 --- a/src/mm_camcorder_configure.c +++ b/src/mm_camcorder_configure.c @@ -1044,6 +1044,10 @@ int _mmcamcorder_conf_parse_info(MMHandleType handle, int type, FILE* fd, camera else if( *buffer_token[0] == '[' ) { category_name = get_new_string( buffer_token[0] ); + if (category_name == NULL) { + _mmcam_dbg_err("strdup failed for [%s]", buffer_token[0]); + continue; + } count_main_category++; count_details = 0; @@ -1550,20 +1554,20 @@ int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail** info free( new_int_pair_array->name ); new_int_pair_array->name = NULL; } - free( new_int_pair_array ); + g_free( new_int_pair_array ); new_int_pair_array = NULL; _mmcam_dbg_err("allocation failed"); break; } new_int_pair_array->value[1] = (int*)g_malloc( sizeof(int)*(count_value) ); if ( new_int_pair_array->value[1] == NULL ) { - free( new_int_pair_array->value[0] ); + g_free( new_int_pair_array->value[0] ); new_int_pair_array->value[0] = NULL; if (new_int_pair_array->name) { free( new_int_pair_array->name ); new_int_pair_array->name = NULL; } - free( new_int_pair_array ); + g_free( new_int_pair_array ); new_int_pair_array = NULL; _mmcam_dbg_err("allocation failed"); break; @@ -1661,7 +1665,7 @@ int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail** info */ /* add int values */ - if ( new_element->count_int > 0 ) { + if ( new_element->count_int > 0 && new_element->count_int <= 30 ) { new_element->value_int = (type_int2**)g_malloc0( sizeof(type_int2*)*(new_element->count_int) ); if ( new_element->value_int) { for ( j = 0 ; j < new_element->count_int ; j++ ) { @@ -1683,11 +1687,13 @@ int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail** info } else { + _mmcam_dbg_err("invalid count - %d", new_element->count_int); new_element->value_int = NULL; } /* add string values */ - if ( new_element->count_string > 0 ) { + if ( new_element->count_string > 0 && new_element->count_string <= 30 && + new_element->count_int >= 0 && new_element->count_int <= 30 ) { new_element->value_string = (type_string2**)g_malloc0( sizeof(type_string2*)*(new_element->count_string) ); if (new_element->value_string) { for ( ; j < new_element->count_string + new_element->count_int ; j++ ) { @@ -1707,6 +1713,7 @@ int _mmcamcorder_conf_add_info(MMHandleType handle, int type, conf_detail** info _mmcam_dbg_err("malloc failed : %d", sizeof(type_string2*)*(new_element->count_string)); } } else { + _mmcam_dbg_err("invalid count - %d", new_element->count_string); new_element->value_string = NULL; } diff --git a/src/mm_camcorder_gstcommon.c b/src/mm_camcorder_gstcommon.c index 5d4e253..59207ed 100644 --- a/src/mm_camcorder_gstcommon.c +++ b/src/mm_camcorder_gstcommon.c @@ -1019,11 +1019,6 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin element_list = NULL; } - if (video_caps) { - gst_caps_unref(video_caps); - video_caps = NULL; - } - _mmcam_dbg_log("done"); return MM_ERROR_NONE; @@ -1046,11 +1041,6 @@ pipeline_creation_error : element_list = NULL; } - if (video_caps) { - gst_caps_unref(video_caps); - video_caps = NULL; - } - return err; } @@ -1938,8 +1928,8 @@ int _mmcamcorder_check_audiocodec_fileformat_compatibility(MMHandleType handle) } /* Check compatibility between audio codec and file format */ - if (audio_codec >= MM_AUDIO_CODEC_INVALID && audio_codec < MM_AUDIO_CODEC_NUM && - file_format >= MM_FILE_FORMAT_INVALID && file_format < MM_FILE_FORMAT_NUM) { + if (audio_codec > MM_AUDIO_CODEC_INVALID && audio_codec < MM_AUDIO_CODEC_NUM && + file_format > MM_FILE_FORMAT_INVALID && file_format < MM_FILE_FORMAT_NUM) { if (audiocodec_fileformat_compatibility_table[audio_codec][file_format] == 0) { _mmcam_dbg_err("Audio codec[%d] and file format[%d] compatibility FAILED.", audio_codec, file_format); @@ -1977,8 +1967,8 @@ int _mmcamcorder_check_videocodec_fileformat_compatibility(MMHandleType handle) } /* Check compatibility between audio codec and file format */ - if (video_codec >= MM_VIDEO_CODEC_INVALID && video_codec < MM_VIDEO_CODEC_NUM && - file_format >= MM_FILE_FORMAT_INVALID && file_format < MM_FILE_FORMAT_NUM) { + if (video_codec > MM_VIDEO_CODEC_INVALID && video_codec < MM_VIDEO_CODEC_NUM && + file_format > MM_FILE_FORMAT_INVALID && file_format < MM_FILE_FORMAT_NUM) { if (videocodec_fileformat_compatibility_table[video_codec][file_format] == 0) { _mmcam_dbg_err("Video codec[%d] and file format[%d] compatibility FAILED.", video_codec, file_format); @@ -2211,12 +2201,16 @@ bool _mmcamcorder_set_videosrc_caps(MMHandleType handle, unsigned int fourcc, in structure = gst_caps_get_structure(caps, 0); if (structure) { + const gchar *format_string = NULL; int caps_width = 0; int caps_height = 0; int caps_fps = 0; int caps_rotate = 0; - caps_fourcc = _mmcamcorder_convert_fourcc_string_to_value(gst_structure_get_string(structure, "format")); + format_string = gst_structure_get_string(structure, "format"); + if (format_string) { + caps_fourcc = _mmcamcorder_convert_fourcc_string_to_value(format_string); + } gst_structure_get_int(structure, "width", &caps_width); gst_structure_get_int(structure, "height", &caps_height); gst_structure_get_int(structure, "fps", &caps_fps); diff --git a/src/mm_camcorder_internal.c b/src/mm_camcorder_internal.c index c858ff0..003673f 100644 --- a/src/mm_camcorder_internal.c +++ b/src/mm_camcorder_internal.c @@ -1018,30 +1018,30 @@ int _mmcamcorder_realize(MMHandleType handle) _mmcam_dbg_warn("SupportDualStream [%d]", hcamcorder->sub_context->info_video->support_dual_stream); } - switch (display_surface_type) { - case MM_DISPLAY_SURFACE_X: - videosink_element_type = strdup("VideosinkElementX"); - break; - case MM_DISPLAY_SURFACE_EVAS: - videosink_element_type = strdup("VideosinkElementEvas"); - break; - case MM_DISPLAY_SURFACE_GL: - videosink_element_type = strdup("VideosinkElementGL"); - break; - case MM_DISPLAY_SURFACE_NULL: - videosink_element_type = strdup("VideosinkElementNull"); - break; - case MM_DISPLAY_SURFACE_REMOTE: - videosink_element_type = strdup("VideosinkElementRemote"); - break; - default: - videosink_element_type = strdup("VideosinkElementX"); - break; - } - if (socket_path == NULL) { _mmcam_dbg_warn("Socket Path is not properly set, -> to NullSink."); videosink_element_type = strdup("VideosinkElementNull"); + } else { + switch (display_surface_type) { + case MM_DISPLAY_SURFACE_X: + videosink_element_type = strdup("VideosinkElementX"); + break; + case MM_DISPLAY_SURFACE_EVAS: + videosink_element_type = strdup("VideosinkElementEvas"); + break; + case MM_DISPLAY_SURFACE_GL: + videosink_element_type = strdup("VideosinkElementGL"); + break; + case MM_DISPLAY_SURFACE_NULL: + videosink_element_type = strdup("VideosinkElementNull"); + break; + case MM_DISPLAY_SURFACE_REMOTE: + videosink_element_type = strdup("VideosinkElementRemote"); + break; + default: + videosink_element_type = strdup("VideosinkElementX"); + break; + } } /* check string of videosink element */ @@ -2435,7 +2435,7 @@ __mmcamcorder_gstreamer_init(camera_conf * conf) /* release */ for (i = 0; i < *argc; i++) { if (argv[i]) { - free(argv[i]); + g_free(argv[i]); argv[i] = NULL; } } diff --git a/src/mm_camcorder_platform.c b/src/mm_camcorder_platform.c index 992da88..2896d0b 100644 --- a/src/mm_camcorder_platform.c +++ b/src/mm_camcorder_platform.c @@ -695,7 +695,7 @@ int _mmcamcorder_get_fps_array_by_resolution(MMHandleType handle, int width, int MMCamAttrsInfo *infoW = NULL; MMCamAttrsInfo *infoH = NULL; int i = 0; - char nameFps[5] = {0,}; + char nameFps[10] = {0,}; bool valid_check = false; type_int_array *fps_array; @@ -705,7 +705,20 @@ int _mmcamcorder_get_fps_array_by_resolution(MMHandleType handle, int width, int //_mmcam_dbg_log("prev resolution w:%d, h:%d", width, height); infoW = (MMCamAttrsInfo*)calloc(1, sizeof(MMCamAttrsInfo)); + if (infoW == NULL) { + _mmcam_dbg_err("failed to alloc infoW"); + return MM_ERROR_CAMCORDER_LOW_MEMORY; + } + infoH = (MMCamAttrsInfo*)calloc(1, sizeof(MMCamAttrsInfo)); + if (infoH == NULL) { + _mmcam_dbg_err("failed to alloc infoH"); + + free(infoW); + infoW = NULL; + + return MM_ERROR_CAMCORDER_LOW_MEMORY; + } mm_camcorder_get_attribute_info(handle, MMCAM_CAMERA_WIDTH, infoW); mm_camcorder_get_attribute_info(handle, MMCAM_CAMERA_HEIGHT, infoH); @@ -714,16 +727,16 @@ int _mmcamcorder_get_fps_array_by_resolution(MMHandleType handle, int width, int //_mmcam_dbg_log("width :%d, height : %d\n", infoW->int_array.array[i], infoH->int_array.array[i]); if(infoW->int_array.array[i] == width && infoH->int_array.array[i] == height) { valid_check = true; - sprintf(nameFps, "FPS%d", i); + snprintf(nameFps, 10, "FPS%d", i); _mmcam_dbg_log("nameFps : %s!!!", nameFps); break; } } - if(infoW) - free(infoW); - if(infoH) - free(infoH); + free(infoW); + infoW = NULL; + free(infoH); + infoH = NULL; if(!valid_check) { _mmcam_dbg_err("FAILED : Can't find the valid resolution from attribute."); diff --git a/src/mm_camcorder_sound.c b/src/mm_camcorder_sound.c index 24c720a..ef8c7d7 100644 --- a/src/mm_camcorder_sound.c +++ b/src/mm_camcorder_sound.c @@ -509,10 +509,13 @@ gboolean _mmcamcorder_sound_play(MMHandleType handle, const char *sample_name, g NULL); */ } + +/* if (pulse_op) { pa_operation_unref(pulse_op); pulse_op = NULL; } +*/ pthread_mutex_unlock(&(info->open_mutex)); diff --git a/src/mm_camcorder_stillshot.c b/src/mm_camcorder_stillshot.c index 3209b82..7648537 100644 --- a/src/mm_camcorder_stillshot.c +++ b/src/mm_camcorder_stillshot.c @@ -2088,8 +2088,8 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int /* get ExifData from exif info */ ed = mm_exif_get_exif_from_info(hcamcorder->exif_info); - if (ed == NULL || ed->ifd == NULL) { - _mmcam_dbg_err("get exif data error!!(%p, %p)", ed, (ed ? ed->ifd : NULL)); + if (ed == NULL) { + _mmcam_dbg_err("get exif data error!!"); return MM_ERROR_INVALID_HANDLE; } @@ -2204,16 +2204,22 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int #endif /*6. EXIF_TAG_IMAGE_DESCRIPTION */ mm_camcorder_get_attributes(handle, NULL, MMCAM_TAG_IMAGE_DESCRIPTION, &str_value, &str_val_len, NULL); - _mmcam_dbg_log("desctiption [%s]", str_value); if (str_value && str_val_len > 0) { char *description = strdup(str_value); - ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_IMAGE_DESCRIPTION, - EXIF_FORMAT_ASCII, strlen(description), (const char *)description); - free(description); - str_value = NULL; - str_val_len = 0; - if (ret != MM_ERROR_NONE) { - EXIF_SET_ERR(ret, EXIF_TAG_IMAGE_DESCRIPTION); + + _mmcam_dbg_log("desctiption [%s]", str_value); + + if (description) { + ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_IMAGE_DESCRIPTION, + EXIF_FORMAT_ASCII, strlen(description), (const char *)description); + free(description); + str_value = NULL; + str_val_len = 0; + if (ret != MM_ERROR_NONE) { + EXIF_SET_ERR(ret, EXIF_TAG_IMAGE_DESCRIPTION); + } + } else { + _mmcam_dbg_err("strdup failed for [%s]", str_value); } } else { _mmcam_dbg_warn("failed to get description"); diff --git a/src/mm_camcorder_util.c b/src/mm_camcorder_util.c index acfc1ef..5ba8c20 100644 --- a/src/mm_camcorder_util.c +++ b/src/mm_camcorder_util.c @@ -1527,7 +1527,7 @@ gboolean _mmcamcorder_link_elements(GList *element_list) while (local_list) { element = (_MMCamcorderGstElement*)local_list->data; - if (element && element->gst) { + if (pre_element && pre_element->gst && element && element->gst) { if (_MM_GST_ELEMENT_LINK(GST_ELEMENT(pre_element->gst), GST_ELEMENT(element->gst))) { _mmcam_dbg_log("Link [%s] to [%s] OK", GST_ELEMENT_NAME(GST_ELEMENT(pre_element->gst)), diff --git a/test/mm_camcorder_testsuite.c b/test/mm_camcorder_testsuite.c index 85db5f0..9bdc7df 100644 --- a/test/mm_camcorder_testsuite.c +++ b/test/mm_camcorder_testsuite.c @@ -1400,7 +1400,7 @@ static void setting_menu(gchar buf) } err = scanf("%d",&idx); - if( idx > 0 && idx <= count ) { + if( idx > 0 && idx <= count && count <= 30) { bret = camcordertest_set_attr_int("camera-shutter-speed", array[idx-1]); } }