mirror of
https://github.com/ossrs/srs.git
synced 2025-02-13 11:51:57 +00:00
Squash: Merge SRS 4.0
This commit is contained in:
parent
dc778020fc
commit
7d3ec991e1
3 changed files with 17 additions and 12 deletions
Binary file not shown.
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 4.2 KiB |
|
@ -1715,19 +1715,19 @@ bool SrsRtmpFromRtcBridger::check_frame_complete(const uint16_t start, const uin
|
||||||
for (uint16_t i = 0; i < cnt; ++i) {
|
for (uint16_t i = 0; i < cnt; ++i) {
|
||||||
int index = cache_index((start + i));
|
int index = cache_index((start + i));
|
||||||
SrsRtpPacket* pkt = cache_video_pkts_[index].pkt;
|
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) {
|
|
||||||
++fu_s_c;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fua_payload->end) {
|
// fix crash when pkt->payload() if pkt is nullptr;
|
||||||
++fu_e_c;
|
if (!pkt) continue;
|
||||||
}
|
|
||||||
|
SrsRtpFUAPayload2* fua_payload = dynamic_cast<SrsRtpFUAPayload2*>(pkt->payload());
|
||||||
|
if (!fua_payload) continue;
|
||||||
|
|
||||||
|
if (fua_payload->start) {
|
||||||
|
++fu_s_c;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fua_payload->end) {
|
||||||
|
++fu_e_c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1161,6 +1161,7 @@ srs_error_t SrsRtcpTWCC::do_encode(SrsBuffer *buffer)
|
||||||
if(srs_success != (err = encode_header(buffer))) {
|
if(srs_success != (err = encode_header(buffer))) {
|
||||||
return srs_error_wrap(err, "encode header");
|
return srs_error_wrap(err, "encode header");
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer->write_4bytes(media_ssrc_);
|
buffer->write_4bytes(media_ssrc_);
|
||||||
buffer->write_2bytes(base_sn_);
|
buffer->write_2bytes(base_sn_);
|
||||||
buffer->write_2bytes(packet_count);
|
buffer->write_2bytes(packet_count);
|
||||||
|
@ -1171,13 +1172,16 @@ srs_error_t SrsRtcpTWCC::do_encode(SrsBuffer *buffer)
|
||||||
if(!buffer->require(required_size)) {
|
if(!buffer->require(required_size)) {
|
||||||
return srs_error_new(ERROR_RTC_RTCP, "encoded_chucks_[%d] requires %d bytes", (int)encoded_chucks_.size(), 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) {
|
for(vector<uint16_t>::iterator it = encoded_chucks_.begin(); it != encoded_chucks_.end(); ++it) {
|
||||||
buffer->write_2bytes(*it);
|
buffer->write_2bytes(*it);
|
||||||
}
|
}
|
||||||
|
|
||||||
required_size = pkt_deltas_.size() * 2;
|
required_size = pkt_deltas_.size() * 2;
|
||||||
if(!buffer->require(required_size)) {
|
if(!buffer->require(required_size)) {
|
||||||
return srs_error_new(ERROR_RTC_RTCP, "pkt_deltas_[%d] requires %d bytes", (int)pkt_deltas_.size(), 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) {
|
for(vector<uint16_t>::iterator it = pkt_deltas_.begin(); it != pkt_deltas_.end(); ++it) {
|
||||||
if(0 <= *it && 0xFF >= *it) {
|
if(0 <= *it && 0xFF >= *it) {
|
||||||
// small delta
|
// small delta
|
||||||
|
@ -1188,6 +1192,7 @@ srs_error_t SrsRtcpTWCC::do_encode(SrsBuffer *buffer)
|
||||||
buffer->write_2bytes(*it);
|
buffer->write_2bytes(*it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while((pkt_len % 4) != 0) {
|
while((pkt_len % 4) != 0) {
|
||||||
buffer->write_1bytes(0);
|
buffer->write_1bytes(0);
|
||||||
pkt_len++;
|
pkt_len++;
|
||||||
|
|
Loading…
Reference in a new issue