mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +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
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue