mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Refactor the RTP packet.
This commit is contained in:
parent
47df22df9e
commit
15955b6cdd
4 changed files with 4 additions and 15 deletions
|
@ -81,8 +81,8 @@ srs_error_t SrsDtls::init(SrsRequest* r)
|
||||||
#if OPENSSL_VERSION_NUMBER < 0x10002000L // v1.0.2
|
#if OPENSSL_VERSION_NUMBER < 0x10002000L // v1.0.2
|
||||||
dtls_ctx = SSL_CTX_new(DTLSv1_method());
|
dtls_ctx = SSL_CTX_new(DTLSv1_method());
|
||||||
#else
|
#else
|
||||||
//dtls_ctx = SSL_CTX_new(DTLS_method());
|
dtls_ctx = SSL_CTX_new(DTLS_method());
|
||||||
dtls_ctx = SSL_CTX_new(DTLSv1_method());
|
//dtls_ctx = SSL_CTX_new(DTLSv1_method());
|
||||||
//dtls_ctx = SSL_CTX_new(DTLSv1_2_method());
|
//dtls_ctx = SSL_CTX_new(DTLSv1_2_method());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1882,7 +1882,7 @@ srs_error_t SrsRtcPublisher::on_rtp(char* buf, int nb_buf)
|
||||||
SrsRtpPacket2* pkt = new SrsRtpPacket2();
|
SrsRtpPacket2* pkt = new SrsRtpPacket2();
|
||||||
|
|
||||||
pkt->set_decode_handler(this);
|
pkt->set_decode_handler(this);
|
||||||
pkt->set_original_bytes(buf, nb_buf);
|
pkt->original_bytes = buf;
|
||||||
|
|
||||||
SrsBuffer b(buf, nb_buf);
|
SrsBuffer b(buf, nb_buf);
|
||||||
if ((err = pkt->decode(&b)) != srs_success) {
|
if ((err = pkt->decode(&b)) != srs_success) {
|
||||||
|
|
|
@ -287,7 +287,6 @@ SrsRtpPacket2::SrsRtpPacket2()
|
||||||
cache_payload = 0;
|
cache_payload = 0;
|
||||||
|
|
||||||
original_bytes = NULL;
|
original_bytes = NULL;
|
||||||
nn_original_bytes = 0;
|
|
||||||
nn_original_payload = 0;
|
nn_original_payload = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -355,12 +354,6 @@ void SrsRtpPacket2::set_decode_handler(ISrsRtpPacketDecodeHandler* h)
|
||||||
decode_handler = h;
|
decode_handler = h;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SrsRtpPacket2::set_original_bytes(char* buf, int nn_buf)
|
|
||||||
{
|
|
||||||
original_bytes = buf;
|
|
||||||
nn_original_bytes = nn_buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
int SrsRtpPacket2::nb_bytes()
|
int SrsRtpPacket2::nb_bytes()
|
||||||
{
|
{
|
||||||
if (!cache_payload) {
|
if (!cache_payload) {
|
||||||
|
|
|
@ -114,6 +114,7 @@ public:
|
||||||
int padding;
|
int padding;
|
||||||
// Decoder helper.
|
// Decoder helper.
|
||||||
public:
|
public:
|
||||||
|
// TODO: FIXME: Move to video decoder queue SrsRtpVideoQueue.
|
||||||
// Helper information for video decoder only.
|
// Helper information for video decoder only.
|
||||||
bool video_is_first_packet;
|
bool video_is_first_packet;
|
||||||
bool video_is_last_packet;
|
bool video_is_last_packet;
|
||||||
|
@ -122,11 +123,8 @@ public:
|
||||||
SrsAvcNaluType nalu_type;
|
SrsAvcNaluType nalu_type;
|
||||||
// The original payload bytes length.
|
// The original payload bytes length.
|
||||||
int nn_original_payload;
|
int nn_original_payload;
|
||||||
// Decoder helper.
|
|
||||||
private:
|
|
||||||
// The original bytes for decoder only, we will free it.
|
// The original bytes for decoder only, we will free it.
|
||||||
char* original_bytes;
|
char* original_bytes;
|
||||||
int nn_original_bytes;
|
|
||||||
// Fast cache for performance.
|
// Fast cache for performance.
|
||||||
private:
|
private:
|
||||||
// Cache frequently used payload for performance.
|
// Cache frequently used payload for performance.
|
||||||
|
@ -151,8 +149,6 @@ public:
|
||||||
SrsRtpFUAPayload2* reuse_fua();
|
SrsRtpFUAPayload2* reuse_fua();
|
||||||
// Set the decode handler.
|
// Set the decode handler.
|
||||||
void set_decode_handler(ISrsRtpPacketDecodeHandler* h);
|
void set_decode_handler(ISrsRtpPacketDecodeHandler* h);
|
||||||
// Set the original bytes.
|
|
||||||
void set_original_bytes(char* buf, int nn_buf);
|
|
||||||
// interface ISrsEncoder
|
// interface ISrsEncoder
|
||||||
public:
|
public:
|
||||||
virtual int nb_bytes();
|
virtual int nb_bytes();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue