mirror of
https://github.com/ossrs/srs.git
synced 2025-02-13 11:51:57 +00:00
SquashSRS4: Eliminate dead code, we never offer
This commit is contained in:
parent
ecd4527342
commit
ff268dca23
5 changed files with 1 additions and 124 deletions
|
@ -1851,53 +1851,6 @@ srs_error_t SrsRtcConnection::add_player(SrsRequest* req, const SrsSdp& remote_s
|
|||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsRtcConnection::add_player2(SrsRequest* req, bool unified_plan, SrsSdp& local_sdp)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
if (_srs_rtc_hijacker) {
|
||||
if ((err = _srs_rtc_hijacker->on_before_play(this, req)) != srs_success) {
|
||||
return srs_error_wrap(err, "before play");
|
||||
}
|
||||
}
|
||||
|
||||
std::map<uint32_t, SrsRtcTrackDescription*> play_sub_relations;
|
||||
if ((err = fetch_source_capability(req, play_sub_relations)) != srs_success) {
|
||||
return srs_error_wrap(err, "play negotiate");
|
||||
}
|
||||
|
||||
if (!play_sub_relations.size()) {
|
||||
return srs_error_new(ERROR_RTC_SDP_EXCHANGE, "no play relations");
|
||||
}
|
||||
|
||||
SrsRtcStreamDescription* stream_desc = new SrsRtcStreamDescription();
|
||||
SrsAutoFree(SrsRtcStreamDescription, stream_desc);
|
||||
|
||||
std::map<uint32_t, SrsRtcTrackDescription*>::iterator it = play_sub_relations.begin();
|
||||
while (it != play_sub_relations.end()) {
|
||||
SrsRtcTrackDescription* track_desc = it->second;
|
||||
|
||||
if (track_desc->type_ == "audio" || !stream_desc->audio_track_desc_) {
|
||||
stream_desc->audio_track_desc_ = track_desc->copy();
|
||||
}
|
||||
|
||||
if (track_desc->type_ == "video") {
|
||||
stream_desc->video_track_descs_.push_back(track_desc->copy());
|
||||
}
|
||||
++it;
|
||||
}
|
||||
|
||||
if ((err = generate_play_local_sdp(req, local_sdp, stream_desc, unified_plan)) != srs_success) {
|
||||
return srs_error_wrap(err, "generate local sdp");
|
||||
}
|
||||
|
||||
if ((err = create_player(req, play_sub_relations)) != srs_success) {
|
||||
return srs_error_wrap(err, "create player");
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsRtcConnection::initialize(SrsRequest* r, bool dtls, bool srtp, string username)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
|
|
@ -475,8 +475,6 @@ public:
|
|||
public:
|
||||
srs_error_t add_publisher(SrsRequest* request, const SrsSdp& remote_sdp, SrsSdp& local_sdp);
|
||||
srs_error_t add_player(SrsRequest* request, const SrsSdp& remote_sdp, SrsSdp& local_sdp);
|
||||
// server send offer sdp to client, local sdp derivate from source stream desc.
|
||||
srs_error_t add_player2(SrsRequest* request, bool unified_plan, SrsSdp& local_sdp);
|
||||
public:
|
||||
// Before initialize, user must set the local SDP, which is used to inititlize DTLS.
|
||||
srs_error_t initialize(SrsRequest* r, bool dtls, bool srtp, std::string username);
|
||||
|
|
|
@ -624,76 +624,6 @@ srs_error_t SrsRtcServer::do_create_session(
|
|||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsRtcServer::create_session2(SrsRequest* req, SrsSdp& local_sdp, const std::string& mock_eip, bool unified_plan, SrsRtcConnection** psession)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
SrsContextId cid = _srs_context->get_id();
|
||||
|
||||
std::string local_pwd = srs_random_str(32);
|
||||
// TODO: FIXME: Collision detect.
|
||||
std::string local_ufrag = srs_random_str(8);
|
||||
|
||||
SrsRtcConnection* session = new SrsRtcConnection(this, cid);
|
||||
// first add player for negotiate local sdp media info
|
||||
if ((err = session->add_player2(req, unified_plan, local_sdp)) != srs_success) {
|
||||
srs_freep(session);
|
||||
return srs_error_wrap(err, "add player2");
|
||||
}
|
||||
*psession = session;
|
||||
|
||||
local_sdp.set_dtls_role("actpass");
|
||||
local_sdp.set_ice_ufrag(local_ufrag);
|
||||
local_sdp.set_ice_pwd(local_pwd);
|
||||
local_sdp.set_fingerprint_algo("sha-256");
|
||||
local_sdp.set_fingerprint(_srs_rtc_dtls_certificate->get_fingerprint());
|
||||
|
||||
// We allows to mock the eip of server.
|
||||
if (!mock_eip.empty()) {
|
||||
string host;
|
||||
int port = _srs_config->get_rtc_server_listen();
|
||||
srs_parse_hostport(mock_eip, host, port);
|
||||
|
||||
local_sdp.add_candidate(host, port, "host");
|
||||
srs_trace("RTC: Use candidate mock_eip %s as %s:%d", mock_eip.c_str(), host.c_str(), port);
|
||||
} else {
|
||||
std::vector<string> candidate_ips = get_candidate_ips();
|
||||
for (int i = 0; i < (int)candidate_ips.size(); ++i) {
|
||||
local_sdp.add_candidate(candidate_ips[i], _srs_config->get_rtc_server_listen(), "host");
|
||||
}
|
||||
srs_trace("RTC: Use candidates %s", srs_join_vector_string(candidate_ips, ", ").c_str());
|
||||
}
|
||||
|
||||
session->set_local_sdp(local_sdp);
|
||||
session->set_state(WAITING_ANSWER);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsRtcServer::setup_session2(SrsRtcConnection* session, SrsRequest* req, const SrsSdp& remote_sdp)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
if (session->state() != WAITING_ANSWER) {
|
||||
return err;
|
||||
}
|
||||
|
||||
// TODO: FIXME: Collision detect.
|
||||
string username = session->get_local_sdp()->get_ice_ufrag() + ":" + remote_sdp.get_ice_ufrag();
|
||||
|
||||
if ((err = session->initialize(req, true, true, username)) != srs_success) {
|
||||
return srs_error_wrap(err, "init");
|
||||
}
|
||||
|
||||
// We allows username is optional, but it never empty here.
|
||||
_srs_rtc_manager->add_with_name(username, session);
|
||||
|
||||
session->set_remote_sdp(remote_sdp);
|
||||
session->set_state(WAITING_STUN);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
SrsRtcConnection* SrsRtcServer::find_session_by_username(const std::string& username)
|
||||
{
|
||||
ISrsResource* conn = _srs_rtc_manager->find_by_name(username);
|
||||
|
|
|
@ -122,10 +122,6 @@ private:
|
|||
SrsRtcConnection* session, SrsRequest* req, const SrsSdp& remote_sdp, SrsSdp& local_sdp,
|
||||
const std::string& mock_eip, bool publish, bool dtls, bool srtp
|
||||
);
|
||||
public:
|
||||
// We start offering, create_session2 to generate offer, setup_session2 to handle answer.
|
||||
srs_error_t create_session2(SrsRequest* req, SrsSdp& local_sdp, const std::string& mock_eip, bool unified_plan, SrsRtcConnection** psession);
|
||||
srs_error_t setup_session2(SrsRtcConnection* session, SrsRequest* req, const SrsSdp& remote_sdp);
|
||||
public:
|
||||
SrsRtcConnection* find_session_by_username(const std::string& ufrag);
|
||||
// interface ISrsHourGlass
|
||||
|
|
|
@ -26,6 +26,6 @@
|
|||
|
||||
#define VERSION_MAJOR 4
|
||||
#define VERSION_MINOR 0
|
||||
#define SRS_VERSION4_REVISION 86
|
||||
#define VERSION_REVISION 86
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue