mirror of
https://github.com/ossrs/srs.git
synced 2025-02-15 04:42:04 +00:00
RTC: Remove source from conneciton init.
This commit is contained in:
parent
cf46779ad9
commit
b0590ef4fe
4 changed files with 11 additions and 13 deletions
|
@ -1965,8 +1965,7 @@ srs_error_t SrsRtcConnection::add_player2(SrsRequest* req, SrsSdp& local_sdp)
|
|||
return err;
|
||||
}
|
||||
|
||||
// TODO: FIXME: Remove unused source.
|
||||
srs_error_t SrsRtcConnection::initialize(SrsRtcStream* source, SrsRequest* r, bool is_publisher, bool dtls, bool srtp, string username)
|
||||
srs_error_t SrsRtcConnection::initialize(SrsRequest* r, bool is_publisher, bool dtls, bool srtp, string username)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
|
|
@ -395,6 +395,7 @@ private:
|
|||
private:
|
||||
// For each RTC session, we use a specified cid for debugging logs.
|
||||
SrsContextId cid;
|
||||
// TODO: FIXME: Rename to req_.
|
||||
SrsRequest* req;
|
||||
SrsSdp remote_sdp;
|
||||
SrsSdp local_sdp;
|
||||
|
@ -431,7 +432,7 @@ public:
|
|||
srs_error_t add_player2(SrsRequest* request, SrsSdp& local_sdp);
|
||||
public:
|
||||
// Before initialize, user must set the local SDP, which is used to inititlize DTLS.
|
||||
srs_error_t initialize(SrsRtcStream* source, SrsRequest* r, bool is_publisher, bool dtls, bool srtp, std::string username);
|
||||
srs_error_t initialize(SrsRequest* r, bool is_publisher, bool dtls, bool srtp, std::string username);
|
||||
// The peer address may change, we can identify that by STUN messages.
|
||||
srs_error_t on_stun(SrsUdpMuxSocket* skt, SrsStunPacket* r);
|
||||
srs_error_t on_dtls(char* data, int nb_data);
|
||||
|
|
|
@ -398,7 +398,7 @@ srs_error_t SrsRtcServer::create_session(
|
|||
|
||||
// TODO: FIXME: add do_create_session to error process.
|
||||
SrsRtcConnection* session = new SrsRtcConnection(this, cid);
|
||||
if ((err = do_create_session(session, req, remote_sdp, local_sdp, mock_eip, publish, dtls, srtp, source)) != srs_success) {
|
||||
if ((err = do_create_session(session, req, remote_sdp, local_sdp, mock_eip, publish, dtls, srtp)) != srs_success) {
|
||||
srs_freep(session);
|
||||
return srs_error_wrap(err, "create session");
|
||||
}
|
||||
|
@ -410,7 +410,7 @@ srs_error_t SrsRtcServer::create_session(
|
|||
|
||||
srs_error_t SrsRtcServer::do_create_session(
|
||||
SrsRtcConnection* session, SrsRequest* req, const SrsSdp& remote_sdp, SrsSdp& local_sdp, const std::string& mock_eip,
|
||||
bool publish, bool dtls, bool srtp, SrsRtcStream* source
|
||||
bool publish, bool dtls, bool srtp
|
||||
)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
@ -478,11 +478,13 @@ srs_error_t SrsRtcServer::do_create_session(
|
|||
session->set_state(WAITING_STUN);
|
||||
|
||||
// Before session initialize, we must setup the local SDP.
|
||||
if ((err = session->initialize(source, req, publish, dtls, srtp, username)) != srs_success) {
|
||||
if ((err = session->initialize(req, publish, dtls, srtp, username)) != srs_success) {
|
||||
return srs_error_wrap(err, "init");
|
||||
}
|
||||
|
||||
// We allows username is optional, but it never empty here.
|
||||
map_username_session.insert(make_pair(username, session));
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -536,18 +538,14 @@ srs_error_t SrsRtcServer::setup_session2(SrsRtcConnection* session, SrsRequest*
|
|||
return err;
|
||||
}
|
||||
|
||||
SrsRtcStream* source = NULL;
|
||||
if ((err = _srs_rtc_sources->fetch_or_create(req, &source)) != srs_success) {
|
||||
return srs_error_wrap(err, "create source");
|
||||
}
|
||||
|
||||
// TODO: FIXME: Collision detect.
|
||||
string username = session->get_local_sdp()->get_ice_ufrag() + ":" + remote_sdp.get_ice_ufrag();
|
||||
|
||||
if ((err = session->initialize(source, req, false, true, true, username)) != srs_success) {
|
||||
if ((err = session->initialize(req, false, true, true, username)) != srs_success) {
|
||||
return srs_error_wrap(err, "init");
|
||||
}
|
||||
|
||||
// We allows username is optional, but it never empty here.
|
||||
map_username_session.insert(make_pair(username, session));
|
||||
|
||||
session->set_remote_sdp(remote_sdp);
|
||||
|
|
|
@ -109,7 +109,7 @@ public:
|
|||
private:
|
||||
srs_error_t do_create_session(
|
||||
SrsRtcConnection* session, SrsRequest* req, const SrsSdp& remote_sdp, SrsSdp& local_sdp,
|
||||
const std::string& mock_eip, bool publish, bool dtls, bool srtp, SrsRtcStream* source
|
||||
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.
|
||||
|
|
Loading…
Reference in a new issue