Refine code

pull/1969/head
winlin 4 years ago
parent 697f7d5251
commit 60c759919f

@ -290,14 +290,14 @@ ISrsRtcPLIWorkerHandler::~ISrsRtcPLIWorkerHandler()
{ {
} }
ISrsRtcPLIWorker::ISrsRtcPLIWorker(ISrsRtcPLIWorkerHandler* h) SrsRtcPLIWorker::SrsRtcPLIWorker(ISrsRtcPLIWorkerHandler* h)
{ {
handler_ = h; handler_ = h;
wait_ = srs_cond_new(); wait_ = srs_cond_new();
trd_ = new SrsSTCoroutine("pli", this, _srs_context->get_id()); trd_ = new SrsSTCoroutine("pli", this, _srs_context->get_id());
} }
ISrsRtcPLIWorker::~ISrsRtcPLIWorker() SrsRtcPLIWorker::~SrsRtcPLIWorker()
{ {
srs_cond_signal(wait_); srs_cond_signal(wait_);
trd_->stop(); trd_->stop();
@ -306,7 +306,7 @@ ISrsRtcPLIWorker::~ISrsRtcPLIWorker()
srs_cond_destroy(wait_); srs_cond_destroy(wait_);
} }
srs_error_t ISrsRtcPLIWorker::start() srs_error_t SrsRtcPLIWorker::start()
{ {
srs_error_t err = srs_success; srs_error_t err = srs_success;
@ -317,13 +317,13 @@ srs_error_t ISrsRtcPLIWorker::start()
return err; return err;
} }
void ISrsRtcPLIWorker::request_keyframe(uint32_t ssrc, SrsContextId cid) void SrsRtcPLIWorker::request_keyframe(uint32_t ssrc, SrsContextId cid)
{ {
plis_.insert(make_pair(ssrc, cid)); plis_.insert(make_pair(ssrc, cid));
srs_cond_signal(wait_); srs_cond_signal(wait_);
} }
srs_error_t ISrsRtcPLIWorker::cycle() srs_error_t SrsRtcPLIWorker::cycle()
{ {
srs_error_t err = srs_success; srs_error_t err = srs_success;
@ -383,7 +383,7 @@ SrsRtcPlayStream::SrsRtcPlayStream(SrsRtcConnection* s, const SrsContextId& cid)
_srs_config->subscribe(this); _srs_config->subscribe(this);
timer_ = new SrsHourGlass(this, 1000 * SRS_UTIME_MILLISECONDS); timer_ = new SrsHourGlass(this, 1000 * SRS_UTIME_MILLISECONDS);
nack_epp = new SrsErrorPithyPrint(); nack_epp = new SrsErrorPithyPrint();
pli_worker_ = new ISrsRtcPLIWorker(this); pli_worker_ = new SrsRtcPLIWorker(this);
} }
SrsRtcPlayStream::~SrsRtcPlayStream() SrsRtcPlayStream::~SrsRtcPlayStream()
@ -909,8 +909,8 @@ SrsRtcPublishStream::SrsRtcPublishStream(SrsRtcConnection* session, const SrsCon
nn_audio_frames = 0; nn_audio_frames = 0;
twcc_id_ = 0; twcc_id_ = 0;
twcc_fb_count_ = 0; twcc_fb_count_ = 0;
pli_worker_ = new ISrsRtcPLIWorker(this); pli_worker_ = new SrsRtcPLIWorker(this);
} }
SrsRtcPublishStream::~SrsRtcPublishStream() SrsRtcPublishStream::~SrsRtcPublishStream()

@ -186,7 +186,7 @@ public:
}; };
// A worker coroutine to request the PLI. // A worker coroutine to request the PLI.
class ISrsRtcPLIWorker : virtual public ISrsCoroutineHandler class SrsRtcPLIWorker : virtual public ISrsCoroutineHandler
{ {
private: private:
SrsCoroutine* trd_; SrsCoroutine* trd_;
@ -196,8 +196,8 @@ private:
// Key is SSRC, value is the CID of subscriber which requests PLI. // Key is SSRC, value is the CID of subscriber which requests PLI.
std::map<uint32_t, SrsContextId> plis_; std::map<uint32_t, SrsContextId> plis_;
public: public:
ISrsRtcPLIWorker(ISrsRtcPLIWorkerHandler* h); SrsRtcPLIWorker(ISrsRtcPLIWorkerHandler* h);
virtual ~ISrsRtcPLIWorker(); virtual ~SrsRtcPLIWorker();
public: public:
virtual srs_error_t start(); virtual srs_error_t start();
virtual void request_keyframe(uint32_t ssrc, SrsContextId cid); virtual void request_keyframe(uint32_t ssrc, SrsContextId cid);
@ -246,7 +246,7 @@ private:
SrsContextId cid_; SrsContextId cid_;
SrsCoroutine* trd; SrsCoroutine* trd;
SrsRtcConnection* session_; SrsRtcConnection* session_;
ISrsRtcPLIWorker* pli_worker_; SrsRtcPLIWorker* pli_worker_;
private: private:
SrsRequest* req_; SrsRequest* req_;
SrsRtcStream* source_; SrsRtcStream* source_;
@ -312,7 +312,7 @@ private:
SrsContextId cid_; SrsContextId cid_;
SrsHourGlass* timer_; SrsHourGlass* timer_;
uint64_t nn_audio_frames; uint64_t nn_audio_frames;
ISrsRtcPLIWorker* pli_worker_; SrsRtcPLIWorker* pli_worker_;
private: private:
SrsRtcConnection* session_; SrsRtcConnection* session_;
uint16_t pt_to_drop_; uint16_t pt_to_drop_;

Loading…
Cancel
Save