Skip to content

Commit

Permalink
Cleaned up sdp management (#1303)
Browse files Browse the repository at this point in the history
  • Loading branch information
lodoyun committed Sep 21, 2018
1 parent ca97119 commit 7474983
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 21 deletions.
5 changes: 0 additions & 5 deletions erizo/src/erizo/MediaStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,6 @@ bool MediaStream::setRemoteSdp(std::shared_ptr<SdpInfo> sdp) {
return true;
}

bool MediaStream::setLocalSdp(std::shared_ptr<SdpInfo> 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});
Expand Down
8 changes: 3 additions & 5 deletions erizo/src/erizo/MediaStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<SdpInfo> sdp);
bool setLocalSdp(std::shared_ptr<SdpInfo> sdp);

/**
* Sends a PLI Packet
Expand Down Expand Up @@ -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<SdpInfo> getRemoteSdpInfo() { return remote_sdp_; }

virtual bool isSlideShowModeEnabled() { return slide_show_mode_; }

Expand All @@ -145,8 +144,8 @@ class MediaStream: public MediaSink, public MediaSource, public FeedbackSink,
RtpExtensionProcessor& getRtpExtensionProcessor() { return connection_->getRtpExtensionProcessor(); }
std::shared_ptr<Worker> 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);
Expand Down Expand Up @@ -214,7 +213,6 @@ class MediaStream: public MediaSink, public MediaSource, public FeedbackSink,
std::atomic<uint64_t> bitrate_from_max_quality_layer_;
protected:
std::shared_ptr<SdpInfo> remote_sdp_;
std::shared_ptr<SdpInfo> local_sdp_;
};

class PacketReader : public InboundHandler {
Expand Down
7 changes: 0 additions & 7 deletions erizo/src/erizo/WebRtcConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<WebRtcConnection> weak_this = shared_from_this();
forEachMediaStreamAsync([weak_this] (const std::shared_ptr<MediaStream> &media_stream) {
if (auto connection = weak_this.lock()) {
media_stream->setLocalSdp(connection->local_sdp_);
}
});
return true;
}

Expand Down Expand Up @@ -293,7 +287,6 @@ void WebRtcConnection::setRemoteSdpsToMediaStreams(std::string stream_id) {
(*stream)->asyncTask([weak_this, stream_id] (const std::shared_ptr<MediaStream> &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);
}
Expand Down
3 changes: 1 addition & 2 deletions erizo/src/erizo/rtp/FecReceiverHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 0 additions & 1 deletion erizo/src/test/utils/Mocks.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ class MockMediaStream: public MediaStream {
const std::string& media_stream_id, const std::string& media_stream_label,
std::vector<RtpMap> rtp_mappings, bool is_publisher = true) :
MediaStream(worker, connection, media_stream_id, media_stream_label, is_publisher) {
local_sdp_ = std::make_shared<SdpInfo>(rtp_mappings);
remote_sdp_ = std::make_shared<SdpInfo>(rtp_mappings);
}

Expand Down
2 changes: 1 addition & 1 deletion erizo_controller/erizoJS/models/SessionDescription.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ class SessionDescription {
}

getStreamInfo(info, stream) {
const streamId = stream.id;
const streamId = stream.getId();
let videoSsrcList = [];
let simulcastVideoSsrcList;

Expand Down

0 comments on commit 7474983

Please sign in to comment.