mirror of
https://github.com/ossrs/srs.git
synced 2025-02-13 11:51:57 +00:00
fix some crash in rtc. (#2545)
This commit is contained in:
parent
149ad80b5d
commit
dc778020fc
2 changed files with 12 additions and 0 deletions
|
@ -1715,6 +1715,10 @@ bool SrsRtmpFromRtcBridger::check_frame_complete(const uint16_t start, const uin
|
|||
for (uint16_t i = 0; i < cnt; ++i) {
|
||||
int index = cache_index((start + i));
|
||||
SrsRtpPacket* pkt = cache_video_pkts_[index].pkt;
|
||||
if (!pkt) {
|
||||
// fix crash when pkt->payload() if pkt is nullptr;
|
||||
continue;
|
||||
}
|
||||
SrsRtpFUAPayload2* fua_payload = dynamic_cast<SrsRtpFUAPayload2*>(pkt->payload());
|
||||
if (fua_payload) {
|
||||
if (fua_payload->start) {
|
||||
|
|
|
@ -1167,9 +1167,17 @@ srs_error_t SrsRtcpTWCC::do_encode(SrsBuffer *buffer)
|
|||
buffer->write_3bytes(reference_time_);
|
||||
buffer->write_1bytes(fb_pkt_count_);
|
||||
|
||||
int required_size = encoded_chucks_.size() * 2;
|
||||
if(!buffer->require(required_size)) {
|
||||
return srs_error_new(ERROR_RTC_RTCP, "encoded_chucks_[%d] requires %d bytes", (int)encoded_chucks_.size(), required_size);
|
||||
}
|
||||
for(vector<uint16_t>::iterator it = encoded_chucks_.begin(); it != encoded_chucks_.end(); ++it) {
|
||||
buffer->write_2bytes(*it);
|
||||
}
|
||||
required_size = pkt_deltas_.size() * 2;
|
||||
if(!buffer->require(required_size)) {
|
||||
return srs_error_new(ERROR_RTC_RTCP, "pkt_deltas_[%d] requires %d bytes", (int)pkt_deltas_.size(), required_size);
|
||||
}
|
||||
for(vector<uint16_t>::iterator it = pkt_deltas_.begin(); it != pkt_deltas_.end(); ++it) {
|
||||
if(0 <= *it && 0xFF >= *it) {
|
||||
// small delta
|
||||
|
|
Loading…
Reference in a new issue