From 6d11af155e438f72a6290b42e413e41935c01f0f Mon Sep 17 00:00:00 2001 From: Jiyong Date: Wed, 5 Mar 2025 08:45:33 +0900 Subject: [PATCH] Bug fix. Incorrect width and height for specific mpegts [Cause] - Side effect of reducing the probesize for mpegts [Solution] - Adjust the probesize for mpegts Change-Id: I3b1090b5eee9426ba0119d553e33549a755de9a2 --- formats/ffmpeg/mm_file_format_ffmpeg.c | 16 ++++++++++++---- mm_file_config.ini | 1 + packaging/libmm-fileinfo.spec | 2 +- utils/include/mm_file_utils.h | 18 ++++++++++-------- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/formats/ffmpeg/mm_file_format_ffmpeg.c b/formats/ffmpeg/mm_file_format_ffmpeg.c index c3e01e9..a6f7165 100644 --- a/formats/ffmpeg/mm_file_format_ffmpeg.c +++ b/formats/ffmpeg/mm_file_format_ffmpeg.c @@ -36,6 +36,7 @@ static int g_max_analyze_duration = 0; static int g_probesize = 0; +static int g_probesize_mpegts = 0; #ifdef __MMFILE_TEST_MODE__ static void _dump_av_packet(AVPacket *pkt) @@ -474,10 +475,17 @@ int mmfile_format_read_stream_ffmpg(MMFileFormatContext *formatContext) g_max_analyze_duration = mmfile_get_int_from_ini(MMFILE_INI_MAXANLDURATION, MMFILE_DEFAULT_MAXANLDURATION); if (g_probesize == 0) g_probesize = mmfile_get_int_from_ini(MMFILE_INI_PROBESIZE, MMFILE_DEFAULT_PROBESIZE); - - if (formatContext->formatType == MM_FILE_FORMAT_M2TS) - pFormatCtx->max_analyze_duration = g_max_analyze_duration; // MPEGTS file timeout set - pFormatCtx->probesize = g_probesize; // the size of the data(packet) to probe stream information + if (g_probesize_mpegts == 0) + g_probesize_mpegts = mmfile_get_int_from_ini(MMFILE_INI_PROBESIZE_MPEGTS, MMFILE_DEFAULT_PROBESIZE_MPEGTS); + + if (formatContext->formatType == MM_FILE_FORMAT_M2TS) { + // set the duration of the data to read + pFormatCtx->max_analyze_duration = g_max_analyze_duration; + // set the number of the bytes to probe stream information + pFormatCtx->probesize = g_probesize_mpegts; + } else { + pFormatCtx->probesize = g_probesize; + } debug_msg(RELEASE, "max_analyze_duration: %"PRId64", probesize: %"PRId64"", pFormatCtx->max_analyze_duration, pFormatCtx->probesize); diff --git a/mm_file_config.ini b/mm_file_config.ini index 5906563..3608cd4 100644 --- a/mm_file_config.ini +++ b/mm_file_config.ini @@ -8,3 +8,4 @@ junk_counter_limit=1000 max_analyze_duration=100000 probesize=50000 +probesize_for_mpegts=265000 diff --git a/packaging/libmm-fileinfo.spec b/packaging/libmm-fileinfo.spec index 0e31430..79dbee8 100644 --- a/packaging/libmm-fileinfo.spec +++ b/packaging/libmm-fileinfo.spec @@ -1,6 +1,6 @@ Name: libmm-fileinfo Summary: Media Fileinfo -Version: 1.1.2 +Version: 1.1.3 Release: 0 Group: System/Libraries License: Apache-2.0 diff --git a/utils/include/mm_file_utils.h b/utils/include/mm_file_utils.h index 1bd7fba..3c3e0ac 100755 --- a/utils/include/mm_file_utils.h +++ b/utils/include/mm_file_utils.h @@ -147,14 +147,16 @@ int mmfile_close(MMFileIOHandle *h); /*////////////////////////////////////////////////////////////////////// */ /* INI API // */ /*////////////////////////////////////////////////////////////////////// */ -#define MMFILE_INI_PATH "/etc/multimedia/mm_file_config.ini" -#define MMFILE_INI_JUNKCNTLIMIT "mm-file-config:junk_counter_limit" -#define MMFILE_INI_MAXANLDURATION "mm-file-config:max_analyze_duration" -#define MMFILE_INI_PROBESIZE "mm-file-config:probesize" - -#define MMFILE_DEFAULT_JUNKCNTLIMIT 1000 -#define MMFILE_DEFAULT_MAXANLDURATION 100000 -#define MMFILE_DEFAULT_PROBESIZE 1000 +#define MMFILE_INI_PATH "/etc/multimedia/mm_file_config.ini" +#define MMFILE_INI_JUNKCNTLIMIT "mm-file-config:junk_counter_limit" +#define MMFILE_INI_MAXANLDURATION "mm-file-config:max_analyze_duration" +#define MMFILE_INI_PROBESIZE "mm-file-config:probesize" +#define MMFILE_INI_PROBESIZE_MPEGTS "mm-file-config:probesize_for_mpegts" + +#define MMFILE_DEFAULT_JUNKCNTLIMIT 1000 +#define MMFILE_DEFAULT_MAXANLDURATION 100000 +#define MMFILE_DEFAULT_PROBESIZE 50000 +#define MMFILE_DEFAULT_PROBESIZE_MPEGTS 300000 int mmfile_get_int_from_ini(const char *key, int notfound); -- 2.34.1