From 48bfe76c885f0ffe084187b721f9b0f068fecdc3 Mon Sep 17 00:00:00 2001 From: sunyujie <1458565796@qq.com> Date: Fri, 22 Nov 2024 14:38:57 +0800 Subject: [PATCH 1/3] fix dirty data makes read err Signed-off-by: sunyujie <1458565796@qq.com> --- libavformat/mpegts.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index eb2d32a5d0..c656536a4f 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -3549,6 +3549,9 @@ static int mpegts_resync(AVFormatContext *s, int seekback, const uint8_t *curren if (avio_feof(pb)) return AVERROR_EOF; if (c == 0x47) { +#ifdef OHOS_FRAME_TYPE_COMPAT + avio_seek(pb, -1, SEEK_CUR); +#else int new_packet_size, ret; avio_seek(pb, -1, SEEK_CUR); pos = avio_tell(pb); @@ -3561,7 +3564,8 @@ static int mpegts_resync(AVFormatContext *s, int seekback, const uint8_t *curren ts->raw_packet_size = new_packet_size; } avio_seek(pb, pos, SEEK_SET); - return 0; +#endif + return 0; } } av_log(s, AV_LOG_ERROR, From 89131c6c1c5ce281811aabada90b2acdfb04fa8d Mon Sep 17 00:00:00 2001 From: sunyujie <1458565796@qq.com> Date: Fri, 22 Nov 2024 14:50:47 +0800 Subject: [PATCH 2/3] fix dirty data makes read err Signed-off-by: sunyujie <1458565796@qq.com> --- BUILD.gn | 1 + 1 file changed, 1 insertion(+) diff --git a/BUILD.gn b/BUILD.gn index 2f92b58303..ccebf456bc 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -148,6 +148,7 @@ config("ffmpeg_config") { "-DOHOS_EXPAND_MP4_INFO", "-DOHOS_OPTIMIZE_DELAY", "-DOHOS_AV3A_DEMUXER", + "-DOHOS_FRAME_TYPE_COMPAT", ] if (use_musl) { cflags += [ "-Wno-bool-operation" ] From 4df8b3cad497e822bf7d494a00061f8d1120fd3b Mon Sep 17 00:00:00 2001 From: sunyujie <1458565796@qq.com> Date: Fri, 22 Nov 2024 15:06:01 +0800 Subject: [PATCH 3/3] fix dirty data makes read err Signed-off-by: sunyujie <1458565796@qq.com> --- BUILD.gn | 1 - libavformat/mpegts.c | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index ccebf456bc..2f92b58303 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -148,7 +148,6 @@ config("ffmpeg_config") { "-DOHOS_EXPAND_MP4_INFO", "-DOHOS_OPTIMIZE_DELAY", "-DOHOS_AV3A_DEMUXER", - "-DOHOS_FRAME_TYPE_COMPAT", ] if (use_musl) { cflags += [ "-Wno-bool-operation" ] diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index c656536a4f..5e35444962 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -3549,8 +3549,8 @@ static int mpegts_resync(AVFormatContext *s, int seekback, const uint8_t *curren if (avio_feof(pb)) return AVERROR_EOF; if (c == 0x47) { -#ifdef OHOS_FRAME_TYPE_COMPAT - avio_seek(pb, -1, SEEK_CUR); +#ifdef OHOS_OPT_COMPAT + avio_seek(pb, -1, SEEK_CUR); #else int new_packet_size, ret; avio_seek(pb, -1, SEEK_CUR); @@ -3565,7 +3565,7 @@ static int mpegts_resync(AVFormatContext *s, int seekback, const uint8_t *curren } avio_seek(pb, pos, SEEK_SET); #endif - return 0; + return 0; } } av_log(s, AV_LOG_ERROR,