1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-15 04:42:04 +00:00

Refine code

This commit is contained in:
winlin 2021-02-05 17:10:42 +08:00
parent fd605fc4ac
commit 05441d6354

View file

@ -1159,6 +1159,7 @@ srs_error_t SrsRtcPublishStream::on_rtp(char* data, int nb_data)
// We try to decode the RTP header for more detail error informations.
SrsBuffer b(data, nb_data); SrsRtpHeader h; h.ignore_padding(true);
srs_error_t r0 = h.decode(&b); srs_freep(r0); // Ignore any error for header decoding.
err = srs_error_wrap(err, "marker=%u, pt=%u, seq=%u, ts=%u, ssrc=%u, pad=%u, payload=%uB", h.get_marker(), h.get_payload_type(),
h.get_sequence(), h.get_timestamp(), h.get_ssrc(), h.get_padding(), nb_data - b.pos());
@ -1172,6 +1173,10 @@ srs_error_t SrsRtcPublishStream::on_rtp(char* data, int nb_data)
// Handle the plaintext RTP packet.
if ((err = do_on_rtp(unprotected_buf, nb_unprotected_buf)) != srs_success) {
// We try to decode the RTP header for more detail error informations.
SrsBuffer b(data, nb_data); SrsRtpHeader h; h.ignore_padding(true);
srs_error_t r0 = h.decode(&b); srs_freep(r0); // Ignore any error for header decoding.
int nb_header = h.nb_bytes();
const char* body = unprotected_buf + nb_header;
int nb_body = nb_unprotected_buf - nb_header;