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);
}

View file

@ -37,7 +37,7 @@
#include <srs_kernel_utility.hpp>
// the max size of a line of log.
#define LOG_MAX_SIZE 4096000
#define LOG_MAX_SIZE 4096
// the tail append to each log.
#define LOG_TAIL '\n'

View file

@ -689,6 +689,7 @@ void SrsRtcSenderThread::send_and_free_messages(SrsSharedPtrMessage** msgs, int
int nb_protected_buf = msg->rtp_packets[i]->size;
rtc_session->dtls_session->protect_rtp(protected_buf, msg->rtp_packets[i]->payload, nb_protected_buf);
// TODO: use sendmmsg to send multi packet one system call
udp_mux_skt->sendto(protected_buf, nb_protected_buf, 0);
}
}

View file

@ -153,8 +153,6 @@ private:
SrsRtcSession* rtc_session;
SrsUdpMuxSocket ukt;
public:
// Constructor.
// @param tm The receive timeout in srs_utime_t.
SrsRtcSenderThread(SrsRtcSession* s, SrsUdpMuxSocket* u, int parent_cid);
virtual ~SrsRtcSenderThread();
public:
@ -231,8 +229,6 @@ protected:
private:
SrsRtcServer* rtc_server;
public:
// Constructor.
// @param tm The receive timeout in srs_utime_t.
SrsRtcTimerThread(SrsRtcServer* rtc_svr, int parent_cid);
virtual ~SrsRtcTimerThread();
public:

View file

@ -77,8 +77,8 @@ srs_error_t SrsRtpMuxer::frame_to_packet(SrsSharedPtrMessage* shared_frame, SrsF
uint8_t header = sample.bytes[0];
uint8_t nal_type = header & kNalTypeMask;
// ignore SEI nal
if (nal_type == 0x06) {
srs_trace("ignore SEI");
continue;
}
@ -87,13 +87,6 @@ srs_error_t SrsRtpMuxer::frame_to_packet(SrsSharedPtrMessage* shared_frame, SrsF
} else {
packet_fu_a(shared_frame, format, &sample, rtp_packet_vec);
}
#if 0
srs_trace("nal size=%d, nal=%s", sample.size, dump_string_hex(sample.bytes, sample.size, sample.size).c_str());
for (int i = 0; i < shared_frame->nb_rtp_fragments; ++i) {
srs_trace("rtp=%s", dump_string_hex(shared_frame->rtp_fragments[i].bytes, shared_frame->rtp_fragments[i].size, kRtpPacketSize).c_str());
}
#endif
}
shared_frame->set_rtp_packets(rtp_packet_vec);

View file

@ -52,6 +52,7 @@ const uint8_t kFuA = 28;
const uint8_t kStart = 0x80;
const uint8_t kEnd = 0x40;
// FIXME: ssrc can relate to source
const uint32_t kVideoSSRC = 3233846889;
class SrsRtpMuxer