Skip to content

Commit

Permalink
Rename SrsRtpPacket2 to SrsRtpPacket. 4.0.111
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed May 15, 2021
1 parent ab0979a commit ddd7a37
Show file tree
Hide file tree
Showing 17 changed files with 191 additions and 190 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ The ports used by SRS:

## V4 changes

* v4.0, 2021-05-15, Rename SrsRtpPacket2 to SrsRtpPacket. 4.0.111
* v4.0, 2021-05-14, RTC: Remove [Object Cache Pool](https://github.com/ossrs/srs/commit/14bfc98122bba369572417c19ebb2a61b373fc45#commitcomment-47655008), no effect. 4.0.110
* v4.0, 2021-05-14, Change virtual public to public. 4.0.109
* v4.0, 2021-05-14, Refine id and vid for statistic. 4.0.108
Expand Down
4 changes: 2 additions & 2 deletions trunk/src/app/srs_app_gb28181.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
#define STREAM_TYPE_AUDIO_PCM 0x9c

class SrsConfDirective;
class SrsRtpPacket;
class SrsRtspPacket;
class SrsRtmpClient;
class SrsRawH264Stream;
class SrsRawAacStream;
Expand Down Expand Up @@ -108,7 +108,7 @@ class SrsGb28181Caster;

//ps rtp header packet parse

class SrsPsRtpPacket: public SrsRtpPacket
class SrsPsRtpPacket: public SrsRtspPacket
{
public:
SrsPsRtpPacket();
Expand Down
12 changes: 6 additions & 6 deletions trunk/src/app/srs_app_rtc_conn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ srs_error_t SrsRtcPlayStream::cycle()
}

// Wait for amount of packets.
SrsRtpPacket2* pkt = NULL;
SrsRtpPacket* pkt = NULL;
consumer->dump_packet(&pkt);
if (!pkt) {
// TODO: FIXME: We should check the quit event.
Expand All @@ -618,7 +618,7 @@ srs_error_t SrsRtcPlayStream::cycle()
}
}

