From: jiyong.min Date: Fri, 28 Jul 2023 03:26:11 +0000 (+0900) Subject: Code cleanup. remove unnecessary code X-Git-Tag: accepted/tizen/unified/20230731.175319^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Faccepted%2Ftizen_8.0_unified;p=platform%2Fcore%2Fmultimedia%2Flibmm-fileinfo.git Code cleanup. remove unnecessary code Change-Id: I4c07c92c5e74e9b06812f7be19570140c425534c --- diff --git a/formats/ffmpeg/mm_file_format_amr.c b/formats/ffmpeg/mm_file_format_amr.c index 496d59e..bfa78ac 100644 --- a/formats/ffmpeg/mm_file_format_amr.c +++ b/formats/ffmpeg/mm_file_format_amr.c @@ -239,11 +239,9 @@ static bool __mmfile_amrparser_open(MMFileAMRHandle *handle, const char *path) return true; exception: - if (privateData) { - mmfile_close(privateData->hFile); - mmfile_free(privateData); - *handle = NULL; - } + mmfile_close(privateData->hFile); + mmfile_free(privateData); + *handle = NULL; return false; } diff --git a/formats/ffmpeg/mm_file_format_ffmpeg.c b/formats/ffmpeg/mm_file_format_ffmpeg.c index ca4729e..457a7f4 100644 --- a/formats/ffmpeg/mm_file_format_ffmpeg.c +++ b/formats/ffmpeg/mm_file_format_ffmpeg.c @@ -561,14 +561,12 @@ int mmfile_format_read_stream_ffmpg(MMFileFormatContext *formatContext) formatContext->audioTotalTrackNum += 1; pAudioCodecCtx = pFormatCtx->streams[i]->codecpar; - if (pAudioCodecCtx) { - audioStream->codecId = __convert_audio_codec_type(pAudioCodecCtx->codec_id); - audioStream->bitRate = pAudioCodecCtx->bit_rate; - audioStream->nbChannel = pAudioCodecCtx->ch_layout.nb_channels; - audioStream->samplePerSec = pAudioCodecCtx->sample_rate; - audioStream->bitPerSample = pAudioCodecCtx->bits_per_coded_sample; - audioStream->is_uhqa = __check_uhqa(audioStream->samplePerSec, pFormatCtx->streams[i]->codecpar->format); - } + audioStream->codecId = __convert_audio_codec_type(pAudioCodecCtx->codec_id); + audioStream->bitRate = pAudioCodecCtx->bit_rate; + audioStream->nbChannel = pAudioCodecCtx->ch_layout.nb_channels; + audioStream->samplePerSec = pAudioCodecCtx->sample_rate; + audioStream->bitPerSample = pAudioCodecCtx->bits_per_coded_sample; + audioStream->is_uhqa = __check_uhqa(audioStream->samplePerSec, pFormatCtx->streams[i]->codecpar->format); } } diff --git a/formats/ffmpeg/mm_file_format_frame.c b/formats/ffmpeg/mm_file_format_frame.c index ad34515..80c85d2 100755 --- a/formats/ffmpeg/mm_file_format_frame.c +++ b/formats/ffmpeg/mm_file_format_frame.c @@ -497,10 +497,8 @@ static int __mmfile_get_frame(AVFormatContext *pFormatCtx, #endif debug_msg(RELEASE, "frame : %p", *frame); - if (pFrame) - av_frame_free(&pFrame); - if (pVideoCodecCtx) - avcodec_free_context(&pVideoCodecCtx); + av_frame_free(&pFrame); + avcodec_free_context(&pVideoCodecCtx); return MMFILE_FORMAT_SUCCESS; @@ -509,8 +507,7 @@ exception: if (pFrame) av_frame_free(&pFrame); - if (pVideoCodecCtx) - avcodec_free_context(&pVideoCodecCtx); + avcodec_free_context(&pVideoCodecCtx); return ret; } diff --git a/packaging/libmm-fileinfo.spec b/packaging/libmm-fileinfo.spec index 050a961..29c8bdb 100644 --- a/packaging/libmm-fileinfo.spec +++ b/packaging/libmm-fileinfo.spec @@ -1,6 +1,6 @@ Name: libmm-fileinfo Summary: Media Fileinfo -Version: 1.0.19 +Version: 1.0.20 Release: 0 Group: System/Libraries License: Apache-2.0 diff --git a/utils/mm_file_util_io_mmap.c b/utils/mm_file_util_io_mmap.c index 3510df6..143862c 100755 --- a/utils/mm_file_util_io_mmap.c +++ b/utils/mm_file_util_io_mmap.c @@ -95,19 +95,17 @@ static int mmf_mmap_open(MMFileIOHandle *handle, const char *filename, int flags return MMFILE_UTIL_SUCCESS; exception: - if (mmapHandle) { - if (mmapHandle->ptr) { - munmap(mmapHandle->ptr, mmapHandle->size); - } - - if (mmapHandle->fd > 2) { - close(mmapHandle->fd); - } + if (mmapHandle->ptr) { + munmap(mmapHandle->ptr, mmapHandle->size); + } - mmfile_free(mmapHandle); - handle->privateData = NULL; + if (mmapHandle->fd > 2) { + close(mmapHandle->fd); } + mmfile_free(mmapHandle); + handle->privateData = NULL; + return MMFILE_UTIL_FAIL; }