mirror of
https://github.com/ossrs/srs.git
synced 2025-02-13 11:51:57 +00:00
RTC: Remove dead code
This commit is contained in:
parent
620ca902e2
commit
ba8f2e2aba
6 changed files with 23 additions and 151 deletions
|
@ -707,7 +707,7 @@ srs_error_t SrsRtcPlayer::cycle()
|
|||
}
|
||||
}
|
||||
|
||||
srs_error_t SrsRtcPlayer::send_messages(SrsRtcSource* source, vector<SrsRtpPacket2*>& pkts, SrsRtcOutgoingInfo& info)
|
||||
srs_error_t SrsRtcPlayer::send_messages(SrsRtcSource* source, const vector<SrsRtpPacket2*>& pkts, SrsRtcOutgoingInfo& info)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
@ -741,7 +741,7 @@ srs_error_t SrsRtcPlayer::send_messages(SrsRtcSource* source, vector<SrsRtpPacke
|
|||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsRtcPlayer::messages_to_packets(SrsRtcSource* source, vector<SrsRtpPacket2*>& pkts, SrsRtcOutgoingInfo& info)
|
||||
srs_error_t SrsRtcPlayer::messages_to_packets(SrsRtcSource* source, const vector<SrsRtpPacket2*>& pkts, SrsRtcOutgoingInfo& info)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
@ -811,7 +811,7 @@ srs_error_t SrsRtcPlayer::package_video(SrsRtpPacket2* pkt)
|
|||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsRtcPlayer::send_packets(std::vector<SrsRtpPacket2*>& pkts, SrsRtcOutgoingInfo& info)
|
||||
srs_error_t SrsRtcPlayer::send_packets(const std::vector<SrsRtpPacket2*>& pkts, SrsRtcOutgoingInfo& info)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
@ -905,7 +905,7 @@ srs_error_t SrsRtcPlayer::send_packets(std::vector<SrsRtpPacket2*>& pkts, SrsRtc
|
|||
}
|
||||
|
||||
// TODO: FIXME: We can gather and pad audios, because they have similar size.
|
||||
srs_error_t SrsRtcPlayer::send_packets_gso(vector<SrsRtpPacket2*>& pkts, SrsRtcOutgoingInfo& info)
|
||||
srs_error_t SrsRtcPlayer::send_packets_gso(const vector<SrsRtpPacket2*>& pkts, SrsRtcOutgoingInfo& info)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
|
|
@ -238,12 +238,12 @@ public:
|
|||
public:
|
||||
virtual srs_error_t cycle();
|
||||
private:
|
||||
srs_error_t send_messages(SrsRtcSource* source, std::vector<SrsRtpPacket2*>& pkts, SrsRtcOutgoingInfo& info);
|
||||
srs_error_t messages_to_packets(SrsRtcSource* source, std::vector<SrsRtpPacket2*>& pkts, SrsRtcOutgoingInfo& info);
|
||||
srs_error_t send_messages(SrsRtcSource* source, const std::vector<SrsRtpPacket2*>& pkts, SrsRtcOutgoingInfo& info);
|
||||
srs_error_t messages_to_packets(SrsRtcSource* source, const std::vector<SrsRtpPacket2*>& pkts, SrsRtcOutgoingInfo& info);
|
||||
srs_error_t package_opus(SrsRtpPacket2* pkt);
|
||||
srs_error_t package_video(SrsRtpPacket2* pkt);
|
||||
srs_error_t send_packets(std::vector<SrsRtpPacket2*>& pkts, SrsRtcOutgoingInfo& info);
|
||||
srs_error_t send_packets_gso(std::vector<SrsRtpPacket2*>& pkts, SrsRtcOutgoingInfo& info);
|
||||
srs_error_t send_packets(const std::vector<SrsRtpPacket2*>& pkts, SrsRtcOutgoingInfo& info);
|
||||
srs_error_t send_packets_gso(const std::vector<SrsRtpPacket2*>& pkts, SrsRtcOutgoingInfo& info);
|
||||
public:
|
||||
void nack_fetch(std::vector<SrsRtpPacket2*>& pkts, uint32_t ssrc, uint16_t seq);
|
||||
void simulate_nack_drop(int nn);
|
||||
|
|
|
@ -614,14 +614,15 @@ srs_error_t SrsRtcFromRtmpBridger::on_video(SrsSharedPtrMessage* msg)
|
|||
return srs_error_wrap(err, "format consume video");
|
||||
}
|
||||
|
||||
if ((err = filter(msg, format)) != srs_success) {
|
||||
bool has_idr = false;
|
||||
vector<SrsSample*> samples;
|
||||
if ((err = filter(msg, format, has_idr, samples)) != srs_success) {
|
||||
return srs_error_wrap(err, "filter video");
|
||||
}
|
||||
|
||||
int nn_samples = format->video->nb_samples;
|
||||
int nn_samples = (int)samples.size();
|
||||
|
||||
// Well, for each IDR, we append a SPS/PPS before it, which is packaged in STAP-A.
|
||||
if (msg->has_idr()) {
|
||||
if (has_idr) {
|
||||
SrsRtpPacket2* pkt = NULL;
|
||||
SrsAutoFree(SrsRtpPacket2, pkt);
|
||||
|
||||
|
@ -637,14 +638,14 @@ srs_error_t SrsRtcFromRtmpBridger::on_video(SrsSharedPtrMessage* msg)
|
|||
// If merge Nalus, we pcakges all NALUs(samples) as one NALU, in a RTP or FUA packet.
|
||||
vector<SrsRtpPacket2*> pkts;
|
||||
if (merge_nalus && nn_samples > 1) {
|
||||
if ((err = package_nalus(msg, pkts)) != srs_success) {
|
||||
if ((err = package_nalus(msg, samples, pkts)) != srs_success) {
|
||||
return srs_error_wrap(err, "package nalus as one");
|
||||
}
|
||||
}
|
||||
|
||||
// By default, we package each NALU(sample) to a RTP or FUA packet.
|
||||
for (int i = 0; i < nn_samples; i++) {
|
||||
SrsSample* sample = msg->samples() + i;
|
||||
SrsSample* sample = samples[i];
|
||||
|
||||
// We always ignore bframe here, if config to discard bframe,
|
||||
// the bframe flag will not be set.
|
||||
|
@ -670,13 +671,13 @@ srs_error_t SrsRtcFromRtmpBridger::on_video(SrsSharedPtrMessage* msg)
|
|||
return consume_packets(pkts);
|
||||
}
|
||||
|
||||
srs_error_t SrsRtcFromRtmpBridger::filter(SrsSharedPtrMessage* msg, SrsFormat* format)
|
||||
srs_error_t SrsRtcFromRtmpBridger::filter(SrsSharedPtrMessage* msg, SrsFormat* format, bool& has_idr, vector<SrsSample*>& samples)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
// If IDR, we will insert SPS/PPS before IDR frame.
|
||||
if (format->video && format->video->has_idr) {
|
||||
msg->set_has_idr(true);
|
||||
has_idr = true;
|
||||
}
|
||||
|
||||
// Update samples to shared frame.
|
||||
|
@ -693,15 +694,10 @@ srs_error_t SrsRtcFromRtmpBridger::filter(SrsSharedPtrMessage* msg, SrsFormat* f
|
|||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (format->video->nb_samples <= 0) {
|
||||
return err;
|
||||
samples.push_back(sample);
|
||||
}
|
||||
|
||||
// TODO: FIXME: Directly covert samples to RTP packets.
|
||||
msg->set_samples(format->video->samples, format->video->nb_samples);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -764,14 +760,14 @@ srs_error_t SrsRtcFromRtmpBridger::package_stap_a(SrsRtcSource* source, SrsShare
|
|||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsRtcFromRtmpBridger::package_nalus(SrsSharedPtrMessage* msg, vector<SrsRtpPacket2*>& pkts)
|
||||
srs_error_t SrsRtcFromRtmpBridger::package_nalus(SrsSharedPtrMessage* msg, const vector<SrsSample*>& samples, vector<SrsRtpPacket2*>& pkts)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
SrsRtpRawNALUs* raw = new SrsRtpRawNALUs();
|
||||
|
||||
for (int i = 0; i < msg->nn_samples(); i++) {
|
||||
SrsSample* sample = msg->samples() + i;
|
||||
for (int i = 0; i < (int)samples.size(); i++) {
|
||||
SrsSample* sample = samples[i];
|
||||
|
||||
// We always ignore bframe here, if config to discard bframe,
|
||||
// the bframe flag will not be set.
|
||||
|
|
|
@ -179,9 +179,9 @@ private:
|
|||
public:
|
||||
virtual srs_error_t on_video(SrsSharedPtrMessage* msg);
|
||||
private:
|
||||
srs_error_t filter(SrsSharedPtrMessage* msg, SrsFormat* format);
|
||||
srs_error_t filter(SrsSharedPtrMessage* msg, SrsFormat* format, bool& has_idr, std::vector<SrsSample*>& samples);
|
||||
srs_error_t package_stap_a(SrsRtcSource* source, SrsSharedPtrMessage* msg, SrsRtpPacket2** ppkt);
|
||||
srs_error_t package_nalus(SrsSharedPtrMessage* msg, std::vector<SrsRtpPacket2*>& pkts);
|
||||
srs_error_t package_nalus(SrsSharedPtrMessage* msg, const std::vector<SrsSample*>& samples, std::vector<SrsRtpPacket2*>& pkts);
|
||||
srs_error_t package_single_nalu(SrsSharedPtrMessage* msg, SrsSample* sample, std::vector<SrsRtpPacket2*>& pkts);
|
||||
srs_error_t package_fu_a(SrsSharedPtrMessage* msg, SrsSample* sample, int fu_payload_size, std::vector<SrsRtpPacket2*>& pkts);
|
||||
srs_error_t consume_packets(std::vector<SrsRtpPacket2*>& pkts);
|
||||
|
|
|
@ -40,9 +40,6 @@ using namespace std;
|
|||
#include <srs_kernel_utility.hpp>
|
||||
#include <srs_core_mem_watch.hpp>
|
||||
#include <srs_core_autofree.hpp>
|
||||
#ifdef SRS_RTC
|
||||
#include <srs_kernel_rtc_rtp.hpp>
|
||||
#endif
|
||||
|
||||
SrsMessageHeader::SrsMessageHeader()
|
||||
{
|
||||
|
@ -210,16 +207,6 @@ SrsSharedPtrMessage::SrsSharedPtrPayload::SrsSharedPtrPayload()
|
|||
payload = NULL;
|
||||
size = 0;
|
||||
shared_count = 0;
|
||||
|
||||
#ifdef SRS_RTC
|
||||
samples = NULL;
|
||||
nn_samples = 0;
|
||||
has_idr = false;
|
||||
|
||||
extra_payloads = NULL;
|
||||
nn_extra_payloads = 0;
|
||||
nn_max_extra_payloads = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
SrsSharedPtrMessage::SrsSharedPtrPayload::~SrsSharedPtrPayload()
|
||||
|
@ -228,17 +215,6 @@ SrsSharedPtrMessage::SrsSharedPtrPayload::~SrsSharedPtrPayload()
|
|||
srs_memory_unwatch(payload);
|
||||
#endif
|
||||
srs_freepa(payload);
|
||||
|
||||
#ifdef SRS_RTC
|
||||
srs_freepa(samples);
|
||||
|
||||
for (int i = 0; i < nn_extra_payloads; i++) {
|
||||
SrsSample* p = extra_payloads + i;
|
||||
srs_freep(p->bytes);
|
||||
}
|
||||
srs_freepa(extra_payloads);
|
||||
nn_extra_payloads = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
SrsSharedPtrMessage::SrsSharedPtrMessage() : timestamp(0), stream_id(0), size(0), payload(NULL)
|
||||
|
@ -388,70 +364,6 @@ SrsSharedPtrMessage* SrsSharedPtrMessage::copy()
|
|||
return copy;
|
||||
}
|
||||
|
||||
#ifdef SRS_RTC
|
||||
void SrsSharedPtrMessage::set_extra_payloads(SrsSample* payloads, int nn_payloads)
|
||||
{
|
||||
srs_assert(nn_payloads);
|
||||
srs_assert(!ptr->extra_payloads);
|
||||
|
||||
ptr->nn_extra_payloads = nn_payloads;
|
||||
|
||||
ptr->extra_payloads = new SrsSample[nn_payloads];
|
||||
memcpy((void*)ptr->extra_payloads, payloads, nn_payloads * sizeof(SrsSample));
|
||||
}
|
||||
|
||||
int SrsSharedPtrMessage::nn_extra_payloads()
|
||||
{
|
||||
return ptr->nn_extra_payloads;
|
||||
}
|
||||
|
||||
SrsSample* SrsSharedPtrMessage::extra_payloads()
|
||||
{
|
||||
return ptr->extra_payloads;
|
||||
}
|
||||
|
||||
void SrsSharedPtrMessage::set_max_extra_payload(int v)
|
||||
{
|
||||
ptr->nn_max_extra_payloads = v;
|
||||
}
|
||||
|
||||
int SrsSharedPtrMessage::nn_max_extra_payloads()
|
||||
{
|
||||
return ptr->nn_max_extra_payloads;
|
||||
}
|
||||
|
||||
bool SrsSharedPtrMessage::has_idr()
|
||||
{
|
||||
return ptr->has_idr;
|
||||
}
|
||||
|
||||
void SrsSharedPtrMessage::set_has_idr(bool v)
|
||||
{
|
||||
ptr->has_idr = v;
|
||||
}
|
||||
|
||||
void SrsSharedPtrMessage::set_samples(SrsSample* samples, int nn_samples)
|
||||
{
|
||||
srs_assert(nn_samples);
|
||||
srs_assert(!ptr->samples);
|
||||
|
||||
ptr->nn_samples = nn_samples;
|
||||
|
||||
ptr->samples = new SrsSample[nn_samples];
|
||||
memcpy((void*)ptr->samples, samples, nn_samples * sizeof(SrsSample));
|
||||
}
|
||||
|
||||
int SrsSharedPtrMessage::nn_samples()
|
||||
{
|
||||
return ptr->nn_samples;
|
||||
}
|
||||
|
||||
SrsSample* SrsSharedPtrMessage::samples()
|
||||
{
|
||||
return ptr->samples;
|
||||
}
|
||||
#endif
|
||||
|
||||
SrsFlvTransmuxer::SrsFlvTransmuxer()
|
||||
{
|
||||
writer = NULL;
|
||||
|
|
|
@ -303,24 +303,6 @@ private:
|
|||
int size;
|
||||
// The reference count
|
||||
int shared_count;
|
||||
#ifdef SRS_RTC
|
||||
// TODO: FIXME: Remove it.
|
||||
public:
|
||||
// For RTC video, we need to know the NALU structures,
|
||||
// because the RTP STAP-A or FU-A based on NALU.
|
||||
SrsSample* samples;
|
||||
int nn_samples;
|
||||
// For RTC video, whether NALUs has IDR.
|
||||
bool has_idr;
|
||||
public:
|
||||
// For RTC audio, we may need to transcode AAC to opus,
|
||||
// so there must be an extra payloads, which is transformed from payload.
|
||||
SrsSample* extra_payloads;
|
||||
int nn_extra_payloads;
|
||||
// The max size payload in extras.
|
||||
// @remark For GSO to fast guess the best padding.
|
||||
int nn_max_extra_payloads;
|
||||
#endif
|
||||
public:
|
||||
SrsSharedPtrPayload();
|
||||
virtual ~SrsSharedPtrPayload();
|
||||
|
@ -365,24 +347,6 @@ public:
|
|||
// copy current shared ptr message, use ref-count.
|
||||
// @remark, assert object is created.
|
||||
virtual SrsSharedPtrMessage* copy();
|
||||
public:
|
||||
#ifdef SRS_RTC
|
||||
// Set extra samples, for example, when we transcode an AAC audio packet to OPUS,
|
||||
// we may get more than one OPUS packets, we set these OPUS packets in extra payloads.
|
||||
void set_extra_payloads(SrsSample* payloads, int nn_payloads);
|
||||
int nn_extra_payloads();
|
||||
SrsSample* extra_payloads();
|
||||
// The max extra payload size.
|
||||
void set_max_extra_payload(int v);
|
||||
int nn_max_extra_payloads();
|
||||
// Whether samples has idr.
|
||||
bool has_idr();
|
||||
void set_has_idr(bool v);
|
||||
// Set samples, each sample points to the address of payload.
|
||||
void set_samples(SrsSample* samples, int nn_samples);
|
||||
int nn_samples();
|
||||
SrsSample* samples();
|
||||
#endif
|
||||
};
|
||||
|
||||
// Transmux RTMP packets to FLV stream.
|
||||
|
|
Loading…
Reference in a new issue