From 06f10b18943f0120dad68a5e96176375212aff40 Mon Sep 17 00:00:00 2001 From: Haibo Chen Date: Wed, 4 Aug 2021 17:06:55 +0800 Subject: [PATCH] fix coredump bug: caused by publish stream that codec is h.263 (#2505) --- trunk/src/app/srs_app_rtc_source.cpp | 6 ++++++ trunk/src/app/srs_app_source.cpp | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/trunk/src/app/srs_app_rtc_source.cpp b/trunk/src/app/srs_app_rtc_source.cpp index 4f5cc2f00..515b8b037 100644 --- a/trunk/src/app/srs_app_rtc_source.cpp +++ b/trunk/src/app/srs_app_rtc_source.cpp @@ -910,6 +910,12 @@ srs_error_t SrsRtcFromRtmpBridger::on_video(SrsSharedPtrMessage* msg) return srs_error_wrap(err, "format consume video"); } + // Ignore if no format->vcodec, it means the codec is not parsed, or unsupport/unknown codec + // such as H.263 codec + if (!format->vcodec) { + return err; + } + bool has_idr = false; vector samples; if ((err = filter(msg, format, has_idr, samples)) != srs_success) { diff --git a/trunk/src/app/srs_app_source.cpp b/trunk/src/app/srs_app_source.cpp index 49cd3ad4a..414d4e099 100755 --- a/trunk/src/app/srs_app_source.cpp +++ b/trunk/src/app/srs_app_source.cpp @@ -1022,7 +1022,13 @@ srs_error_t SrsOriginHub::on_video(SrsSharedPtrMessage* shared_video, bool is_se if ((err = format->on_video(msg)) != srs_success) { return srs_error_wrap(err, "format consume video"); } - + + // Ignore if no format->vcodec, it means the codec is not parsed, or unsupport/unknown codec + // such as H.263 codec + if (!format->vcodec) { + return err; + } + // cache the sequence header if h264 // donot cache the sequence header to gop_cache, return here. if (format->is_avc_sequence_header()) {