Skip to content

Commit

Permalink
Refine variable name.
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Feb 6, 2024
1 parent 2c0d56f commit f0e4e7e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions trunk/src/app/srs_app_rtc_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<SrsRtpRawPayload*>(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;
}
}
Expand All @@ -1537,7 +1537,7 @@ srs_error_t SrsRtcFrameBuilder::packet_video_key_frame(SrsRtpPacket* pkt)
SrsRtpSTAPPayload* stap_payload = dynamic_cast<SrsRtpSTAPPayload*>(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<SrsRtpRawPayload*>(obs_whip_sps_->payload())->sample_;
Expand Down

0 comments on commit f0e4e7e

Please sign in to comment.