RTC: Refine code, remove the assign

pull/2204/head
winlin 4 years ago
parent 7c517988a6
commit 5d4baf4eca

@ -218,13 +218,6 @@ void SrsRtpExtensionTwcc::reset()
sn_ = 0;
}
void SrsRtpExtensionTwcc::assign(const SrsRtpExtensionTwcc& h)
{
has_twcc_ = h.has_twcc_;
id_ = h.id_;
sn_ = h.sn_;
}
srs_error_t SrsRtpExtensionTwcc::decode(SrsBuffer* buf)
{
srs_error_t err = srs_success;
@ -313,13 +306,6 @@ void SrsRtpExtensionOneByte::reset()
value_ = 0;
}
void SrsRtpExtensionOneByte::assign(const SrsRtpExtensionOneByte& h)
{
has_ext_ = h.has_ext_;
id_ = h.id_;
value_ = h.value_;
}
void SrsRtpExtensionOneByte::set_id(int id)
{
id_ = id;
@ -385,17 +371,6 @@ void SrsRtpExtensions::reset()
has_ext_ = false;
}
void SrsRtpExtensions::assign(const SrsRtpExtensions& h)
{
has_ext_ = h.has_ext_;
types_ = h.types_;
if (has_ext_) {
twcc_.assign(h.twcc_);
audio_level_.assign(h.audio_level_);
}
}
srs_error_t SrsRtpExtensions::decode(SrsBuffer* buf)
{
srs_error_t err = srs_success;
@ -602,27 +577,6 @@ void SrsRtpHeader::reset()
//memset(csrc, 0, sizeof(csrc));
}
void SrsRtpHeader::assign(const SrsRtpHeader& h)
{
// Reset the fields in protocol.
cc = h.cc;
marker = h.marker;
payload_type = h.payload_type;
sequence = h.sequence;
timestamp = h.timestamp;
ssrc = h.ssrc;
// Reset the parsed fields.
padding_length = h.padding_length;
extensions_.assign(h.extensions_);
// Reset other fields.
ignore_padding_ = h.ignore_padding_;
// The CSRC is not used yet, so we never reset it.
//memcpy(csrc, h.csrc, sizeof(csrc));
}
srs_error_t SrsRtpHeader::decode(SrsBuffer* buf)
{
srs_error_t err = srs_success;
@ -1002,7 +956,7 @@ SrsRtpPacket2* SrsRtpPacket2::copy()
//srs_assert(!cp->payload_);
//srs_assert(!cp->shared_msg);
cp->header.assign(header);
cp->header = header;
cp->payload_ = payload_? payload_->copy():NULL;
cp->payload_type_ = payload_type_;

@ -140,7 +140,6 @@ public:
public:
// Reset the object to reuse it.
void reset();
void assign(const SrsRtpExtensionTwcc& h);
public:
inline bool exists() { return has_twcc_; } // SrsRtpExtensionTwcc::exists
uint8_t get_id();
@ -166,7 +165,6 @@ public:
public:
// Reset the object to reuse it.
void reset();
void assign(const SrsRtpExtensionOneByte& h);
public:
inline bool exists() { return has_ext_; } // SrsRtpExtensionOneByte::exists
int get_id() { return id_; }
@ -198,7 +196,6 @@ public:
public:
// Reset the object to reuse it.
void reset();
void assign(const SrsRtpExtensions& h);
public:
inline bool exists() { return has_ext_; } // SrsRtpExtensions::exists
void set_types_(SrsRtpExtensionTypes* types);
@ -236,7 +233,6 @@ public:
public:
// Reset the object to reuse it.
void reset();
void assign(const SrsRtpHeader& h);
public:
virtual srs_error_t decode(SrsBuffer* buf);
private:

Loading…
Cancel
Save