From dae6dc53958ff21dd8f7937ef03b32b0cd3f548f Mon Sep 17 00:00:00 2001 From: winlin Date: Sat, 15 May 2021 12:33:02 +0800 Subject: [PATCH] Rename SrsRtcStream* to SrsRtcSource*. 4.0.113 --- README.md | 1 + trunk/src/app/srs_app_rtc_conn.cpp | 28 +++---- trunk/src/app/srs_app_rtc_conn.hpp | 22 +++--- trunk/src/app/srs_app_rtc_server.cpp | 2 +- trunk/src/app/srs_app_rtc_server.hpp | 2 +- trunk/src/app/srs_app_rtc_source.cpp | 108 +++++++++++++-------------- trunk/src/app/srs_app_rtc_source.hpp | 80 ++++++++++---------- trunk/src/app/srs_app_rtmp_conn.cpp | 2 +- trunk/src/app/srs_app_source.hpp | 2 +- trunk/src/app/srs_app_threads.cpp | 2 +- trunk/src/core/srs_core_version4.hpp | 2 +- 11 files changed, 126 insertions(+), 125 deletions(-) diff --git a/README.md b/README.md index 427a4abfc..25f91f40a 100755 --- a/README.md +++ b/README.md @@ -176,6 +176,7 @@ The ports used by SRS: ## V4 changes +* v4.0, 2021-05-15, Rename SrsRtcStream* to SrsRtcSource*. 4.0.113 * v4.0, 2021-05-15, Rename SrsSource* to SrsLiveSource*. 4.0.112 * v4.0, 2021-05-15, Rename SrsRtpPacket2 to SrsRtpPacket. 4.0.111 * v4.0, 2021-05-14, RTC: Remove [Object Cache Pool](https://github.com/ossrs/srs/commit/14bfc98122bba369572417c19ebb2a61b373fc45#commitcomment-47655008), no effect. 4.0.110 diff --git a/trunk/src/app/srs_app_rtc_conn.cpp b/trunk/src/app/srs_app_rtc_conn.cpp index 2cdd979a5..a359e54cc 100644 --- a/trunk/src/app/srs_app_rtc_conn.cpp +++ b/trunk/src/app/srs_app_rtc_conn.cpp @@ -463,7 +463,7 @@ srs_error_t SrsRtcPlayStream::initialize(SrsRequest* req, std::mapreq_; - SrsRtcStreamDescription* stream_desc = new SrsRtcStreamDescription(); - SrsAutoFree(SrsRtcStreamDescription, stream_desc); + SrsRtcSourceDescription* stream_desc = new SrsRtcSourceDescription(); + SrsAutoFree(SrsRtcSourceDescription, stream_desc); // TODO: FIXME: Change to api of stream desc. if ((err = negotiate_publish_capability(ruc, stream_desc)) != srs_success) { @@ -1860,7 +1860,7 @@ srs_error_t SrsRtcConnection::add_publisher(SrsRtcUserConfig* ruc, SrsSdp& local return srs_error_wrap(err, "generate local sdp"); } - SrsRtcStream* source = NULL; + SrsRtcSource* source = NULL; if ((err = _srs_rtc_sources->fetch_or_create(req, &source)) != srs_success) { return srs_error_wrap(err, "create source"); } @@ -1905,8 +1905,8 @@ srs_error_t SrsRtcConnection::add_player(SrsRtcUserConfig* ruc, SrsSdp& local_sd return srs_error_new(ERROR_RTC_SDP_EXCHANGE, "no play relations"); } - SrsRtcStreamDescription* stream_desc = new SrsRtcStreamDescription(); - SrsAutoFree(SrsRtcStreamDescription, stream_desc); + SrsRtcSourceDescription* stream_desc = new SrsRtcSourceDescription(); + SrsAutoFree(SrsRtcSourceDescription, stream_desc); std::map::iterator it = play_sub_relations.begin(); while (it != play_sub_relations.end()) { SrsRtcTrackDescription* track_desc = it->second; @@ -2701,7 +2701,7 @@ bool srs_sdp_has_h264_profile(const SrsSdp& sdp, const string& profile) return false; } -srs_error_t SrsRtcConnection::negotiate_publish_capability(SrsRtcUserConfig* ruc, SrsRtcStreamDescription* stream_desc) +srs_error_t SrsRtcConnection::negotiate_publish_capability(SrsRtcUserConfig* ruc, SrsRtcSourceDescription* stream_desc) { srs_error_t err = srs_success; @@ -2939,7 +2939,7 @@ srs_error_t SrsRtcConnection::negotiate_publish_capability(SrsRtcUserConfig* ruc return err; } -srs_error_t SrsRtcConnection::generate_publish_local_sdp(SrsRequest* req, SrsSdp& local_sdp, SrsRtcStreamDescription* stream_desc, bool unified_plan) +srs_error_t SrsRtcConnection::generate_publish_local_sdp(SrsRequest* req, SrsSdp& local_sdp, SrsRtcSourceDescription* stream_desc, bool unified_plan) { srs_error_t err = srs_success; @@ -3056,7 +3056,7 @@ srs_error_t SrsRtcConnection::negotiate_play_capability(SrsRtcUserConfig* ruc, s // TODO: FIME: Should check packetization-mode=1 also. bool has_42e01f = srs_sdp_has_h264_profile(remote_sdp, "42e01f"); - SrsRtcStream* source = NULL; + SrsRtcSource* source = NULL; if ((err = _srs_rtc_sources->fetch_or_create(req, &source)) != srs_success) { return srs_error_wrap(err, "fetch rtc source"); } @@ -3177,7 +3177,7 @@ srs_error_t SrsRtcConnection::fetch_source_capability(SrsRequest* req, std::map< bool nack_enabled = _srs_config->get_rtc_nack_enabled(req->vhost); bool twcc_enabled = _srs_config->get_rtc_twcc_enabled(req->vhost); - SrsRtcStream* source = NULL; + SrsRtcSource* source = NULL; if ((err = _srs_rtc_sources->fetch_or_create(req, &source)) != srs_success) { return srs_error_wrap(err, "fetch rtc source"); } @@ -3274,7 +3274,7 @@ void video_track_generate_play_offer(SrsRtcTrackDescription* track, string mid, } } -srs_error_t SrsRtcConnection::generate_play_local_sdp(SrsRequest* req, SrsSdp& local_sdp, SrsRtcStreamDescription* stream_desc, bool unified_plan) +srs_error_t SrsRtcConnection::generate_play_local_sdp(SrsRequest* req, SrsSdp& local_sdp, SrsRtcSourceDescription* stream_desc, bool unified_plan) { srs_error_t err = srs_success; @@ -3468,7 +3468,7 @@ srs_error_t SrsRtcConnection::create_player(SrsRequest* req, std::map audio_tracks_; std::map video_tracks_; @@ -252,9 +252,9 @@ public: virtual ~SrsRtcPlayStream(); public: srs_error_t initialize(SrsRequest* request, std::map sub_relations); -// Interface ISrsRtcStreamChangeCallback +// Interface ISrsRtcSourceChangeCallback public: - void on_stream_change(SrsRtcStreamDescription* desc); + void on_stream_change(SrsRtcSourceDescription* desc); // interface ISrsReloadHandler public: virtual srs_error_t on_reload_vhost_play(std::string vhost); @@ -335,7 +335,7 @@ private: SrsErrorPithyPrint* pli_epp; private: SrsRequest* req; - SrsRtcStream* source; + SrsRtcSource* source; // Simulators. int nn_simulate_nack_drop; private: @@ -353,7 +353,7 @@ public: SrsRtcPublishStream(SrsRtcConnection* session, const SrsContextId& cid); virtual ~SrsRtcPublishStream(); public: - srs_error_t initialize(SrsRequest* req, SrsRtcStreamDescription* stream_desc); + srs_error_t initialize(SrsRequest* req, SrsRtcSourceDescription* stream_desc); srs_error_t start(); // Directly set the status of track, generally for init to set the default value. void set_all_tracks_status(bool status); @@ -553,15 +553,15 @@ public: private: srs_error_t on_binding_request(SrsStunPacket* r); // publish media capabilitiy negotiate - srs_error_t negotiate_publish_capability(SrsRtcUserConfig* ruc, SrsRtcStreamDescription* stream_desc); - srs_error_t generate_publish_local_sdp(SrsRequest* req, SrsSdp& local_sdp, SrsRtcStreamDescription* stream_desc, bool unified_plan); + srs_error_t negotiate_publish_capability(SrsRtcUserConfig* ruc, SrsRtcSourceDescription* stream_desc); + srs_error_t generate_publish_local_sdp(SrsRequest* req, SrsSdp& local_sdp, SrsRtcSourceDescription* stream_desc, bool unified_plan); // play media capabilitiy negotiate //TODO: Use StreamDescription to negotiate and remove first negotiate_play_capability function srs_error_t negotiate_play_capability(SrsRtcUserConfig* ruc, std::map& sub_relations); srs_error_t fetch_source_capability(SrsRequest* req, std::map& sub_relations); - srs_error_t generate_play_local_sdp(SrsRequest* req, SrsSdp& local_sdp, SrsRtcStreamDescription* stream_desc, bool unified_plan); + srs_error_t generate_play_local_sdp(SrsRequest* req, SrsSdp& local_sdp, SrsRtcSourceDescription* stream_desc, bool unified_plan); srs_error_t create_player(SrsRequest* request, std::map sub_relations); - srs_error_t create_publisher(SrsRequest* request, SrsRtcStreamDescription* stream_desc); + srs_error_t create_publisher(SrsRequest* request, SrsRtcSourceDescription* stream_desc); }; class ISrsRtcHijacker diff --git a/trunk/src/app/srs_app_rtc_server.cpp b/trunk/src/app/srs_app_rtc_server.cpp index c7a062376..a6a226803 100644 --- a/trunk/src/app/srs_app_rtc_server.cpp +++ b/trunk/src/app/srs_app_rtc_server.cpp @@ -469,7 +469,7 @@ srs_error_t SrsRtcServer::create_session(SrsRtcUserConfig* ruc, SrsSdp& local_sd SrsRequest* req = ruc->req_; - SrsRtcStream* source = NULL; + SrsRtcSource* source = NULL; if ((err = _srs_rtc_sources->fetch_or_create(req, &source)) != srs_success) { return srs_error_wrap(err, "create source"); } diff --git a/trunk/src/app/srs_app_rtc_server.hpp b/trunk/src/app/srs_app_rtc_server.hpp index d302ad64b..ae6af477e 100644 --- a/trunk/src/app/srs_app_rtc_server.hpp +++ b/trunk/src/app/srs_app_rtc_server.hpp @@ -40,7 +40,7 @@ class SrsHourGlass; class SrsRtcConnection; class SrsRequest; class SrsSdp; -class SrsRtcStream; +class SrsRtcSource; class SrsResourceManager; // The UDP black hole, for developer to use wireshark to catch plaintext packets. diff --git a/trunk/src/app/srs_app_rtc_source.cpp b/trunk/src/app/srs_app_rtc_source.cpp index fe20b743a..3ee15606c 100644 --- a/trunk/src/app/srs_app_rtc_source.cpp +++ b/trunk/src/app/srs_app_rtc_source.cpp @@ -152,15 +152,15 @@ SrsNtp SrsNtp::to_time_ms(uint64_t ntp) return srs_ntp; } -ISrsRtcStreamChangeCallback::ISrsRtcStreamChangeCallback() +ISrsRtcSourceChangeCallback::ISrsRtcSourceChangeCallback() { } -ISrsRtcStreamChangeCallback::~ISrsRtcStreamChangeCallback() +ISrsRtcSourceChangeCallback::~ISrsRtcSourceChangeCallback() { } -SrsRtcConsumer::SrsRtcConsumer(SrsRtcStream* s) +SrsRtcConsumer::SrsRtcConsumer(SrsRtcSource* s) { source = s; should_update_source_id = false; @@ -240,24 +240,24 @@ void SrsRtcConsumer::wait(int nb_msgs) srs_cond_wait(mw_wait); } -void SrsRtcConsumer::on_stream_change(SrsRtcStreamDescription* desc) +void SrsRtcConsumer::on_stream_change(SrsRtcSourceDescription* desc) { if (handler_) { handler_->on_stream_change(desc); } } -SrsRtcStreamManager::SrsRtcStreamManager() +SrsRtcSourceManager::SrsRtcSourceManager() { lock = srs_mutex_new(); } -SrsRtcStreamManager::~SrsRtcStreamManager() +SrsRtcSourceManager::~SrsRtcSourceManager() { srs_mutex_destroy(lock); } -srs_error_t SrsRtcStreamManager::fetch_or_create(SrsRequest* r, SrsRtcStream** pps) +srs_error_t SrsRtcSourceManager::fetch_or_create(SrsRequest* r, SrsRtcSource** pps) { srs_error_t err = srs_success; @@ -265,7 +265,7 @@ srs_error_t SrsRtcStreamManager::fetch_or_create(SrsRequest* r, SrsRtcStream** p // @bug https://github.com/ossrs/srs/issues/1230 SrsLocker(lock); - SrsRtcStream* source = NULL; + SrsRtcSource* source = NULL; if ((source = fetch(r)) != NULL) { *pps = source; return err; @@ -279,7 +279,7 @@ srs_error_t SrsRtcStreamManager::fetch_or_create(SrsRequest* r, SrsRtcStream** p srs_trace("new source, stream_url=%s", stream_url.c_str()); - source = new SrsRtcStream(); + source = new SrsRtcSource(); if ((err = source->initialize(r)) != srs_success) { return srs_error_wrap(err, "init source %s", r->get_stream_url().c_str()); } @@ -291,9 +291,9 @@ srs_error_t SrsRtcStreamManager::fetch_or_create(SrsRequest* r, SrsRtcStream** p return err; } -SrsRtcStream* SrsRtcStreamManager::fetch(SrsRequest* r) +SrsRtcSource* SrsRtcSourceManager::fetch(SrsRequest* r) { - SrsRtcStream* source = NULL; + SrsRtcSource* source = NULL; string stream_url = r->get_stream_url(); if (pool.find(stream_url) == pool.end()) { @@ -310,7 +310,7 @@ SrsRtcStream* SrsRtcStreamManager::fetch(SrsRequest* r) return source; } -SrsRtcStreamManager* _srs_rtc_sources = NULL; +SrsRtcSourceManager* _srs_rtc_sources = NULL; ISrsRtcPublishStream::ISrsRtcPublishStream() { @@ -320,11 +320,11 @@ ISrsRtcPublishStream::~ISrsRtcPublishStream() { } -ISrsRtcStreamEventHandler::ISrsRtcStreamEventHandler() +ISrsRtcSourceEventHandler::ISrsRtcSourceEventHandler() { } -ISrsRtcStreamEventHandler::~ISrsRtcStreamEventHandler() +ISrsRtcSourceEventHandler::~ISrsRtcSourceEventHandler() { } @@ -336,7 +336,7 @@ ISrsRtcSourceBridger::~ISrsRtcSourceBridger() { } -SrsRtcStream::SrsRtcStream() +SrsRtcSource::SrsRtcSource() { is_created_ = false; is_delivering_packets_ = false; @@ -350,7 +350,7 @@ SrsRtcStream::SrsRtcStream() pli_for_rtmp_ = pli_elapsed_ = 0; } -SrsRtcStream::~SrsRtcStream() +SrsRtcSource::~SrsRtcSource() { // never free the consumers, // for all consumers are auto free. @@ -361,7 +361,7 @@ SrsRtcStream::~SrsRtcStream() srs_freep(stream_desc_); } -srs_error_t SrsRtcStream::initialize(SrsRequest* r) +srs_error_t SrsRtcSource::initialize(SrsRequest* r) { srs_error_t err = srs_success; @@ -370,12 +370,12 @@ srs_error_t SrsRtcStream::initialize(SrsRequest* r) return err; } -void SrsRtcStream::update_auth(SrsRequest* r) +void SrsRtcSource::update_auth(SrsRequest* r) { req->update_auth(r); } -srs_error_t SrsRtcStream::on_source_changed() +srs_error_t SrsRtcSource::on_source_changed() { srs_error_t err = srs_success; @@ -408,23 +408,23 @@ srs_error_t SrsRtcStream::on_source_changed() return err; } -SrsContextId SrsRtcStream::source_id() +SrsContextId SrsRtcSource::source_id() { return _source_id; } -SrsContextId SrsRtcStream::pre_source_id() +SrsContextId SrsRtcSource::pre_source_id() { return _pre_source_id; } -void SrsRtcStream::set_bridger(ISrsRtcSourceBridger *bridger) +void SrsRtcSource::set_bridger(ISrsRtcSourceBridger *bridger) { srs_freep(bridger_); bridger_ = bridger; } -srs_error_t SrsRtcStream::create_consumer(SrsRtcConsumer*& consumer) +srs_error_t SrsRtcSource::create_consumer(SrsRtcConsumer*& consumer) { srs_error_t err = srs_success; @@ -436,7 +436,7 @@ srs_error_t SrsRtcStream::create_consumer(SrsRtcConsumer*& consumer) return err; } -srs_error_t SrsRtcStream::consumer_dumps(SrsRtcConsumer* consumer, bool ds, bool dm, bool dg) +srs_error_t SrsRtcSource::consumer_dumps(SrsRtcConsumer* consumer, bool ds, bool dm, bool dg) { srs_error_t err = srs_success; @@ -446,7 +446,7 @@ srs_error_t SrsRtcStream::consumer_dumps(SrsRtcConsumer* consumer, bool ds, bool return err; } -void SrsRtcStream::on_consumer_destroy(SrsRtcConsumer* consumer) +void SrsRtcSource::on_consumer_destroy(SrsRtcConsumer* consumer) { std::vector::iterator it; it = std::find(consumers.begin(), consumers.end(), consumer); @@ -457,26 +457,26 @@ void SrsRtcStream::on_consumer_destroy(SrsRtcConsumer* consumer) // When all consumers finished, notify publisher to handle it. if (publish_stream_ && consumers.empty()) { for (size_t i = 0; i < event_handlers_.size(); i++) { - ISrsRtcStreamEventHandler* h = event_handlers_.at(i); + ISrsRtcSourceEventHandler* h = event_handlers_.at(i); h->on_consumers_finished(); } } } -bool SrsRtcStream::can_publish() +bool SrsRtcSource::can_publish() { // TODO: FIXME: Should check the status of bridger. return !is_created_; } -void SrsRtcStream::set_stream_created() +void SrsRtcSource::set_stream_created() { srs_assert(!is_created_ && !is_delivering_packets_); is_created_ = true; } -srs_error_t SrsRtcStream::on_publish() +srs_error_t SrsRtcSource::on_publish() { srs_error_t err = srs_success; @@ -502,7 +502,7 @@ srs_error_t SrsRtcStream::on_publish() // The PLI interval for RTC2RTMP. pli_for_rtmp_ = _srs_config->get_rtc_pli_for_rtmp(req->vhost); - // @see SrsRtcStream::on_timer() + // @see SrsRtcSource::on_timer() _srs_hybrid->timer100ms()->subscribe(this); } @@ -511,7 +511,7 @@ srs_error_t SrsRtcStream::on_publish() return err; } -void SrsRtcStream::on_unpublish() +void SrsRtcSource::on_unpublish() { // ignore when already unpublished. if (!is_created_) { @@ -529,13 +529,13 @@ void SrsRtcStream::on_unpublish() _source_id = SrsContextId(); for (size_t i = 0; i < event_handlers_.size(); i++) { - ISrsRtcStreamEventHandler* h = event_handlers_.at(i); + ISrsRtcSourceEventHandler* h = event_handlers_.at(i); h->on_unpublish(); } //free bridger resource if (bridger_) { - // For SrsRtcStream::on_timer() + // For SrsRtcSource::on_timer() _srs_hybrid->timer100ms()->unsubscribe(this); bridger_->on_unpublish(); @@ -548,33 +548,33 @@ void SrsRtcStream::on_unpublish() // TODO: FIXME: Handle by statistic. } -void SrsRtcStream::subscribe(ISrsRtcStreamEventHandler* h) +void SrsRtcSource::subscribe(ISrsRtcSourceEventHandler* h) { if (std::find(event_handlers_.begin(), event_handlers_.end(), h) == event_handlers_.end()) { event_handlers_.push_back(h); } } -void SrsRtcStream::unsubscribe(ISrsRtcStreamEventHandler* h) +void SrsRtcSource::unsubscribe(ISrsRtcSourceEventHandler* h) { - std::vector::iterator it; + std::vector::iterator it; it = std::find(event_handlers_.begin(), event_handlers_.end(), h); if (it != event_handlers_.end()) { event_handlers_.erase(it); } } -ISrsRtcPublishStream* SrsRtcStream::publish_stream() +ISrsRtcPublishStream* SrsRtcSource::publish_stream() { return publish_stream_; } -void SrsRtcStream::set_publish_stream(ISrsRtcPublishStream* v) +void SrsRtcSource::set_publish_stream(ISrsRtcPublishStream* v) { publish_stream_ = v; } -srs_error_t SrsRtcStream::on_rtp(SrsRtpPacket* pkt) +srs_error_t SrsRtcSource::on_rtp(SrsRtpPacket* pkt) { srs_error_t err = srs_success; @@ -598,12 +598,12 @@ srs_error_t SrsRtcStream::on_rtp(SrsRtpPacket* pkt) return err; } -bool SrsRtcStream::has_stream_desc() +bool SrsRtcSource::has_stream_desc() { return stream_desc_; } -void SrsRtcStream::set_stream_desc(SrsRtcStreamDescription* stream_desc) +void SrsRtcSource::set_stream_desc(SrsRtcSourceDescription* stream_desc) { srs_freep(stream_desc_); @@ -612,7 +612,7 @@ void SrsRtcStream::set_stream_desc(SrsRtcStreamDescription* stream_desc) } } -std::vector SrsRtcStream::get_track_desc(std::string type, std::string media_name) +std::vector SrsRtcSource::get_track_desc(std::string type, std::string media_name) { std::vector track_descs; if (!stream_desc_) { @@ -636,7 +636,7 @@ std::vector SrsRtcStream::get_track_desc(std::string ty return track_descs; } -srs_error_t SrsRtcStream::on_timer(srs_utime_t interval) +srs_error_t SrsRtcSource::on_timer(srs_utime_t interval) { srs_error_t err = srs_success; @@ -662,7 +662,7 @@ srs_error_t SrsRtcStream::on_timer(srs_utime_t interval) } #ifdef SRS_FFMPEG_FIT -SrsRtcFromRtmpBridger::SrsRtcFromRtmpBridger(SrsRtcStream* source) +SrsRtcFromRtmpBridger::SrsRtcFromRtmpBridger(SrsRtcSource* source) { req = NULL; source_ = source; @@ -675,8 +675,8 @@ SrsRtcFromRtmpBridger::SrsRtcFromRtmpBridger(SrsRtcStream* source) audio_sequence = 0; video_sequence = 0; - SrsRtcStreamDescription* stream_desc = new SrsRtcStreamDescription(); - SrsAutoFree(SrsRtcStreamDescription, stream_desc); + SrsRtcSourceDescription* stream_desc = new SrsRtcSourceDescription(); + SrsAutoFree(SrsRtcSourceDescription, stream_desc); // audio track description if (true) { @@ -989,7 +989,7 @@ srs_error_t SrsRtcFromRtmpBridger::filter(SrsSharedPtrMessage* msg, SrsFormat* f return err; } -srs_error_t SrsRtcFromRtmpBridger::package_stap_a(SrsRtcStream* source, SrsSharedPtrMessage* msg, SrsRtpPacket* pkt) +srs_error_t SrsRtcFromRtmpBridger::package_stap_a(SrsRtcSource* source, SrsSharedPtrMessage* msg, SrsRtpPacket* pkt) { srs_error_t err = srs_success; @@ -2130,12 +2130,12 @@ SrsRtcTrackDescription* SrsRtcTrackDescription::copy() return cp; } -SrsRtcStreamDescription::SrsRtcStreamDescription() +SrsRtcSourceDescription::SrsRtcSourceDescription() { audio_track_desc_ = NULL; } -SrsRtcStreamDescription::~SrsRtcStreamDescription() +SrsRtcSourceDescription::~SrsRtcSourceDescription() { srs_freep(audio_track_desc_); @@ -2145,9 +2145,9 @@ SrsRtcStreamDescription::~SrsRtcStreamDescription() video_track_descs_.clear(); } -SrsRtcStreamDescription* SrsRtcStreamDescription::copy() +SrsRtcSourceDescription* SrsRtcSourceDescription::copy() { - SrsRtcStreamDescription* stream_desc = new SrsRtcStreamDescription(); + SrsRtcSourceDescription* stream_desc = new SrsRtcSourceDescription(); if (audio_track_desc_) { stream_desc->audio_track_desc_ = audio_track_desc_->copy(); @@ -2160,7 +2160,7 @@ SrsRtcStreamDescription* SrsRtcStreamDescription::copy() return stream_desc; } -SrsRtcTrackDescription* SrsRtcStreamDescription::find_track_description_by_ssrc(uint32_t ssrc) +SrsRtcTrackDescription* SrsRtcSourceDescription::find_track_description_by_ssrc(uint32_t ssrc) { if (audio_track_desc_ && audio_track_desc_->has_ssrc(ssrc)) { return audio_track_desc_; @@ -2328,7 +2328,7 @@ void SrsRtcAudioRecvTrack::on_before_decode_payload(SrsRtpPacket* pkt, SrsBuffer *ppt = SrsRtspPacketPayloadTypeRaw; } -srs_error_t SrsRtcAudioRecvTrack::on_rtp(SrsRtcStream* source, SrsRtpPacket* pkt) +srs_error_t SrsRtcAudioRecvTrack::on_rtp(SrsRtcSource* source, SrsRtpPacket* pkt) { srs_error_t err = srs_success; @@ -2384,7 +2384,7 @@ void SrsRtcVideoRecvTrack::on_before_decode_payload(SrsRtpPacket* pkt, SrsBuffer } } -srs_error_t SrsRtcVideoRecvTrack::on_rtp(SrsRtcStream* source, SrsRtpPacket* pkt) +srs_error_t SrsRtcVideoRecvTrack::on_rtp(SrsRtcSource* source, SrsRtpPacket* pkt) { srs_error_t err = srs_success; diff --git a/trunk/src/app/srs_app_rtc_source.hpp b/trunk/src/app/srs_app_rtc_source.hpp index e8075ed01..23fae5b34 100644 --- a/trunk/src/app/srs_app_rtc_source.hpp +++ b/trunk/src/app/srs_app_rtc_source.hpp @@ -43,12 +43,12 @@ class SrsMetaCache; class SrsSharedPtrMessage; class SrsCommonMessage; class SrsMessageArray; -class SrsRtcStream; +class SrsRtcSource; class SrsRtcFromRtmpBridger; class SrsAudioTranscoder; class SrsRtpPacket; class SrsSample; -class SrsRtcStreamDescription; +class SrsRtcSourceDescription; class SrsRtcTrackDescription; class SrsRtcConnection; class SrsRtpRingBuffer; @@ -74,20 +74,20 @@ public: }; // When RTC stream publish and re-publish. -class ISrsRtcStreamChangeCallback +class ISrsRtcSourceChangeCallback { public: - ISrsRtcStreamChangeCallback(); - virtual ~ISrsRtcStreamChangeCallback(); + ISrsRtcSourceChangeCallback(); + virtual ~ISrsRtcSourceChangeCallback(); public: - virtual void on_stream_change(SrsRtcStreamDescription* desc) = 0; + virtual void on_stream_change(SrsRtcSourceDescription* desc) = 0; }; // The RTC stream consumer, consume packets from RTC stream source. class SrsRtcConsumer { private: - SrsRtcStream* source; + SrsRtcSource* source; std::vector queue; // when source id changed, notice all consumers bool should_update_source_id; @@ -98,9 +98,9 @@ private: int mw_min_msgs; private: // The callback for stream change event. - ISrsRtcStreamChangeCallback* handler_; + ISrsRtcSourceChangeCallback* handler_; public: - SrsRtcConsumer(SrsRtcStream* s); + SrsRtcConsumer(SrsRtcSource* s); virtual ~SrsRtcConsumer(); public: // When source id changed, notice client to print. @@ -113,31 +113,31 @@ public: // Wait for at-least some messages incoming in queue. virtual void wait(int nb_msgs); public: - void set_handler(ISrsRtcStreamChangeCallback* h) { handler_ = h; } // SrsRtcConsumer::set_handler() - void on_stream_change(SrsRtcStreamDescription* desc); + void set_handler(ISrsRtcSourceChangeCallback* h) { handler_ = h; } // SrsRtcConsumer::set_handler() + void on_stream_change(SrsRtcSourceDescription* desc); }; -class SrsRtcStreamManager +class SrsRtcSourceManager { private: srs_mutex_t lock; - std::map pool; + std::map pool; public: - SrsRtcStreamManager(); - virtual ~SrsRtcStreamManager(); + SrsRtcSourceManager(); + virtual ~SrsRtcSourceManager(); public: // create source when fetch from cache failed. // @param r the client request. // @param pps the matched source, if success never be NULL. - virtual srs_error_t fetch_or_create(SrsRequest* r, SrsRtcStream** pps); + virtual srs_error_t fetch_or_create(SrsRequest* r, SrsRtcSource** pps); private: // Get the exists source, NULL when not exists. // update the request and return the exists source. - virtual SrsRtcStream* fetch(SrsRequest* r); + virtual SrsRtcSource* fetch(SrsRequest* r); }; // Global singleton instance. -extern SrsRtcStreamManager* _srs_rtc_sources; +extern SrsRtcSourceManager* _srs_rtc_sources; // A publish stream interface, for source to callback with. class ISrsRtcPublishStream @@ -150,11 +150,11 @@ public: virtual void request_keyframe(uint32_t ssrc) = 0; }; -class ISrsRtcStreamEventHandler +class ISrsRtcSourceEventHandler { public: - ISrsRtcStreamEventHandler(); - virtual ~ISrsRtcStreamEventHandler(); + ISrsRtcSourceEventHandler(); + virtual ~ISrsRtcSourceEventHandler(); public: // stream unpublish, sync API. virtual void on_unpublish() = 0; @@ -162,7 +162,7 @@ public: virtual void on_consumers_finished() = 0; }; -// SrsRtcStream bridge to SrsLiveSource +// SrsRtcSource bridge to SrsLiveSource class ISrsRtcSourceBridger { public: @@ -175,7 +175,7 @@ public: }; // A Source is a stream, to publish and to play with, binding to SrsRtcPublishStream and SrsRtcPlayStream. -class SrsRtcStream : public ISrsFastTimer +class SrsRtcSource : public ISrsFastTimer { private: // For publish, it's the publish client id. @@ -188,7 +188,7 @@ private: SrsRequest* req; ISrsRtcPublishStream* publish_stream_; // Steam description for this steam. - SrsRtcStreamDescription* stream_desc_; + SrsRtcSourceDescription* stream_desc_; // The Source bridger, bridger stream to other source. ISrsRtcSourceBridger* bridger_; private: @@ -199,14 +199,14 @@ private: // Whether stream is delivering data, that is, DTLS is done. bool is_delivering_packets_; // Notify stream event to event handler - std::vector event_handlers_; + std::vector event_handlers_; private: // The PLI for RTC2RTMP. srs_utime_t pli_for_rtmp_; srs_utime_t pli_elapsed_; public: - SrsRtcStream(); - virtual ~SrsRtcStream(); + SrsRtcSource(); + virtual ~SrsRtcSource(); public: virtual srs_error_t initialize(SrsRequest* r); // Update the authentication information in request. @@ -241,8 +241,8 @@ public: virtual void on_unpublish(); public: // For event handler - void subscribe(ISrsRtcStreamEventHandler* h); - void unsubscribe(ISrsRtcStreamEventHandler* h); + void subscribe(ISrsRtcSourceEventHandler* h); + void unsubscribe(ISrsRtcSourceEventHandler* h); public: // Get and set the publisher, passed to consumer to process requests such as PLI. ISrsRtcPublishStream* publish_stream(); @@ -251,7 +251,7 @@ public: srs_error_t on_rtp(SrsRtpPacket* pkt); // Set and get stream description for souce bool has_stream_desc(); - void set_stream_desc(SrsRtcStreamDescription* stream_desc); + void set_stream_desc(SrsRtcSourceDescription* stream_desc); std::vector get_track_desc(std::string type, std::string media_type); // interface ISrsFastTimer private: @@ -263,7 +263,7 @@ class SrsRtcFromRtmpBridger : public ISrsLiveSourceBridger { private: SrsRequest* req; - SrsRtcStream* source_; + SrsRtcSource* source_; // The format, codec information. SrsRtmpFormat* format; // The metadata cache. @@ -278,7 +278,7 @@ private: uint32_t audio_ssrc; uint32_t video_ssrc; public: - SrsRtcFromRtmpBridger(SrsRtcStream* source); + SrsRtcFromRtmpBridger(SrsRtcSource* source); virtual ~SrsRtcFromRtmpBridger(); public: virtual srs_error_t initialize(SrsRequest* r); @@ -292,7 +292,7 @@ public: virtual srs_error_t on_video(SrsSharedPtrMessage* msg); private: srs_error_t filter(SrsSharedPtrMessage* msg, SrsFormat* format, bool& has_idr, std::vector& samples); - srs_error_t package_stap_a(SrsRtcStream* source, SrsSharedPtrMessage* msg, SrsRtpPacket* pkt); + srs_error_t package_stap_a(SrsRtcSource* source, SrsSharedPtrMessage* msg, SrsRtpPacket* pkt); srs_error_t package_nalus(SrsSharedPtrMessage* msg, const std::vector& samples, std::vector& pkts); srs_error_t package_single_nalu(SrsSharedPtrMessage* msg, SrsSample* sample, std::vector& pkts); srs_error_t package_fu_a(SrsSharedPtrMessage* msg, SrsSample* sample, int fu_payload_size, std::vector& pkts); @@ -504,7 +504,7 @@ public: SrsRtcTrackDescription* copy(); }; -class SrsRtcStreamDescription +class SrsRtcSourceDescription { public: // the id for this stream; @@ -513,11 +513,11 @@ public: SrsRtcTrackDescription* audio_track_desc_; std::vector video_track_descs_; public: - SrsRtcStreamDescription(); - virtual ~SrsRtcStreamDescription(); + SrsRtcSourceDescription(); + virtual ~SrsRtcSourceDescription(); public: - SrsRtcStreamDescription* copy(); + SrsRtcSourceDescription* copy(); SrsRtcTrackDescription* find_track_description_by_ssrc(uint32_t ssrc); }; @@ -556,7 +556,7 @@ public: // set to NULL, nack nerver copy it but set the pkt to NULL. srs_error_t on_nack(SrsRtpPacket** ppkt); public: - virtual srs_error_t on_rtp(SrsRtcStream* source, SrsRtpPacket* pkt) = 0; + virtual srs_error_t on_rtp(SrsRtcSource* source, SrsRtpPacket* pkt) = 0; virtual srs_error_t check_send_nacks() = 0; protected: virtual srs_error_t do_check_send_nacks(uint32_t& timeout_nacks); @@ -570,7 +570,7 @@ public: public: virtual void on_before_decode_payload(SrsRtpPacket* pkt, SrsBuffer* buf, ISrsRtpPayloader** ppayload, SrsRtspPacketPayloadType* ppt); public: - virtual srs_error_t on_rtp(SrsRtcStream* source, SrsRtpPacket* pkt); + virtual srs_error_t on_rtp(SrsRtcSource* source, SrsRtpPacket* pkt); virtual srs_error_t check_send_nacks(); }; @@ -582,7 +582,7 @@ public: public: virtual void on_before_decode_payload(SrsRtpPacket* pkt, SrsBuffer* buf, ISrsRtpPayloader** ppayload, SrsRtspPacketPayloadType* ppt); public: - virtual srs_error_t on_rtp(SrsRtcStream* source, SrsRtpPacket* pkt); + virtual srs_error_t on_rtp(SrsRtcSource* source, SrsRtpPacket* pkt); virtual srs_error_t check_send_nacks(); }; diff --git a/trunk/src/app/srs_app_rtmp_conn.cpp b/trunk/src/app/srs_app_rtmp_conn.cpp index 637069d65..c228b7d05 100644 --- a/trunk/src/app/srs_app_rtmp_conn.cpp +++ b/trunk/src/app/srs_app_rtmp_conn.cpp @@ -963,7 +963,7 @@ srs_error_t SrsRtmpConn::acquire_publish(SrsLiveSource* source) // Check whether RTC stream is busy. #ifdef SRS_RTC - SrsRtcStream *rtc = NULL; + SrsRtcSource *rtc = NULL; bool rtc_server_enabled = _srs_config->get_rtc_server_enabled(); bool rtc_enabled = _srs_config->get_rtc_enabled(req->vhost); if (rtc_server_enabled && rtc_enabled && !info->edge) { diff --git a/trunk/src/app/srs_app_source.hpp b/trunk/src/app/srs_app_source.hpp index 6a8193d75..b06ccc364 100644 --- a/trunk/src/app/srs_app_source.hpp +++ b/trunk/src/app/srs_app_source.hpp @@ -487,7 +487,7 @@ public: // Global singleton instance. extern SrsLiveSourceManager* _srs_sources; -// For RTMP2RTC, bridge SrsLiveSource to SrsRtcStream +// For RTMP2RTC, bridge SrsLiveSource to SrsRtcSource class ISrsLiveSourceBridger { public: diff --git a/trunk/src/app/srs_app_threads.cpp b/trunk/src/app/srs_app_threads.cpp index 25aeb4705..8f4b52715 100644 --- a/trunk/src/app/srs_app_threads.cpp +++ b/trunk/src/app/srs_app_threads.cpp @@ -291,7 +291,7 @@ srs_error_t srs_thread_initialize() // The global objects which depends on ST. _srs_hybrid = new SrsHybridServer(); - _srs_rtc_sources = new SrsRtcStreamManager(); + _srs_rtc_sources = new SrsRtcSourceManager(); _srs_sources = new SrsLiveSourceManager(); _srs_stages = new SrsStageManager(); _srs_blackhole = new SrsRtcBlackhole(); diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp index ca1e9f4e5..51d8cf1af 100644 --- a/trunk/src/core/srs_core_version4.hpp +++ b/trunk/src/core/srs_core_version4.hpp @@ -26,6 +26,6 @@ #define VERSION_MAJOR 4 #define VERSION_MINOR 0 -#define VERSION_REVISION 112 +#define VERSION_REVISION 113 #endif