提交 b9847aea authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Code cleanup.

上级 82752177
......@@ -42,7 +42,7 @@ namespace Channel
// Others.
Json::CharReader* jsonReader = nullptr;
Json::StreamWriter* jsonWriter = nullptr;
size_t msgStart = 0; // Where the latest message starts.
size_t msgStart = 0; // Where the latest message starts.
bool closed = false;
};
}
......
......@@ -4,7 +4,7 @@
#include "Logger.h"
#include <stdexcept>
#include <string>
#include <cstdio> // std::snprintf
#include <cstdio> // std::snprintf
class MediaSoupError :
public std::runtime_error
......
......@@ -150,8 +150,8 @@ namespace RTC
Listener* listener = nullptr;
// Allocated by this.
SSL* ssl = nullptr;
BIO* sslBioFromNetwork = nullptr; // The BIO from which ssl reads.
BIO* sslBioToNetwork = nullptr; // The BIO in which ssl writes.
BIO* sslBioFromNetwork = nullptr; // The BIO from which ssl reads.
BIO* sslBioToNetwork = nullptr; // The BIO in which ssl writes.
Timer* timer = nullptr;
// Others.
DtlsState state = DtlsState::NEW;
......
......@@ -137,7 +137,7 @@ namespace RTC
class RtpCodecParameters
{
public:
RtpCodecParameters() {}; // TODO: yes?
RtpCodecParameters() {}; // TODO: yes?
RtpCodecParameters(Json::Value& data, RTC::Scope scope);
Json::Value toJson();
......
......@@ -38,18 +38,18 @@ namespace RTC
void Dump();
private:
bool started = false; // Whether at least a RTP packet has been received.
bool started = false; // Whether at least a RTP packet has been received.
// https://tools.ietf.org/html/rfc3550#appendix-A.1 stuff.
uint16_t max_seq = 0; // Highest seq. number seen.
uint32_t cycles = 0; // Shifted count of seq. number cycles.
uint32_t base_seq = 0; // Base seq number.
uint32_t bad_seq = 0; // Last 'bad' seq number + 1.
uint32_t probation = 0; // Seq. packets till source is valid.
uint32_t received = 0; // Packets received.
uint16_t max_seq = 0; // Highest seq. number seen.
uint32_t cycles = 0; // Shifted count of seq. number cycles.
uint32_t base_seq = 0; // Base seq number.
uint32_t bad_seq = 0; // Last 'bad' seq number + 1.
uint32_t probation = 0; // Seq. packets till source is valid.
uint32_t received = 0; // Packets received.
uint32_t expected_prior = 0; // Packet expected at last interval.
uint32_t received_prior = 0; // Packet received at last interval.
uint32_t transit = 0; // Relative trans time for prev pkt.
uint32_t jitter = 0; // Estimated jitter.
uint32_t transit = 0; // Relative trans time for prev pkt.
uint32_t jitter = 0; // Estimated jitter.
// Others.
std::vector<StorageItem> storage;
typedef std::list<BufferItem> Buffer;
......
......@@ -30,7 +30,7 @@ namespace RTC
// Passed by argument.
Listener* listener = nullptr;
// Others.
size_t frameStart = 0; // Where the latest frame starts.
size_t frameStart = 0; // Where the latest frame starts.
};
}
......
......@@ -3,7 +3,7 @@
#include "common.h"
#include <string>
#include <cstring> // std::memcmp(), std::memcpy()
#include <cstring> // std::memcmp(), std::memcpy()
#include <openssl/hmac.h>
namespace Utils
......
#ifndef MS_COMMON_H
#define MS_COMMON_H
#include <memory> // std::addressof()
#include <algorithm> // std::transform(), std::find()
#include <cstddef> // size_t
#include <cstdint> // uint8_t, etc
#include <cinttypes> // PRIu64, etc
#include <sys/socket.h> // struct sockaddr, struct sockaddr_storage, AF_INET, AF_INET6
#include <netinet/in.h> // sockaddr_in, sockaddr_in6
#include <arpa/inet.h> // htonl(), htons(), ntohl(), ntohs()
#include <memory> // std::addressof()
#include <algorithm> // std::transform(), std::find()
#include <cstddef> // size_t
#include <cstdint> // uint8_t, etc
#include <cinttypes> // PRIu64, etc
#include <sys/socket.h> // struct sockaddr, struct sockaddr_storage, AF_INET, AF_INET6
#include <netinet/in.h> // sockaddr_in, sockaddr_in6
#include <arpa/inet.h> // htonl(), htons(), ntohl(), ntohs()
#define MS_APP_NAME "mediasoup"
#define MS_PROCESS_NAME "mediasoup-worker"
#endif
......@@ -62,7 +62,7 @@ void DepOpenSSL::ClassDestroy()
// "Brutal" (thread-unsafe) Application-global cleanup functions.
ERR_free_strings();
EVP_cleanup(); // Removes all ciphers and digests.
EVP_cleanup(); // Removes all ciphers and digests.
CRYPTO_cleanup_all_ex_data();
// https://bugs.launchpad.net/percona-server/+bug/1341067.
......
......@@ -134,7 +134,7 @@ namespace RTC
goto error;
}
ret = BN_set_word(bne, RSA_F4); // RSA_F4 == 65537.
ret = BN_set_word(bne, RSA_F4); // RSA_F4 == 65537.
if (ret == 0)
{
LOG_OPENSSL_ERROR("BN_set_word() failed");
......@@ -189,8 +189,8 @@ namespace RTC
ASN1_INTEGER_set(X509_get_serialNumber(DtlsTransport::certificate), (long)Utils::Crypto::GetRandomUInt(1000000, 9999999));
// Set valid period.
X509_gmtime_adj(X509_get_notBefore(DtlsTransport::certificate), -1*60*60*24*365*10); // - 10 years.
X509_gmtime_adj(X509_get_notAfter(DtlsTransport::certificate), 60*60*24*365*10); // 10 years.
X509_gmtime_adj(X509_get_notBefore(DtlsTransport::certificate), -1*60*60*24*365*10); // - 10 years.
X509_gmtime_adj(X509_get_notAfter(DtlsTransport::certificate), 60*60*24*365*10); // 10 years.
// Set the public key for the certificate using the key.
ret = X509_set_pubkey(DtlsTransport::certificate, DtlsTransport::privateKey);
......@@ -236,7 +236,7 @@ namespace RTC
if (rsa_key && !DtlsTransport::privateKey)
RSA_free(rsa_key);
if (DtlsTransport::privateKey)
EVP_PKEY_free(DtlsTransport::privateKey); // NOTE: This also frees the RSA key.
EVP_PKEY_free(DtlsTransport::privateKey); // NOTE: This also frees the RSA key.
if (DtlsTransport::certificate)
X509_free(DtlsTransport::certificate);
......
......@@ -4,7 +4,7 @@
#include "RTC/RtpPacket.h"
#include "Utils.h"
#include "Logger.h"
#include <cstring> // std::memcmp(), std::memcpy()
#include <cstring> // std::memcpy()
namespace RTC
{
......
......@@ -11,7 +11,7 @@ namespace RTC
{
/* Class variables. */
const uint8_t StunMessage::magicCookie[] = {0x21, 0x12, 0xA4, 0x42};
const uint8_t StunMessage::magicCookie[] = { 0x21, 0x12, 0xA4, 0x42 };
/* Class methods. */
......
......@@ -399,7 +399,7 @@ namespace RTC
static const Json::StaticString k_value("value");
RTC::DtlsTransport::Fingerprint remoteFingerprint;
RTC::DtlsTransport::Role remoteRole = RTC::DtlsTransport::Role::AUTO; // Default value if missing.
RTC::DtlsTransport::Role remoteRole = RTC::DtlsTransport::Role::AUTO; // Default value if missing.
// Ensure this method is not called twice.
if (this->remoteDtlsParametersGiven)
......
......@@ -71,7 +71,7 @@ void Settings::SetConfiguration(int argc, char* argv[])
/* Parse command line options. */
opterr = 0; // Don't allow getopt to print error messages.
opterr = 0; // Don't allow getopt to print error messages.
while ((c = getopt_long_only(argc, argv, "", options, &option_index)) != -1)
{
if (!optarg)
......
......@@ -11,7 +11,7 @@ namespace Utils
uint32_t Crypto::seed;
HMAC_CTX Crypto::hmacSha1Ctx;
uint8_t Crypto::hmacSha1Buffer[20]; // SHA-1 result is 20 bytes long.
uint8_t Crypto::hmacSha1Buffer[20]; // SHA-1 result is 20 bytes long.
const uint32_t Crypto::crc32Table[] =
{
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论