diff --git a/trunk/src/app/srs_app_rtc_conn.cpp b/trunk/src/app/srs_app_rtc_conn.cpp index efe93ff9f..d7d39a773 100644 --- a/trunk/src/app/srs_app_rtc_conn.cpp +++ b/trunk/src/app/srs_app_rtc_conn.cpp @@ -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); diff --git a/trunk/src/app/srs_app_source.cpp b/trunk/src/app/srs_app_source.cpp index 9fe1e2cdc..b23100f2f 100755 --- a/trunk/src/app/srs_app_source.cpp +++ b/trunk/src/app/srs_app_source.cpp @@ -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) diff --git a/trunk/src/app/srs_app_source.hpp b/trunk/src/app/srs_app_source.hpp index 1d27fdbbb..5aba081d1 100644 --- a/trunk/src/app/srs_app_source.hpp +++ b/trunk/src/app/srs_app_source.hpp @@ -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.