1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

remove debug code, fix rtc.html

This commit is contained in:
xiaozhihong 2020-03-13 22:50:34 +08:00
parent 768598a3bb
commit 6c88f58079
11 changed files with 19 additions and 261 deletions

View file

@ -794,18 +794,11 @@ SrsGoApiSdp::~SrsGoApiSdp()
srs_error_t SrsGoApiSdp::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
{
srs_error_t err = srs_success;
SrsStatistic* stat = SrsStatistic::instance();
// path: {pattern}{stream_id}
// e.g. /api/v1/streams/100 pattern= /api/v1/streams/, stream_id=100
int sid = r->parse_rest_id(entry->pattern);
SrsStatisticStream* stream = NULL;
if (sid >= 0 && (stream = stat->find_stream(sid)) == NULL) {
return srs_api_response_code(w, r, ERROR_RTMP_STREAM_NOT_FOUND);
}
// path: {pattern}
// method: POST
// e.g. /api/v1/sdp/ args = json:{"sdp":"sdp...", "app":"webrtc", "stream":"test"}
string req_json;
r->body_read_all(req_json);
srs_trace("req_json=%s", req_json.c_str());
@ -850,20 +843,10 @@ srs_error_t SrsGoApiSdp::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage*
obj->set("code", SrsJsonAny::integer(ERROR_SUCCESS));
obj->set("server", SrsJsonAny::integer(stat->server_id()));
// XXX: ice candidate
//string candidate_str = "candidate:1 1 udp 2115783679 192.168.170.129:9527 typ host generation 0 ufrag "
// + local_sdp.get_ice_ufrag() + "netwrok-cost 50";
//SrsJsonObject* candidate_obj = SrsJsonAny::object();
//SrsAutoFree(SrsJsonObject, candidate_obj);
//candidate_obj->set("candidate", SrsJsonAny::str(candidate_str.c_str()));
//candidate_obj->set("sdpMid", SrsJsonAny::str("0"));
//candidate_obj->set("sdpMLineIndex", SrsJsonAny::str("0"));
// TODO: add candidates in response json?
if (r->is_http_post()) {
obj->set("sdp", SrsJsonAny::str(local_sdp_str.c_str()));
// obj->set("candidate", candidate_obj);
} else {
return srs_go_http_error(w, SRS_CONSTS_HTTP_MethodNotAllowed);
}