srs_error_t SrsRtcPlayStream::send_packet(SrsRtpPacket2*& pkt)
srs_error_t SrsRtcPlayStream::send_packet(SrsRtpPacket*& pkt)
{
srs_error_t err = srs_success;

Expand Down Expand Up @@ -1287,7 +1287,7 @@ srs_error_t SrsRtcPublishStream::on_rtp_plaintext(char* plaintext, int nb_plaint
}

// Allocate packet form cache.
SrsRtpPacket2* pkt = new SrsRtpPacket2();
SrsRtpPacket* pkt = new SrsRtpPacket();

// Copy the packet body.
char* p = pkt->wrap(plaintext, nb_plaintext);
Expand All @@ -1305,7 +1305,7 @@ srs_error_t SrsRtcPublishStream::on_rtp_plaintext(char* plaintext, int nb_plaint
return err;
}

srs_error_t SrsRtcPublishStream::do_on_rtp_plaintext(SrsRtpPacket2*& pkt, SrsBuffer* buf)
srs_error_t SrsRtcPublishStream::do_on_rtp_plaintext(SrsRtpPacket*& pkt, SrsBuffer* buf)
{
srs_error_t err = srs_success;

Expand Down Expand Up @@ -1389,7 +1389,7 @@ srs_error_t SrsRtcPublishStream::check_send_nacks()
return err;
}

void SrsRtcPublishStream::on_before_decode_payload(SrsRtpPacket2* pkt, SrsBuffer* buf, ISrsRtpPayloader** ppayload, SrsRtpPacketPayloadType* ppt)
void SrsRtcPublishStream::on_before_decode_payload(SrsRtpPacket* pkt, SrsBuffer* buf, ISrsRtpPayloader** ppayload, SrsRtspPacketPayloadType* ppt)
{
// No payload, ignore.
if (buf->empty()) {
Expand Down Expand Up @@ -2528,7 +2528,7 @@ void SrsRtcConnection::simulate_player_drop_packet(SrsRtpHeader* h, int nn_bytes
nn_simulate_player_nack_drop--;
}

srs_error_t SrsRtcConnection::do_send_packet(SrsRtpPacket2* pkt)
srs_error_t SrsRtcConnection::do_send_packet(SrsRtpPacket* pkt)
{
srs_error_t err = srs_success;

Expand Down
14 changes: 7 additions & 7 deletions trunk/src/app/srs_app_rtc_conn.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class SrsRtcServer;
class SrsRtcConnection;
class SrsSharedPtrMessage;
class SrsRtcStream;
class SrsRtpPacket2;
class SrsRtpPacket;
class ISrsCodec;
class SrsRtpNackForReceiver;
class SrsRtpIncommingVideoFrame;
Expand Down Expand Up @@ -266,7 +266,7 @@ class SrsRtcPlayStream : public ISrsCoroutineHandler, public ISrsReloadHandler
public:
virtual srs_error_t cycle();
private:
srs_error_t send_packet(SrsRtpPacket2*& pkt);
srs_error_t send_packet(SrsRtpPacket*& pkt);
public:
// Directly set the status of track, generally for init to set the default value.
void set_all_tracks_status(bool status);
Expand Down Expand Up @@ -310,7 +310,7 @@ class SrsRtcPublishTwccTimer : public ISrsFastTimer
};

// A RTC publish stream, client push and publish stream to SRS.
class SrsRtcPublishStream : public ISrsRtpPacketDecodeHandler
class SrsRtcPublishStream : public ISrsRtspPacketDecodeHandler
, public ISrsRtcPublishStream, public ISrsRtcPLIWorkerHandler
{
private:
Expand Down Expand Up @@ -367,11 +367,11 @@ class SrsRtcPublishStream : public ISrsRtpPacketDecodeHandler
// @remark We copy the plaintext, user should free it.
srs_error_t on_rtp_plaintext(char* plaintext, int nb_plaintext);
private:
srs_error_t do_on_rtp_plaintext(SrsRtpPacket2*& pkt, SrsBuffer* buf);
srs_error_t do_on_rtp_plaintext(SrsRtpPacket*& pkt, SrsBuffer* buf);
public:
srs_error_t check_send_nacks();
public:
virtual void on_before_decode_payload(SrsRtpPacket2* pkt, SrsBuffer* buf, ISrsRtpPayloader** ppayload, SrsRtpPacketPayloadType* ppt);
virtual void on_before_decode_payload(SrsRtpPacket* pkt, SrsBuffer* buf, ISrsRtpPayloader** ppayload, SrsRtspPacketPayloadType* ppt);
private:
srs_error_t send_periodic_twcc();
public:
Expand Down Expand Up @@ -547,7 +547,7 @@ class SrsRtcConnection : public ISrsResource, public ISrsDisposingHandler
// Simulate the NACK to drop nn packets.
void simulate_nack_drop(int nn);
void simulate_player_drop_packet(SrsRtpHeader* h, int nn_bytes);
srs_error_t do_send_packet(SrsRtpPacket2* pkt);
srs_error_t do_send_packet(SrsRtpPacket* pkt);
// Directly set the status of play track, generally for init to set the default value.
void set_all_tracks_status(std::string stream_uri, bool is_publish, bool status);
private:
Expand Down Expand Up @@ -579,7 +579,7 @@ class ISrsRtcHijacker
// When stop publish by RTC.
virtual void on_stop_publish(SrsRtcConnection* session, SrsRtcPublishStream* publisher, SrsRequest* req) = 0;
// When got RTP plaintext packet.
virtual srs_error_t on_rtp_packet(SrsRtcConnection* session, SrsRtcPublishStream* publisher, SrsRequest* req, SrsRtpPacket2* pkt) = 0;
virtual srs_error_t on_rtp_packet(SrsRtcConnection* session, SrsRtcPublishStream* publisher, SrsRequest* req, SrsRtpPacket* pkt) = 0;
// When before play by RTC. (wait source to ready in cascade scenario)
virtual srs_error_t on_before_play(SrsRtcConnection* session, SrsRequest* req) = 0;
// When start player by RTC.
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/app/srs_app_rtc_jitbuffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class SrsRtpFrameBuffer;
class SrsRtpDecodingState;
class SrsGb28181RtmpMuxer;
class VCMPacket;
class SrsRtpPacket2;
class SrsRtpPacket;

///jittbuffer

Expand Down
16 changes: 8 additions & 8 deletions trunk/src/app/srs_app_rtc_queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ SrsRtpRingBuffer::SrsRtpRingBuffer(int capacity)
capacity_ = (uint16_t)capacity;
initialized_ = false;

queue_ = new SrsRtpPacket2*[capacity_];
memset(queue_, 0, sizeof(SrsRtpPacket2*) * capacity);
queue_ = new SrsRtpPacket*[capacity_];
memset(queue_, 0, sizeof(SrsRtpPacket*) * capacity);
}

SrsRtpRingBuffer::~SrsRtpRingBuffer()
{
for (int i = 0; i < capacity_; ++i) {
SrsRtpPacket2* pkt = queue_[i];
SrsRtpPacket* pkt = queue_[i];
srs_freep(pkt);
}
srs_freepa(queue_);
Expand All @@ -77,9 +77,9 @@ void SrsRtpRingBuffer::advance_to(uint16_t seq)
begin = seq;
}

void SrsRtpRingBuffer::set(uint16_t at, SrsRtpPacket2* pkt)
void SrsRtpRingBuffer::set(uint16_t at, SrsRtpPacket* pkt)
{
SrsRtpPacket2* p = queue_[at % capacity_];
SrsRtpPacket* p = queue_[at % capacity_];
srs_freep(p);

queue_[at % capacity_] = pkt;
Expand Down Expand Up @@ -143,7 +143,7 @@ bool SrsRtpRingBuffer::update(uint16_t seq, uint16_t& nack_first, uint16_t& nack
return true;
}

SrsRtpPacket2* SrsRtpRingBuffer::at(uint16_t seq) {
SrsRtpPacket* SrsRtpRingBuffer::at(uint16_t seq) {
return queue_[seq % capacity_];
}

Expand All @@ -165,7 +165,7 @@ void SrsRtpRingBuffer::clear_histroy(uint16_t seq)
{
// TODO FIXME Did not consider loopback
for (uint16_t i = 0; i < capacity_; i++) {
SrsRtpPacket2* p = queue_[i];
SrsRtpPacket* p = queue_[i];
if (p && p->header.get_sequence() < seq) {
srs_freep(p);
queue_[i] = NULL;
Expand All @@ -176,7 +176,7 @@ void SrsRtpRingBuffer::clear_histroy(uint16_t seq)
void SrsRtpRingBuffer::clear_all_histroy()
{
for (uint16_t i = 0; i < capacity_; i++) {
SrsRtpPacket2* p = queue_[i];
SrsRtpPacket* p = queue_[i];
if (p) {
srs_freep(p);
queue_[i] = NULL;
Expand Down
8 changes: 4 additions & 4 deletions trunk/src/app/srs_app_rtc_queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include <srs_kernel_rtc_rtp.hpp>
#include <srs_kernel_rtc_rtcp.hpp>

class SrsRtpPacket2;
class SrsRtpPacket;
class SrsRtpQueue;
class SrsRtpRingBuffer;

Expand All @@ -51,7 +51,7 @@ class SrsRtpRingBuffer
// Capacity of the ring-buffer.
uint16_t capacity_;
// Ring bufer.
SrsRtpPacket2** queue_;
SrsRtpPacket** queue_;
// Increase one when uint16 flip back, for get_extended_highest_sequence.
uint64_t nn_seq_flip_backs;
// Whether initialized, because we use uint16 so we can't use -1.
Expand All @@ -74,15 +74,15 @@ class SrsRtpRingBuffer
// Move the low position of buffer to seq.
void advance_to(uint16_t seq);
// Free the packet at position.
void set(uint16_t at, SrsRtpPacket2* pkt);
void set(uint16_t at, SrsRtpPacket* pkt);
void remove(uint16_t at);
// The highest sequence number, calculate the flip back base.
uint32_t get_extended_highest_sequence();
// Update the sequence, got the nack range by [first, last).
// @return If false, the seq is too old.
bool update(uint16_t seq, uint16_t& nack_first, uint16_t& nack_last);
// Get the packet by seq.
SrsRtpPacket2* at(uint16_t seq);
SrsRtpPacket* at(uint16_t seq);
public:
// TODO: FIXME: Refine it?
void notify_nack_list_full();
Expand Down
Loading

1 comment on commit ddd7a37

@winlinvip
Copy link
Member Author

@winlinvip winlinvip commented on ddd7a37 May 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SrsRtpPacket 改成 SrsRtspPacket,这个是之前RTSP定义的RTP包(其实和RTC的RTP包含义应该一样,未来可以合并了或可能删除RTSP,暂时没合并)。

SrsRtpPacket2改成了SrsRtpPacket,目前使用更多的还是RTC中的RTP包,所以改成了这个名字。

Please sign in to comment.