SRT: Fix srt to rtmp crash when sps or pps empty. v5.0.112 (#3323)

* SRT: fix crash when sps/pps empty. v5.0.112

Co-authored-by: winlin <winlin@vip.126.com>
pull/3324/head
john 2 years ago committed by GitHub
parent 56040cab42
commit 09a96175e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -8,6 +8,7 @@ The changelog for SRS.
## SRS 5.0 Changelog ## SRS 5.0 Changelog
* v5.0, 2022-12-17, Merge [#3323](https://github.com/ossrs/srs/pull/3323): SRT: Fix srt to rtmp crash when sps or pps empty. v5.0.112
* v5.0, 2022-12-15, For [#3300](https://github.com/ossrs/srs/issues/3300): GB28181: Fix memory overlap for small packets. v5.0.111 * v5.0, 2022-12-15, For [#3300](https://github.com/ossrs/srs/issues/3300): GB28181: Fix memory overlap for small packets. v5.0.111
* v5.0, 2022-12-14, For [#939](https://github.com/ossrs/srs/issues/939): FLV: Support set default has_av and disable guessing. v5.0.110 * v5.0, 2022-12-14, For [#939](https://github.com/ossrs/srs/issues/939): FLV: Support set default has_av and disable guessing. v5.0.110
* v5.0, 2022-12-13, For [#939](https://github.com/ossrs/srs/issues/939): FLV: Drop packet if header flag is not matched. v5.0.109 * v5.0, 2022-12-13, For [#939](https://github.com/ossrs/srs/issues/939): FLV: Drop packet if header flag is not matched. v5.0.109

@ -378,6 +378,10 @@ srs_error_t SrsRtmpFromSrtBridge::on_ts_video(SrsTsMessage* msg, SrsBuffer* avs)
return srs_error_wrap(err, "demux annexb"); return srs_error_wrap(err, "demux annexb");
} }
if (frame == NULL || frame_size == 0) {
continue;
}
// for sps // for sps
if (avc->is_sps(frame, frame_size)) { if (avc->is_sps(frame, frame_size)) {
std::string sps; std::string sps;
@ -426,6 +430,10 @@ srs_error_t SrsRtmpFromSrtBridge::check_sps_pps_change(SrsTsMessage* msg)
return err; return err;
} }
if (sps_.empty() || pps_.empty()) {
return srs_error_new(ERROR_SRT_TO_RTMP_EMPTY_SPS_PPS, "sps or pps empty");
}
// sps/pps changed, generate new video sh frame and dispatch it. // sps/pps changed, generate new video sh frame and dispatch it.
sps_pps_change_ = false; sps_pps_change_ = false;

@ -9,6 +9,6 @@
#define VERSION_MAJOR 5 #define VERSION_MAJOR 5
#define VERSION_MINOR 0 #define VERSION_MINOR 0
#define VERSION_REVISION 111 #define VERSION_REVISION 112
#endif #endif

@ -370,7 +370,8 @@
XX(ERROR_SRT_CONN , 6006, "SrtConnection", "SRT connectin level error") \ XX(ERROR_SRT_CONN , 6006, "SrtConnection", "SRT connectin level error") \
XX(ERROR_SRT_SOURCE_BUSY , 6007, "SrtStreamBusy", "SRT stream already exists or busy") \ XX(ERROR_SRT_SOURCE_BUSY , 6007, "SrtStreamBusy", "SRT stream already exists or busy") \
XX(ERROR_RTMP_TO_SRT , 6008, "SrtFromRtmp", "Covert RTMP to SRT failed") \ XX(ERROR_RTMP_TO_SRT , 6008, "SrtFromRtmp", "Covert RTMP to SRT failed") \
XX(ERROR_SRT_STATS , 6009, "SrtStats", "SRT get statistic data failed") XX(ERROR_SRT_STATS , 6009, "SrtStats", "SRT get statistic data failed") \
XX(ERROR_SRT_TO_RTMP_EMPTY_SPS_PPS , 6010, "SrtToRtmpEmptySpsPps", "SRT to rtmp have empty sps or pps")
/**************************************************/ /**************************************************/
/* For user-define error. */ /* For user-define error. */

Loading…
Cancel
Save