From 74749838afd771c4a164e3a90d27a8a27c0b454d Mon Sep 17 00:00:00 2001 From: Pedro Rodriguez Date: Fri, 21 Sep 2018 17:22:19 +0200 Subject: [PATCH] Cleaned up sdp management (#1303) --- erizo/src/erizo/MediaStream.cpp | 5 ----- erizo/src/erizo/MediaStream.h | 8 +++----- erizo/src/erizo/WebRtcConnection.cpp | 7 ------- erizo/src/erizo/rtp/FecReceiverHandler.cpp | 3 +-- erizo/src/test/utils/Mocks.h | 1 - erizo_controller/erizoJS/models/SessionDescription.js | 2 +- 6 files changed, 5 insertions(+), 21 deletions(-) diff --git a/erizo/src/erizo/MediaStream.cpp b/erizo/src/erizo/MediaStream.cpp index 2a9694a577..54fd904758 100644 --- a/erizo/src/erizo/MediaStream.cpp +++ b/erizo/src/erizo/MediaStream.cpp @@ -208,11 +208,6 @@ bool MediaStream::setRemoteSdp(std::shared_ptr sdp) { return true; } -bool MediaStream::setLocalSdp(std::shared_ptr sdp) { - local_sdp_ = std::move(sdp); - return true; -} - void MediaStream::initializeStats() { log_stats_->getNode().insertStat("streamId", StringStat{getId()}); log_stats_->getNode().insertStat("audioBitrate", CumulativeStat{0}); diff --git a/erizo/src/erizo/MediaStream.h b/erizo/src/erizo/MediaStream.h index 742c728212..692d13006e 100644 --- a/erizo/src/erizo/MediaStream.h +++ b/erizo/src/erizo/MediaStream.h @@ -75,7 +75,6 @@ class MediaStream: public MediaSink, public MediaSource, public FeedbackSink, void setMaxVideoBW(uint32_t max_video_bw); void syncClose(); bool setRemoteSdp(std::shared_ptr sdp); - bool setLocalSdp(std::shared_ptr sdp); /** * Sends a PLI Packet @@ -135,7 +134,7 @@ class MediaStream: public MediaSink, public MediaSource, public FeedbackSink, bool isAudioMuted() { return audio_muted_; } bool isVideoMuted() { return video_muted_; } - SdpInfo* getRemoteSdpInfo() { return remote_sdp_.get(); } + std::shared_ptr getRemoteSdpInfo() { return remote_sdp_; } virtual bool isSlideShowModeEnabled() { return slide_show_mode_; } @@ -145,8 +144,8 @@ class MediaStream: public MediaSink, public MediaSource, public FeedbackSink, RtpExtensionProcessor& getRtpExtensionProcessor() { return connection_->getRtpExtensionProcessor(); } std::shared_ptr getWorker() { return worker_; } - std::string& getId() { return stream_id_; } - std::string& getLabel() { return mslabel_; } + std::string getId() { return stream_id_; } + std::string getLabel() { return mslabel_; } bool isSourceSSRC(uint32_t ssrc); bool isSinkSSRC(uint32_t ssrc); @@ -214,7 +213,6 @@ class MediaStream: public MediaSink, public MediaSource, public FeedbackSink, std::atomic bitrate_from_max_quality_layer_; protected: std::shared_ptr remote_sdp_; - std::shared_ptr local_sdp_; }; class PacketReader : public InboundHandler { diff --git a/erizo/src/erizo/WebRtcConnection.cpp b/erizo/src/erizo/WebRtcConnection.cpp index f0aa021422..e49384254c 100644 --- a/erizo/src/erizo/WebRtcConnection.cpp +++ b/erizo/src/erizo/WebRtcConnection.cpp @@ -152,12 +152,6 @@ bool WebRtcConnection::createOffer(bool video_enabled, bool audioEnabled, bool b std::string msg = this->getLocalSdp(); maybeNotifyWebRtcConnectionEvent(global_state_, msg); - std::weak_ptr weak_this = shared_from_this(); - forEachMediaStreamAsync([weak_this] (const std::shared_ptr &media_stream) { - if (auto connection = weak_this.lock()) { - media_stream->setLocalSdp(connection->local_sdp_); - } - }); return true; } @@ -293,7 +287,6 @@ void WebRtcConnection::setRemoteSdpsToMediaStreams(std::string stream_id) { (*stream)->asyncTask([weak_this, stream_id] (const std::shared_ptr &media_stream) { if (auto connection = weak_this.lock()) { media_stream->setRemoteSdp(connection->remote_sdp_); - media_stream->setLocalSdp(connection->local_sdp_); ELOG_DEBUG("%s message: setting remote SDP to stream, stream: %s", connection->toLog(), media_stream->getId()); connection->onRemoteSdpsSetToMediaStreams(stream_id); } diff --git a/erizo/src/erizo/rtp/FecReceiverHandler.cpp b/erizo/src/erizo/rtp/FecReceiverHandler.cpp index 91d228a6f2..e951161fc9 100644 --- a/erizo/src/erizo/rtp/FecReceiverHandler.cpp +++ b/erizo/src/erizo/rtp/FecReceiverHandler.cpp @@ -32,9 +32,8 @@ void FecReceiverHandler::notifyUpdate() { if (!stream) { return; } - SdpInfo* remote_sdp = stream->getRemoteSdpInfo(); bool is_slide_show_mode_active = stream->isSlideShowModeEnabled(); - if (!remote_sdp->supportPayloadType(RED_90000_PT) || is_slide_show_mode_active) { + if (!stream->getRemoteSdpInfo()->supportPayloadType(RED_90000_PT) || is_slide_show_mode_active) { enable(); } else { disable(); diff --git a/erizo/src/test/utils/Mocks.h b/erizo/src/test/utils/Mocks.h index 5f95f848df..0a313e1e6e 100644 --- a/erizo/src/test/utils/Mocks.h +++ b/erizo/src/test/utils/Mocks.h @@ -103,7 +103,6 @@ class MockMediaStream: public MediaStream { const std::string& media_stream_id, const std::string& media_stream_label, std::vector rtp_mappings, bool is_publisher = true) : MediaStream(worker, connection, media_stream_id, media_stream_label, is_publisher) { - local_sdp_ = std::make_shared(rtp_mappings); remote_sdp_ = std::make_shared(rtp_mappings); } diff --git a/erizo_controller/erizoJS/models/SessionDescription.js b/erizo_controller/erizoJS/models/SessionDescription.js index b72f1122c6..74aa701c2b 100644 --- a/erizo_controller/erizoJS/models/SessionDescription.js +++ b/erizo_controller/erizoJS/models/SessionDescription.js @@ -224,7 +224,7 @@ class SessionDescription { } getStreamInfo(info, stream) { - const streamId = stream.id; + const streamId = stream.getId(); let videoSsrcList = []; let simulcastVideoSsrcList;