mirror of
https://github.com/ossrs/srs.git
synced 2025-02-15 04:42:04 +00:00
Refine code to allow search for conflicts.
This commit is contained in:
parent
ead49e747b
commit
5d48c9ce1b
6 changed files with 27 additions and 27 deletions
|
@ -32,11 +32,11 @@ class SrsConfDirective;
|
|||
|
||||
/**
|
||||
* whether the two vector actual equals, for instance,
|
||||
* srs_vector_actual_equals([0, 1, 2], [0, 1, 2]) ==== true
|
||||
* srs_vector_actual_equals([0, 1, 2], [2, 1, 0]) ==== true
|
||||
* srs_vector_actual_equals([0, 1, 2], [0, 2, 1]) ==== true
|
||||
* srs_vector_actual_equals([0, 1, 2], [0, 1, 2, 3]) ==== false
|
||||
* srs_vector_actual_equals([1, 2, 3], [0, 1, 2]) ==== false
|
||||
* srs_vector_actual_equals([0, 1, 2], [0, 1, 2]) is true
|
||||
* srs_vector_actual_equals([0, 1, 2], [2, 1, 0]) is true
|
||||
* srs_vector_actual_equals([0, 1, 2], [0, 2, 1]) is true
|
||||
* srs_vector_actual_equals([0, 1, 2], [0, 1, 2, 3]) is false
|
||||
* srs_vector_actual_equals([1, 2, 3], [0, 1, 2]) is false
|
||||
*/
|
||||
template<typename T>
|
||||
bool srs_vector_actual_equals(const std::vector<T>& a, const std::vector<T>& b)
|
||||
|
|
|
@ -685,7 +685,7 @@ extern std::string srs_string_dumps_hex(const char* str, int length, int limit);
|
|||
extern std::string srs_string_dumps_hex(const char* str, int length, int limit, char seperator, int line_limit, char newline);
|
||||
|
||||
// Get ENV variable, which may starts with $.
|
||||
// srs_getenv("EIP") === srs_getenv("$EIP")
|
||||
// srs_getenv("EIP") is srs_getenv("$EIP")
|
||||
extern std::string srs_getenv(const std::string& key);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -50,9 +50,9 @@ uint8_t srs_rtp_fast_parse_pt(char* buf, int size);
|
|||
srs_error_t srs_rtp_fast_parse_twcc(char* buf, int size, uint8_t twcc_id, uint16_t& twcc_sn);
|
||||
|
||||
// The "distance" between two uint16 number, for example:
|
||||
// distance(prev_value=3, value=5) === (int16_t)(uint16_t)((uint16_t)3-(uint16_t)5) === -2
|
||||
// distance(prev_value=3, value=65534) === (int16_t)(uint16_t)((uint16_t)3-(uint16_t)65534) === 5
|
||||
// distance(prev_value=65532, value=65534) === (int16_t)(uint16_t)((uint16_t)65532-(uint16_t)65534) === -2
|
||||
// distance(prev_value=3, value=5) is (int16_t)(uint16_t)((uint16_t)3-(uint16_t)5) is -2
|
||||
// distance(prev_value=3, value=65534) is (int16_t)(uint16_t)((uint16_t)3-(uint16_t)65534) is 5
|
||||
// distance(prev_value=65532, value=65534) is (int16_t)(uint16_t)((uint16_t)65532-(uint16_t)65534) is -2
|
||||
// For RTP sequence, it's only uint16 and may flip back, so 3 maybe 3+0xffff.
|
||||
// @remark Note that srs_rtp_seq_distance(0, 32768)>0 is TRUE by https://mp.weixin.qq.com/s/JZTInmlB9FUWXBQw_7NYqg
|
||||
// but for WebRTC jitter buffer it's FALSE and we follow it.
|
||||
|
|
|
@ -1849,7 +1849,7 @@ srs_error_t SrsMpegPES::decode_33bits_dts_pts(SrsBuffer* stream, int64_t* pv)
|
|||
}
|
||||
|
||||
// decode the 33bits schema.
|
||||
// ===========1B
|
||||
// --------------1B
|
||||
// 4bits const maybe '0001', '0010' or '0011'.
|
||||
// 3bits DTS/PTS [32..30]
|
||||
// 1bit const '1'
|
||||
|
@ -1864,7 +1864,7 @@ srs_error_t SrsMpegPES::decode_33bits_dts_pts(SrsBuffer* stream, int64_t* pv)
|
|||
}
|
||||
dts_pts_30_32 = (dts_pts_30_32 >> 1) & 0x07;
|
||||
|
||||
// ===========2B
|
||||
// --------------2B
|
||||
// 15bits DTS/PTS [29..15]
|
||||
// 1bit const '1'
|
||||
int64_t dts_pts_15_29 = stream->read_2bytes();
|
||||
|
@ -1873,7 +1873,7 @@ srs_error_t SrsMpegPES::decode_33bits_dts_pts(SrsBuffer* stream, int64_t* pv)
|
|||
}
|
||||
dts_pts_15_29 = (dts_pts_15_29 >> 1) & 0x7fff;
|
||||
|
||||
// ===========2B
|
||||
// --------------2B
|
||||
// 15bits DTS/PTS [14..0]
|
||||
// 1bit const '1'
|
||||
int64_t dts_pts_0_14 = stream->read_2bytes();
|
||||
|
|
|
@ -825,14 +825,14 @@ public:
|
|||
// presentation unit k of elementary stream n. The value of PTS is specified in units of the period of the system clock
|
||||
// frequency divided by 300 (yielding 90 kHz). The presentation time is derived from the PTS according to equation 2-11
|
||||
// below. Refer to 2.7.4 for constraints on the frequency of coding presentation timestamps.
|
||||
// ===========1B
|
||||
// --------------1B
|
||||
// 4bits const
|
||||
// 3bits PTS [32..30]
|
||||
// 1bit const '1'
|
||||
// ===========2B
|
||||
// --------------2B
|
||||
// 15bits PTS [29..15]
|
||||
// 1bit const '1'
|
||||
// ===========2B
|
||||
// --------------2B
|
||||
// 15bits PTS [14..0]
|
||||
// 1bit const '1'
|
||||
int64_t pts; // 33bits
|
||||
|
@ -841,14 +841,14 @@ public:
|
|||
// The DTS is a 33-bit number coded in three separate fields. It indicates the decoding time,
|
||||
// td n (j), in the system target decoder of an access unit j of elementary stream n. The value of DTS is specified in units of
|
||||
// the period of the system clock frequency divided by 300 (yielding 90 kHz).
|
||||
// ===========1B
|
||||
// --------------1B
|
||||
// 4bits const
|
||||
// 3bits DTS [32..30]
|
||||
// 1bit const '1'
|
||||
// ===========2B
|
||||
// --------------2B
|
||||
// 15bits DTS [29..15]
|
||||
// 1bit const '1'
|
||||
// ===========2B
|
||||
// --------------2B
|
||||
// 15bits DTS [14..0]
|
||||
// 1bit const '1'
|
||||
int64_t dts; // 33bits
|
||||
|
|
|
@ -148,15 +148,15 @@ extern bool srs_string_is_http(std::string url);
|
|||
extern bool srs_string_is_rtmp(std::string url);
|
||||
|
||||
// Whether string is digit number
|
||||
// is_digit("0") === true
|
||||
// is_digit("0000000000") === true
|
||||
// is_digit("1234567890") === true
|
||||
// is_digit("0123456789") === true
|
||||
// is_digit("1234567890a") === false
|
||||
// is_digit("a1234567890") === false
|
||||
// is_digit("10e3") === false
|
||||
// is_digit("!1234567890") === false
|
||||
// is_digit("") === false
|
||||
// is_digit("0") is true
|
||||
// is_digit("0000000000") is true
|
||||
// is_digit("1234567890") is true
|
||||
// is_digit("0123456789") is true
|
||||
// is_digit("1234567890a") is false
|
||||
// is_digit("a1234567890") is false
|
||||
// is_digit("10e3") is false
|
||||
// is_digit("!1234567890") is false
|
||||
// is_digit("") is false
|
||||
extern bool srs_is_digit_number(std::string str);
|
||||
|
||||
// Get local ip, fill to @param ips
|
||||
|
|
Loading…
Reference in a new issue