Skip to content

Commit

Permalink
For #1638, #307, fix build warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Mar 17, 2020
1 parent e8b2bb5 commit b5dd502
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 37 deletions.
5 changes: 3 additions & 2 deletions trunk/src/app/srs_app_dtls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ void SrsDtls::init()
char *p = fp;
unsigned char md[EVP_MAX_MD_SIZE];
unsigned int n = 0;

int r = X509_digest(dtls_cert, EVP_sha256(), md, &n);

// TODO: FIXME: Unused variable.
/*int r = */X509_digest(dtls_cert, EVP_sha256(), md, &n);

for (unsigned int i = 0; i < n; i++, ++p) {
sprintf(p, "%02X", md[i]);
Expand Down
3 changes: 2 additions & 1 deletion trunk/src/app/srs_app_http_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,8 @@ srs_error_t SrsGoApiSdp::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage*
request.app = app;
request.stream = stream_name;
SrsSdp local_sdp;
SrsRtcSession* rtc_session = rtc_server->create_rtc_session(request, remote_sdp, local_sdp);
// TODO: FIXME: Maybe need a better name?
/*SrsRtcSession* rtc_session = */rtc_server->create_rtc_session(request, remote_sdp, local_sdp);

string local_sdp_str = "";
if ((err = local_sdp.encode(local_sdp_str)) != srs_success) {
Expand Down
55 changes: 28 additions & 27 deletions trunk/src/app/srs_app_rtc_conn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ std::vector<std::string> SrsCandidate::get_candidate_ips()
string candidate = _srs_config->get_rtc_candidates();
if (candidate == "*" || candidate == "0.0.0.0") {
std::vector<std::string> tmp = srs_get_local_ips();
for (int i = 0; i < tmp.size(); ++i) {
for (int i = 0; i < (int)tmp.size(); ++i) {
if (tmp[i] != "127.0.0.1") {
candidate_ips.push_back(tmp[i]);
}
Expand Down Expand Up @@ -185,7 +185,7 @@ srs_error_t SrsSdp::encode(string& sdp_str)
string candidate_lines = "";

std::vector<string> candidate_ips = SrsCandidate::get_candidate_ips();
for (int i = 0; i < candidate_ips.size(); ++i) {
for (int i = 0; i < (int)candidate_ips.size(); ++i) {
ostringstream os;
os << "a=candidate:10 1 udp 2115783679 " << candidate_ips[i] << " " << _srs_config->get_rtc_listen() <<" typ host generation 0\\r\\n";
candidate_lines += os.str();
Expand Down Expand Up @@ -257,7 +257,7 @@ srs_error_t SrsSdp::parse_attr(const string& line)
string key = "";
string val = "";
string* p = &key;
for (int i = 2; i < line.size(); ++i) {
for (int i = 2; i < (int)line.size(); ++i) {
if (line[i] == ':' && p == &key) {
p = &val;
} else {
Expand Down Expand Up @@ -701,7 +701,7 @@ void SrsRtcSenderThread::send_and_free_messages(SrsSharedPtrMessage** msgs, int
for (int i = 0; i < nb_msgs; i++) {
SrsSharedPtrMessage* msg = msgs[i];

for (int i = 0; i < msg->rtp_packets.size(); ++i) {
for (int i = 0; i < (int)msg->rtp_packets.size(); ++i) {
if (rtc_session->dtls_session) {
char protected_buf[kRtpPacketSize];
int nb_protected_buf = msg->rtp_packets[i]->size;
Expand Down Expand Up @@ -828,15 +828,15 @@ srs_error_t SrsRtcSession::on_rtcp_feedback(char* buf, int nb_buf, SrsUdpMuxSock
: Feedback Control Information (FCI) :
: :
*/
uint8_t first = stream->read_1bytes();
uint8_t version = first & 0xC0;
uint8_t padding = first & 0x20;
uint8_t fmt = first & 0x1F;
/*uint8_t first = */stream->read_1bytes();
//uint8_t version = first & 0xC0;
//uint8_t padding = first & 0x20;
//uint8_t fmt = first & 0x1F;

uint8_t payload_type = stream->read_1bytes();
uint16_t length = stream->read_2bytes();
uint32_t ssrc_of_sender = stream->read_4bytes();
uint32_t ssrc_of_media_source = stream->read_4bytes();
/*uint8_t payload_type = */stream->read_1bytes();
/*uint16_t length = */stream->read_2bytes();
/*uint32_t ssrc_of_sender = */stream->read_4bytes();
/*uint32_t ssrc_of_media_source = */stream->read_4bytes();

/*
0 1 2 3
Expand Down Expand Up @@ -878,7 +878,7 @@ srs_error_t SrsRtcSession::on_rtcp_feedback(char* buf, int nb_buf, SrsUdpMuxSock
resend_pkts.push_back(pkt);
}

for (int i = 0; i < resend_pkts.size(); ++i) {
for (int i = 0; i < (int)resend_pkts.size(); ++i) {
if (dtls_session) {
char protected_buf[kRtpPacketSize];
int nb_protected_buf = resend_pkts[i]->size;
Expand All @@ -905,14 +905,15 @@ srs_error_t SrsRtcSession::on_rtcp_ps_feedback(char* buf, int nb_buf, SrsUdpMuxS
SrsAutoFree(SrsBuffer, stream);

uint8_t first = stream->read_1bytes();
uint8_t version = first & 0xC0;
uint8_t padding = first & 0x20;
//uint8_t version = first & 0xC0;
//uint8_t padding = first & 0x20;
uint8_t fmt = first & 0x1F;

uint8_t payload_type = stream->read_1bytes();
uint16_t length = stream->read_2bytes();
uint32_t ssrc_of_sender = stream->read_4bytes();
uint32_t ssrc_of_media_source = stream->read_4bytes();
// TODO: FIXME: Dead code?
/*uint8_t payload_type = */stream->read_1bytes();
/*uint16_t length = */stream->read_2bytes();
/*uint32_t ssrc_of_sender = */stream->read_4bytes();
/*uint32_t ssrc_of_media_source = */stream->read_4bytes();

switch (fmt) {
case kPLI: {
Expand Down Expand Up @@ -979,13 +980,13 @@ block +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
uint8_t first = stream->read_1bytes();
uint8_t version = first & 0xC0;
uint8_t padding = first & 0x20;
//uint8_t version = first & 0xC0;
//uint8_t padding = first & 0x20;
uint8_t rc = first & 0x1F;

uint8_t payload_type = stream->read_1bytes();
/*uint8_t payload_type = */stream->read_1bytes();
uint16_t length = stream->read_2bytes();
uint32_t ssrc_of_sender = stream->read_4bytes();
/*uint32_t ssrc_of_sender = */stream->read_4bytes();

if (((length + 1) * 4) != (rc * 24 + 8)) {
return srs_error_wrap(err, "invalid rtcp receiver packet, length=%u, rc=%u", length, rc);
Expand All @@ -1000,6 +1001,7 @@ block +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
uint32_t lst = stream->read_4bytes();
uint32_t dlsr = stream->read_4bytes();

(void)ssrc; (void)fraction_lost; (void)cumulative_number_of_packets_lost; (void)highest_seq; (void)jitter; (void)lst; (void)dlsr;
srs_verbose("ssrc=%u, fraction_lost=%u, cumulative_number_of_packets_lost=%u, highest_seq=%u, jitter=%u, lst=%u, dlst=%u",
ssrc, fraction_lost, cumulative_number_of_packets_lost, highest_seq, jitter, lst, dlsr);
}
Expand Down Expand Up @@ -1073,18 +1075,19 @@ srs_error_t SrsRtcSession::on_rtp(SrsUdpMuxSocket* udp_mux_skt)
uint32_t timestamp = stream->read_4bytes();
uint32_t ssrc = stream->read_4bytes();

(void)padding; (void)marker; (void)sequence; (void)timestamp; (void)ssrc;
srs_verbose("sequence=%u, timestamp=%u, ssrc=%u, padding=%d, ext=%d, cc=%u, marker=%d, payload_type=%u",
sequence, timestamp, ssrc, padding, ext, cc, marker, payload_type);

for (uint8_t i = 0; i < cc; ++i) {
uint32_t csrc = 0;
csrc = stream->read_4bytes();
/*uint32_t csrc = */stream->read_4bytes();
}

if (ext) {
uint16_t extern_profile = stream->read_2bytes();
uint16_t extern_length = stream->read_2bytes();

(void)extern_profile; (void)extern_length;
srs_verbose("extern_profile=%u, extern_length=%u", extern_profile, extern_length);

stream->read_string(extern_length * 4);
Expand Down Expand Up @@ -1258,8 +1261,6 @@ srs_error_t SrsRtcServer::on_stun(SrsUdpMuxSocket* udp_mux_skt)

srs_error_t SrsRtcServer::on_dtls(SrsUdpMuxSocket* udp_mux_skt)
{
srs_error_t err = srs_success;

SrsRtcSession* rtc_session = find_rtc_session_by_peer_id(udp_mux_skt->get_peer_id());

if (rtc_session == NULL) {
Expand Down
3 changes: 0 additions & 3 deletions trunk/src/app/srs_app_rtp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ srs_error_t SrsRtpMuxer::packet_fu_a(SrsSharedPtrMessage* shared_frame, SrsForma
}

int num_of_packet = (sample->size - 1 + max_payload_size) / max_payload_size;
int avg_packet_size = sample->size / num_of_packet;
for (int i = 0; i < num_of_packet; ++i) {
char* buf = new char[kRtpPacketSize];
SrsBuffer* stream = new SrsBuffer(buf, kRtpPacketSize);
Expand Down Expand Up @@ -312,8 +311,6 @@ srs_error_t SrsRtp::on_publish()

void SrsRtp::on_unpublish()
{
srs_error_t err = srs_success;

// support multiple unpublish.
if (!enabled) {
return;
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/app/srs_app_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ void SrsRtpPacketQueue::clear()

void SrsRtpPacketQueue::push(std::vector<SrsRtpSharedPacket*>& pkts)
{
for (int i = 0; i < pkts.size(); ++i) {
for (int i = 0; i < (int)pkts.size(); ++i) {
insert(pkts[i]->sequence, pkts[i]);
}
}
Expand Down
4 changes: 2 additions & 2 deletions trunk/src/kernel/srs_kernel_flv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ SrsSharedPtrMessage::~SrsSharedPtrMessage()
}
}

for (int i = 0; i < rtp_packets.size(); ++i) {
for (int i = 0; i < (int)rtp_packets.size(); ++i) {
srs_freep(rtp_packets[i]);
}
}
Expand Down Expand Up @@ -351,7 +351,7 @@ SrsSharedPtrMessage* SrsSharedPtrMessage::copy()
copy->payload = ptr->payload;
copy->size = ptr->size;

for (int i = 0; i < rtp_packets.size(); ++i) {
for (int i = 0; i < (int)rtp_packets.size(); ++i) {
copy->rtp_packets.push_back(rtp_packets[i]->copy());
}

Expand Down
1 change: 0 additions & 1 deletion trunk/src/protocol/srs_stun_stack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ srs_error_t SrsStunPacket::decode(const char* buf, const int nb_buf)

srs_error_t SrsStunPacket::encode(const string& pwd, SrsBuffer* stream)
{
srs_error_t err = srs_success;
if (is_binding_response()) {
return encode_binding_response(pwd, stream);
}
Expand Down

0 comments on commit b5dd502

Please sign in to comment.