1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Refactor code

This commit is contained in:
winlin 2020-04-17 10:42:04 +08:00
parent acc471b0a9
commit 606f8873b3

View file

@ -951,13 +951,14 @@ srs_error_t SrsRtcSenderThread::send_packets_gso(SrsRtcPackets& packets)
SrsRtpPacket2* next_packet = NULL; SrsRtpPacket2* next_packet = NULL;
int nn_next_packet = 0; int nn_next_packet = 0;
if (max_padding > 0) {
if (i < nn_packets - 1) { if (i < nn_packets - 1) {
next_packet = (i < nn_packets - 1)? packets.at(i + 1):NULL; next_packet = (i < nn_packets - 1)? packets.at(i + 1):NULL;
nn_next_packet = next_packet? next_packet->nb_bytes() : 0; nn_next_packet = next_packet? next_packet->nb_bytes() : 0;
} }
// Padding the packet to next or GSO size. // Padding the packet to next or GSO size.
if (max_padding > 0 && next_packet) { if (next_packet) {
if (!using_gso) { if (!using_gso) {
// Padding to the next packet to merge with it. // Padding to the next packet to merge with it.
if (nn_next_packet > nn_packet) { if (nn_next_packet > nn_packet) {
@ -986,6 +987,7 @@ srs_error_t SrsRtcSenderThread::send_packets_gso(SrsRtcPackets& packets)
packets.nn_padding_bytes += padding; packets.nn_padding_bytes += padding;
} }
} }
}
// Check whether we can use GSO to send it. // Check whether we can use GSO to send it.
if (using_gso && !gso_final) { if (using_gso && !gso_final) {
@ -1970,7 +1972,7 @@ srs_error_t SrsUdpMuxSender::cycle()
} }
// Increase total messages. // Increase total messages.
nn_msgs += pos; nn_msgs += pos + gso_iovs;
nn_msgs_max = srs_max(pos, nn_msgs_max); nn_msgs_max = srs_max(pos, nn_msgs_max);
nn_gso_msgs_max = srs_max(gso_pos, nn_gso_msgs_max); nn_gso_msgs_max = srs_max(gso_pos, nn_gso_msgs_max);
nn_gso_iovs_max = srs_max(gso_iovs, nn_gso_iovs_max); nn_gso_iovs_max = srs_max(gso_iovs, nn_gso_iovs_max);