正在显示
4 个修改的文件
包含
28 行增加
和
28 行删除
@@ -35,7 +35,7 @@ int main(int argc, char** argv) | @@ -35,7 +35,7 @@ int main(int argc, char** argv) | ||
35 | srs_rtmp_t rtmp; | 35 | srs_rtmp_t rtmp; |
36 | 36 | ||
37 | // time | 37 | // time |
38 | - int64_t time_startup = srs_utils_get_time_ms(); | 38 | + int64_t time_startup = srs_utils_time_ms(); |
39 | int64_t time_dns_resolve = 0; | 39 | int64_t time_dns_resolve = 0; |
40 | int64_t time_socket_connect = 0; | 40 | int64_t time_socket_connect = 0; |
41 | int64_t time_play_stream = 0; | 41 | int64_t time_play_stream = 0; |
@@ -95,14 +95,14 @@ int main(int argc, char** argv) | @@ -95,14 +95,14 @@ int main(int argc, char** argv) | ||
95 | goto rtmp_destroy; | 95 | goto rtmp_destroy; |
96 | } | 96 | } |
97 | srs_human_trace("dns resolve success"); | 97 | srs_human_trace("dns resolve success"); |
98 | - time_dns_resolve = srs_utils_get_time_ms(); | 98 | + time_dns_resolve = srs_utils_time_ms(); |
99 | 99 | ||
100 | if ((ret = __srs_rtmp_connect_server(rtmp)) != 0) { | 100 | if ((ret = __srs_rtmp_connect_server(rtmp)) != 0) { |
101 | srs_human_trace("socket connect failed. ret=%d", ret); | 101 | srs_human_trace("socket connect failed. ret=%d", ret); |
102 | goto rtmp_destroy; | 102 | goto rtmp_destroy; |
103 | } | 103 | } |
104 | srs_human_trace("socket connect success"); | 104 | srs_human_trace("socket connect success"); |
105 | - time_socket_connect = srs_utils_get_time_ms(); | 105 | + time_socket_connect = srs_utils_time_ms(); |
106 | 106 | ||
107 | if ((ret = __srs_rtmp_do_simple_handshake(rtmp)) != 0) { | 107 | if ((ret = __srs_rtmp_do_simple_handshake(rtmp)) != 0) { |
108 | srs_human_trace("do simple handshake failed. ret=%d", ret); | 108 | srs_human_trace("do simple handshake failed. ret=%d", ret); |
@@ -121,7 +121,7 @@ int main(int argc, char** argv) | @@ -121,7 +121,7 @@ int main(int argc, char** argv) | ||
121 | goto rtmp_destroy; | 121 | goto rtmp_destroy; |
122 | } | 122 | } |
123 | srs_human_trace("play stream success"); | 123 | srs_human_trace("play stream success"); |
124 | - time_play_stream = srs_utils_get_time_ms(); | 124 | + time_play_stream = srs_utils_time_ms(); |
125 | 125 | ||
126 | for (;;) { | 126 | for (;;) { |
127 | if ((ret = srs_rtmp_read_packet(rtmp, &type, ×tamp, &data, &size)) != 0) { | 127 | if ((ret = srs_rtmp_read_packet(rtmp, &type, ×tamp, &data, &size)) != 0) { |
@@ -133,7 +133,7 @@ int main(int argc, char** argv) | @@ -133,7 +133,7 @@ int main(int argc, char** argv) | ||
133 | 133 | ||
134 | if (SRS_RTMP_TYPE_VIDEO == type || SRS_RTMP_TYPE_AUDIO == type) { | 134 | if (SRS_RTMP_TYPE_VIDEO == type || SRS_RTMP_TYPE_AUDIO == type) { |
135 | if (time_first_packet <= 0) { | 135 | if (time_first_packet <= 0) { |
136 | - time_first_packet = srs_utils_get_time_ms(); | 136 | + time_first_packet = srs_utils_time_ms(); |
137 | } | 137 | } |
138 | if (basetime <= 0) { | 138 | if (basetime <= 0) { |
139 | basetime = timestamp; | 139 | basetime = timestamp; |
@@ -142,7 +142,7 @@ int main(int argc, char** argv) | @@ -142,7 +142,7 @@ int main(int argc, char** argv) | ||
142 | 142 | ||
143 | free(data); | 143 | free(data); |
144 | 144 | ||
145 | - if (srs_utils_get_time_ms() - time_startup > timeout * 1000) { | 145 | + if (srs_utils_time_ms() - time_startup > timeout * 1000) { |
146 | srs_human_trace("timeout, terminate."); | 146 | srs_human_trace("timeout, terminate."); |
147 | goto rtmp_destroy; | 147 | goto rtmp_destroy; |
148 | } | 148 | } |
@@ -154,11 +154,11 @@ int main(int argc, char** argv) | @@ -154,11 +154,11 @@ int main(int argc, char** argv) | ||
154 | } | 154 | } |
155 | 155 | ||
156 | rtmp_destroy: | 156 | rtmp_destroy: |
157 | - bytes_nsend = srs_utils_get_send_bytes(rtmp); | ||
158 | - bytes_nrecv = srs_utils_get_recv_bytes(rtmp); | 157 | + bytes_nsend = srs_utils_send_bytes(rtmp); |
158 | + bytes_nrecv = srs_utils_recv_bytes(rtmp); | ||
159 | 159 | ||
160 | srs_rtmp_destroy(rtmp); | 160 | srs_rtmp_destroy(rtmp); |
161 | - time_cleanup = srs_utils_get_time_ms(); | 161 | + time_cleanup = srs_utils_time_ms(); |
162 | time_duration = (int)(time_cleanup - time_startup); | 162 | time_duration = (int)(time_cleanup - time_startup); |
163 | 163 | ||
164 | // print result to stderr. | 164 | // print result to stderr. |
@@ -48,7 +48,7 @@ int main(int argc, char** argv) | @@ -48,7 +48,7 @@ int main(int argc, char** argv) | ||
48 | int ret = 0; | 48 | int ret = 0; |
49 | 49 | ||
50 | // main function | 50 | // main function |
51 | - tools_main_entrance_startup_time = srs_utils_get_time_ms(); | 51 | + tools_main_entrance_startup_time = srs_utils_time_ms(); |
52 | 52 | ||
53 | // user option parse index. | 53 | // user option parse index. |
54 | int opt = 0; | 54 | int opt = 0; |
@@ -215,7 +215,7 @@ int connect_oc(srs_rtmp_t ortmp) | @@ -215,7 +215,7 @@ int connect_oc(srs_rtmp_t ortmp) | ||
215 | int64_t re_create() | 215 | int64_t re_create() |
216 | { | 216 | { |
217 | // if not very precise, we can directly use this as re. | 217 | // if not very precise, we can directly use this as re. |
218 | - int64_t re = srs_utils_get_time_ms(); | 218 | + int64_t re = srs_utils_time_ms(); |
219 | 219 | ||
220 | // use the starttime to get the deviation | 220 | // use the starttime to get the deviation |
221 | int64_t deviation = re - tools_main_entrance_startup_time; | 221 | int64_t deviation = re - tools_main_entrance_startup_time; |
@@ -236,7 +236,7 @@ int64_t re_create() | @@ -236,7 +236,7 @@ int64_t re_create() | ||
236 | void re_update(int64_t re, int32_t starttime, u_int32_t time) | 236 | void re_update(int64_t re, int32_t starttime, u_int32_t time) |
237 | { | 237 | { |
238 | // send by pulse algorithm. | 238 | // send by pulse algorithm. |
239 | - int64_t now = srs_utils_get_time_ms(); | 239 | + int64_t now = srs_utils_time_ms(); |
240 | int64_t diff = time - starttime - (now -re); | 240 | int64_t diff = time - starttime - (now -re); |
241 | if (diff > RE_PULSE_MS) { | 241 | if (diff > RE_PULSE_MS) { |
242 | usleep(diff * 1000); | 242 | usleep(diff * 1000); |
@@ -246,7 +246,7 @@ void re_cleanup(int64_t re, int32_t starttime, u_int32_t time) | @@ -246,7 +246,7 @@ void re_cleanup(int64_t re, int32_t starttime, u_int32_t time) | ||
246 | { | 246 | { |
247 | // for the last pulse, always sleep. | 247 | // for the last pulse, always sleep. |
248 | // for the virtual live encoder long time publishing. | 248 | // for the virtual live encoder long time publishing. |
249 | - int64_t now = srs_utils_get_time_ms(); | 249 | + int64_t now = srs_utils_time_ms(); |
250 | int64_t diff = time - starttime - (now -re); | 250 | int64_t diff = time - starttime - (now -re); |
251 | if (diff > 0) { | 251 | if (diff > 0) { |
252 | srs_human_trace("re_cleanup, diff=%d, start=%d, last=%d ms", | 252 | srs_human_trace("re_cleanup, diff=%d, start=%d, last=%d ms", |
@@ -1712,20 +1712,20 @@ void srs_amf0_strict_array_append(srs_amf0_t amf0, srs_amf0_t value) | @@ -1712,20 +1712,20 @@ void srs_amf0_strict_array_append(srs_amf0_t amf0, srs_amf0_t value) | ||
1712 | obj->append(any); | 1712 | obj->append(any); |
1713 | } | 1713 | } |
1714 | 1714 | ||
1715 | -int64_t srs_utils_get_time_ms() | 1715 | +int64_t srs_utils_time_ms() |
1716 | { | 1716 | { |
1717 | srs_update_system_time_ms(); | 1717 | srs_update_system_time_ms(); |
1718 | return srs_get_system_time_ms(); | 1718 | return srs_get_system_time_ms(); |
1719 | } | 1719 | } |
1720 | 1720 | ||
1721 | -int64_t srs_utils_get_send_bytes(srs_rtmp_t rtmp) | 1721 | +int64_t srs_utils_send_bytes(srs_rtmp_t rtmp) |
1722 | { | 1722 | { |
1723 | srs_assert(rtmp != NULL); | 1723 | srs_assert(rtmp != NULL); |
1724 | Context* context = (Context*)rtmp; | 1724 | Context* context = (Context*)rtmp; |
1725 | return context->rtmp->get_send_bytes(); | 1725 | return context->rtmp->get_send_bytes(); |
1726 | } | 1726 | } |
1727 | 1727 | ||
1728 | -int64_t srs_utils_get_recv_bytes(srs_rtmp_t rtmp) | 1728 | +int64_t srs_utils_recv_bytes(srs_rtmp_t rtmp) |
1729 | { | 1729 | { |
1730 | srs_assert(rtmp != NULL); | 1730 | srs_assert(rtmp != NULL); |
1731 | Context* context = (Context*)rtmp; | 1731 | Context* context = (Context*)rtmp; |
@@ -1773,7 +1773,7 @@ int srs_utils_parse_timestamp( | @@ -1773,7 +1773,7 @@ int srs_utils_parse_timestamp( | ||
1773 | return ret; | 1773 | return ret; |
1774 | } | 1774 | } |
1775 | 1775 | ||
1776 | -char srs_utils_get_flv_video_codec_id(char* data, int size) | 1776 | +char srs_utils_flv_video_codec_id(char* data, int size) |
1777 | { | 1777 | { |
1778 | if (size < 1) { | 1778 | if (size < 1) { |
1779 | return 0; | 1779 | return 0; |
@@ -1785,7 +1785,7 @@ char srs_utils_get_flv_video_codec_id(char* data, int size) | @@ -1785,7 +1785,7 @@ char srs_utils_get_flv_video_codec_id(char* data, int size) | ||
1785 | return codec_id; | 1785 | return codec_id; |
1786 | } | 1786 | } |
1787 | 1787 | ||
1788 | -char srs_utils_get_flv_video_avc_packet_type(char* data, int size) | 1788 | +char srs_utils_flv_video_avc_packet_type(char* data, int size) |
1789 | { | 1789 | { |
1790 | if (size < 2) { | 1790 | if (size < 2) { |
1791 | return -1; | 1791 | return -1; |
@@ -1804,7 +1804,7 @@ char srs_utils_get_flv_video_avc_packet_type(char* data, int size) | @@ -1804,7 +1804,7 @@ char srs_utils_get_flv_video_avc_packet_type(char* data, int size) | ||
1804 | return avc_packet_type; | 1804 | return avc_packet_type; |
1805 | } | 1805 | } |
1806 | 1806 | ||
1807 | -char srs_utils_get_flv_video_frame_type(char* data, int size) | 1807 | +char srs_utils_flv_video_frame_type(char* data, int size) |
1808 | { | 1808 | { |
1809 | if (size < 1) { | 1809 | if (size < 1) { |
1810 | return -1; | 1810 | return -1; |
@@ -1924,9 +1924,9 @@ int srs_human_print_rtmp_packet(char type, u_int32_t timestamp, char* data, int | @@ -1924,9 +1924,9 @@ int srs_human_print_rtmp_packet(char type, u_int32_t timestamp, char* data, int | ||
1924 | if (type == SRS_RTMP_TYPE_VIDEO) { | 1924 | if (type == SRS_RTMP_TYPE_VIDEO) { |
1925 | srs_human_trace("Video packet type=%s, dts=%d, pts=%d, size=%d, %s(%s,%s)", | 1925 | srs_human_trace("Video packet type=%s, dts=%d, pts=%d, size=%d, %s(%s,%s)", |
1926 | srs_human_flv_tag_type2string(type), timestamp, pts, size, | 1926 | srs_human_flv_tag_type2string(type), timestamp, pts, size, |
1927 | - srs_human_flv_video_codec_id2string(srs_utils_get_flv_video_codec_id(data, size)), | ||
1928 | - srs_human_flv_video_avc_packet_type2string(srs_utils_get_flv_video_avc_packet_type(data, size)), | ||
1929 | - srs_human_flv_video_frame_type2string(srs_utils_get_flv_video_frame_type(data, size)) | 1927 | + srs_human_flv_video_codec_id2string(srs_utils_flv_video_codec_id(data, size)), |
1928 | + srs_human_flv_video_avc_packet_type2string(srs_utils_flv_video_avc_packet_type(data, size)), | ||
1929 | + srs_human_flv_video_frame_type2string(srs_utils_flv_video_frame_type(data, size)) | ||
1930 | ); | 1930 | ); |
1931 | } else if (type == SRS_RTMP_TYPE_AUDIO) { | 1931 | } else if (type == SRS_RTMP_TYPE_AUDIO) { |
1932 | srs_human_trace("Audio packet type=%s, dts=%d, pts=%d, size=%d", | 1932 | srs_human_trace("Audio packet type=%s, dts=%d, pts=%d, size=%d", |
@@ -592,17 +592,17 @@ extern void srs_amf0_strict_array_append(srs_amf0_t amf0, srs_amf0_t value); | @@ -592,17 +592,17 @@ extern void srs_amf0_strict_array_append(srs_amf0_t amf0, srs_amf0_t value); | ||
592 | * get the current system time in ms. | 592 | * get the current system time in ms. |
593 | * use gettimeofday() to get system time. | 593 | * use gettimeofday() to get system time. |
594 | */ | 594 | */ |
595 | -extern int64_t srs_utils_get_time_ms(); | 595 | +extern int64_t srs_utils_time_ms(); |
596 | 596 | ||
597 | /** | 597 | /** |
598 | * get the send bytes. | 598 | * get the send bytes. |
599 | */ | 599 | */ |
600 | -extern int64_t srs_utils_get_send_bytes(srs_rtmp_t rtmp); | 600 | +extern int64_t srs_utils_send_bytes(srs_rtmp_t rtmp); |
601 | 601 | ||
602 | /** | 602 | /** |
603 | * get the recv bytes. | 603 | * get the recv bytes. |
604 | */ | 604 | */ |
605 | -extern int64_t srs_utils_get_recv_bytes(srs_rtmp_t rtmp); | 605 | +extern int64_t srs_utils_recv_bytes(srs_rtmp_t rtmp); |
606 | 606 | ||
607 | /** | 607 | /** |
608 | * parse the dts and pts by time in header and data in tag, | 608 | * parse the dts and pts by time in header and data in tag, |
@@ -635,7 +635,7 @@ extern int srs_utils_parse_timestamp( | @@ -635,7 +635,7 @@ extern int srs_utils_parse_timestamp( | ||
635 | * 7 = AVC | 635 | * 7 = AVC |
636 | * @return the code id. 0 for error. | 636 | * @return the code id. 0 for error. |
637 | */ | 637 | */ |
638 | -extern char srs_utils_get_flv_video_codec_id(char* data, int size); | 638 | +extern char srs_utils_flv_video_codec_id(char* data, int size); |
639 | 639 | ||
640 | /** | 640 | /** |
641 | * get the AVCPacketType of video tag. | 641 | * get the AVCPacketType of video tag. |
@@ -646,7 +646,7 @@ extern char srs_utils_get_flv_video_codec_id(char* data, int size); | @@ -646,7 +646,7 @@ extern char srs_utils_get_flv_video_codec_id(char* data, int size); | ||
646 | * not required or supported) | 646 | * not required or supported) |
647 | * @return the avc packet type. -1(0xff) for error. | 647 | * @return the avc packet type. -1(0xff) for error. |
648 | */ | 648 | */ |
649 | -extern char srs_utils_get_flv_video_avc_packet_type(char* data, int size); | 649 | +extern char srs_utils_flv_video_avc_packet_type(char* data, int size); |
650 | 650 | ||
651 | /** | 651 | /** |
652 | * get the FrameType of video tag. | 652 | * get the FrameType of video tag. |
@@ -658,7 +658,7 @@ extern char srs_utils_get_flv_video_avc_packet_type(char* data, int size); | @@ -658,7 +658,7 @@ extern char srs_utils_get_flv_video_avc_packet_type(char* data, int size); | ||
658 | * 5 = video info/command frame | 658 | * 5 = video info/command frame |
659 | * @return the frame type. 0 for error. | 659 | * @return the frame type. 0 for error. |
660 | */ | 660 | */ |
661 | -extern char srs_utils_get_flv_video_frame_type(char* data, int size); | 661 | +extern char srs_utils_flv_video_frame_type(char* data, int size); |
662 | 662 | ||
663 | /************************************************************* | 663 | /************************************************************* |
664 | ************************************************************** | 664 | ************************************************************** |
-
请 注册 或 登录 后发表评论