Skip to content

Commit

Permalink
add NACK suport, remove debug code, verbose log
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaozhihong committed Mar 14, 2020
1 parent 6c88f58 commit 2b56f9e
Show file tree
Hide file tree
Showing 7 changed files with 404 additions and 62 deletions.
12 changes: 5 additions & 7 deletions trunk/src/app/srs_app_http_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,6 @@ srs_error_t SrsGoApiSdp::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage*

string req_json;
r->body_read_all(req_json);
srs_trace("req_json=%s", req_json.c_str());

SrsJsonAny* json = SrsJsonAny::loads(req_json);
SrsJsonObject* req_obj = json->to_object();
Expand All @@ -818,18 +817,17 @@ srs_error_t SrsGoApiSdp::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage*
string app = app_obj->to_str();
string stream_name = stream_name_obj->to_str();

srs_trace("remote_sdp_str=%s", remote_sdp_str.c_str());
srs_trace("app=%s, stream=%s", app.c_str(), stream_name.c_str());

SrsSdp remote_sdp;
err = remote_sdp.decode(remote_sdp_str);
if (err != srs_success) {
return srs_api_response_code(w, r, SRS_CONSTS_HTTP_BadRequest);
}

SrsRequest request;
request.app = app;
request.stream = stream_name;
SrsSdp local_sdp;
SrsRtcSession* rtc_session = rtc_server->create_rtc_session(remote_sdp, local_sdp);
rtc_session->set_app_stream(app, stream_name);
SrsRtcSession* rtc_session = rtc_server->create_rtc_session(request, remote_sdp, local_sdp);

string local_sdp_str = "";
err = local_sdp.encode(local_sdp_str);
Expand All @@ -841,7 +839,7 @@ srs_error_t SrsGoApiSdp::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage*
SrsAutoFree(SrsJsonObject, obj);

obj->set("code", SrsJsonAny::integer(ERROR_SUCCESS));
obj->set("server", SrsJsonAny::integer(stat->server_id()));
obj->set("server", SrsJsonAny::integer(SrsStatistic::instance()->server_id()));

// TODO: add candidates in response json?

Expand Down
Loading

0 comments on commit 2b56f9e

Please sign in to comment.