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

For #307: Change the RTP payload to 1400

This commit is contained in:
winlin 2020-04-15 10:44:26 +08:00
parent 095e7c5a4e
commit ab53c34945

View file

@ -60,6 +60,12 @@ using namespace std;
#include <srs_app_statistic.hpp> #include <srs_app_statistic.hpp>
#include <srs_app_pithy_print.hpp> #include <srs_app_pithy_print.hpp>
// The RTP payload max size, reserved some paddings for SRTP as such:
// kRtpPacketSize = kRtpMaxPayloadSize + paddings
// For example, if kRtpPacketSize is 1500, recommend to set kRtpMaxPayloadSize to 1400,
// which reserves 100 bytes for SRTP or paddings.
const int kRtpMaxPayloadSize = kRtpPacketSize - 100;
static bool is_stun(const uint8_t* data, const int size) static bool is_stun(const uint8_t* data, const int size)
{ {
return data != NULL && size > 0 && (data[0] == 0 || data[0] == 1); return data != NULL && size > 0 && (data[0] == 0 || data[0] == 1);
@ -767,7 +773,6 @@ srs_error_t SrsRtcSenderThread::messages_to_packets(
continue; continue;
} }
const int kRtpMaxPayloadSize = 1200;
if (sample->size <= kRtpMaxPayloadSize) { if (sample->size <= kRtpMaxPayloadSize) {
if ((err = packet_single_nalu(msg, sample, &packet)) != srs_success) { if ((err = packet_single_nalu(msg, sample, &packet)) != srs_success) {
return srs_error_wrap(err, "packet single nalu"); return srs_error_wrap(err, "packet single nalu");
@ -1052,7 +1057,6 @@ srs_error_t SrsRtcSenderThread::packet_nalus(SrsSharedPtrMessage* msg, SrsRtcPac
return err; return err;
} }
const int kRtpMaxPayloadSize = 1200;
if (nn_bytes < kRtpMaxPayloadSize) { if (nn_bytes < kRtpMaxPayloadSize) {
// Package NALUs in a single RTP packet. // Package NALUs in a single RTP packet.
SrsRtpPacket2* packet = new SrsRtpPacket2(); SrsRtpPacket2* packet = new SrsRtpPacket2();