diff --git a/trunk/src/app/srs_app_rtc_source.cpp b/trunk/src/app/srs_app_rtc_source.cpp index 9fe42f62d7..c74b59e9e4 100644 --- a/trunk/src/app/srs_app_rtc_source.cpp +++ b/trunk/src/app/srs_app_rtc_source.cpp @@ -1513,22 +1513,22 @@ srs_error_t SrsRtcFrameBuilder::packet_video_key_frame(SrsRtpPacket* pkt) { srs_error_t err = srs_success; - bool raw_is_sps_pps = false; - - // For OBS WHIP, it uses RTP Raw packet with SPS/PPS/IDR frame. + // For OBS WHIP, it uses RTP Raw packet with SPS/PPS/IDR frame. Note that not all + // raw payload is SPS/PPS. + bool has_sps_pps_in_raw_payload = false; SrsRtpRawPayload* raw_payload = dynamic_cast(pkt->payload()); if (raw_payload) { if (pkt->nalu_type == SrsAvcNaluTypeSPS) { - raw_is_sps_pps = true; + has_sps_pps_in_raw_payload = true; srs_freep(obs_whip_sps_); obs_whip_sps_ = pkt->copy(); } else if (pkt->nalu_type == SrsAvcNaluTypePPS) { - raw_is_sps_pps = true; + has_sps_pps_in_raw_payload = true; srs_freep(obs_whip_pps_); obs_whip_pps_ = pkt->copy(); } // Ignore if one of OBS WHIP SPS/PPS is not ready. - if (raw_is_sps_pps && (!obs_whip_sps_ || !obs_whip_pps_)) { + if (has_sps_pps_in_raw_payload && (!obs_whip_sps_ || !obs_whip_pps_)) { return err; } } @@ -1537,7 +1537,7 @@ srs_error_t SrsRtcFrameBuilder::packet_video_key_frame(SrsRtpPacket* pkt) SrsRtpSTAPPayload* stap_payload = dynamic_cast(pkt->payload()); // Handle SPS/PPS in cache or STAP-A packet. - if (stap_payload || (raw_payload && raw_is_sps_pps)) { + if (stap_payload || has_sps_pps_in_raw_payload) { // Get the SPS/PPS from cache or STAP-A packet. SrsSample* sps = stap_payload ? stap_payload->get_sps() : NULL; if (!sps && obs_whip_sps_) sps = dynamic_cast(obs_whip_sps_->payload())->sample_;