Refine source, pass-by RTC publisher for player

pull/1753/head
winlin 5 years ago
parent 20b4984af4
commit 1688d53f7d

@ -754,7 +754,10 @@ srs_error_t SrsRtcSenderThread::cycle()
// For RTC, notify the source to fetch keyframe for this client.
// TODO: FIXME: Should triggle by PLI from client.
source->request_keyframe();
SrsRtcPublisher* publisher = source->rtc_publisher();
if (publisher) {
publisher->request_keyframe();
}
SrsMessageArray msgs(SRS_PERF_MW_MSGS);
SrsRtcPackets pkts(SRS_PERF_RTC_RTP_PACKETS);

@ -1921,7 +1921,7 @@ SrsSource::SrsSource()
atc = false;
#ifdef SRS_RTC
rtc_publisher = NULL;
rtc_publisher_ = NULL;
#endif
}
@ -2706,16 +2706,14 @@ SrsMetaCache* SrsSource::cached_meta()
return meta;
}
void SrsSource::request_keyframe()
SrsRtcPublisher* SrsSource::rtc_publisher()
{
if (rtc_publisher) {
rtc_publisher->request_keyframe();
}
return rtc_publisher_;
}
void SrsSource::set_rtc_publisher(SrsRtcPublisher* v)
{
rtc_publisher = v;
rtc_publisher_ = v;
}
srs_error_t SrsSource::on_rtc_audio(SrsSharedPtrMessage* audio)

@ -551,7 +551,7 @@ private:
srs_utime_t die_at;
#ifdef SRS_RTC
private:
SrsRtcPublisher* rtc_publisher;
SrsRtcPublisher* rtc_publisher_;
#endif
public:
SrsSource();
@ -621,12 +621,10 @@ public:
virtual std::string get_curr_origin();
#ifdef SRS_RTC
public:
// Get the cached meta, as such the sps/pps.
// For RTC, we need to package SPS/PPS(in cached meta) before each IDR.
SrsMetaCache* cached_meta();
// Request keyframe for new client.
// TODO: FIXME: Maybe we could cache the keyframe.
// TODO: FIXME: Maybe we should only response for the new clients.
void request_keyframe();
// Get and set the publisher, passed to consumer to process requests such as PLI.
SrsRtcPublisher* rtc_publisher();
void set_rtc_publisher(SrsRtcPublisher* v);
// When got RTC audio message, which is encoded in opus.
// TODO: FIXME: Merge with on_audio.

Loading…
Cancel
Save