winlin

rename the confict macro to srs_lib_trace

@@ -80,31 +80,31 @@ int main(int argc, char** argv) @@ -80,31 +80,31 @@ int main(int argc, char** argv)
80 80
81 rtmp = srs_rtmp_create2(argv[1]); 81 rtmp = srs_rtmp_create2(argv[1]);
82 82
83 - srs_trace("bandwidth check/test url: %s", argv[1]); 83 + srs_lib_trace("bandwidth check/test url: %s", argv[1]);
84 84
85 if ((ret = srs_simple_handshake(rtmp)) != 0) { 85 if ((ret = srs_simple_handshake(rtmp)) != 0) {
86 - srs_trace("simple handshake failed."); 86 + srs_lib_trace("simple handshake failed.");
87 goto rtmp_destroy; 87 goto rtmp_destroy;
88 } 88 }
89 - srs_trace("simple handshake success"); 89 + srs_lib_trace("simple handshake success");
90 90
91 if ((ret = srs_connect_app2(rtmp, 91 if ((ret = srs_connect_app2(rtmp,
92 srs_server_ip, srs_server, srs_primary_authors, srs_version, &srs_id, &srs_pid)) != 0) { 92 srs_server_ip, srs_server, srs_primary_authors, srs_version, &srs_id, &srs_pid)) != 0) {
93 - srs_trace("connect vhost/app failed."); 93 + srs_lib_trace("connect vhost/app failed.");
94 goto rtmp_destroy; 94 goto rtmp_destroy;
95 } 95 }
96 - srs_trace("connect vhost/app success"); 96 + srs_lib_trace("connect vhost/app success");
97 97
98 if ((ret = srs_bandwidth_check(rtmp, 98 if ((ret = srs_bandwidth_check(rtmp,
99 &start_time, &end_time, &play_kbps, &publish_kbps, 99 &start_time, &end_time, &play_kbps, &publish_kbps,
100 &play_bytes, &publish_bytes, &play_duration, &publish_duration)) != 0 100 &play_bytes, &publish_bytes, &play_duration, &publish_duration)) != 0
101 ) { 101 ) {
102 - srs_trace("bandwidth check/test failed."); 102 + srs_lib_trace("bandwidth check/test failed.");
103 goto rtmp_destroy; 103 goto rtmp_destroy;
104 } 104 }
105 - srs_trace("bandwidth check/test success"); 105 + srs_lib_trace("bandwidth check/test success");
106 106
107 - srs_trace("\n%s, %s\n" 107 + srs_lib_trace("\n%s, %s\n"
108 "%s, %s, srs_pid=%d, srs_id=%d\n" 108 "%s, %s, srs_pid=%d, srs_id=%d\n"
109 "duration: %dms(%d+%d)\n" 109 "duration: %dms(%d+%d)\n"
110 "play: %dkbps\n" 110 "play: %dkbps\n"
@@ -136,8 +136,8 @@ rtmp_destroy: @@ -136,8 +136,8 @@ rtmp_destroy:
136 (int)(end_time - start_time), play_duration, publish_duration, 136 (int)(end_time - start_time), play_duration, publish_duration,
137 play_kbps, publish_kbps); 137 play_kbps, publish_kbps);
138 138
139 - srs_trace("");  
140 - srs_trace("completed"); 139 + srs_lib_trace("");
  140 + srs_lib_trace("completed");
141 141
142 return ret; 142 return ret;
143 } 143 }
@@ -79,55 +79,55 @@ int main(int argc, char** argv) @@ -79,55 +79,55 @@ int main(int argc, char** argv)
79 duration = atoi(argv[2]); 79 duration = atoi(argv[2]);
80 timeout = atoi(argv[3]); 80 timeout = atoi(argv[3]);
81 81
82 - srs_trace("rtmp url: %s", rtmp_url);  
83 - srs_trace("duration: %ds, timeout:%ds", duration, timeout); 82 + srs_lib_trace("rtmp url: %s", rtmp_url);
  83 + srs_lib_trace("duration: %ds, timeout:%ds", duration, timeout);
84 84
85 if (duration <= 0 || timeout <= 0) { 85 if (duration <= 0 || timeout <= 0) {
86 - srs_trace("duration and timeout must be positive."); 86 + srs_lib_trace("duration and timeout must be positive.");
87 exit(-2); 87 exit(-2);
88 } 88 }
89 89
90 rtmp = srs_rtmp_create(rtmp_url); 90 rtmp = srs_rtmp_create(rtmp_url);
91 91
92 if ((ret = __srs_dns_resolve(rtmp)) != 0) { 92 if ((ret = __srs_dns_resolve(rtmp)) != 0) {
93 - srs_trace("dns resolve failed. ret=%d", ret); 93 + srs_lib_trace("dns resolve failed. ret=%d", ret);
94 goto rtmp_destroy; 94 goto rtmp_destroy;
95 } 95 }
96 - srs_trace("dns resolve success"); 96 + srs_lib_trace("dns resolve success");
97 time_dns_resolve = srs_get_time_ms(); 97 time_dns_resolve = srs_get_time_ms();
98 98
99 if ((ret = __srs_connect_server(rtmp)) != 0) { 99 if ((ret = __srs_connect_server(rtmp)) != 0) {
100 - srs_trace("socket connect failed. ret=%d", ret); 100 + srs_lib_trace("socket connect failed. ret=%d", ret);
101 goto rtmp_destroy; 101 goto rtmp_destroy;
102 } 102 }
103 - srs_trace("socket connect success"); 103 + srs_lib_trace("socket connect success");
104 time_socket_connect = srs_get_time_ms(); 104 time_socket_connect = srs_get_time_ms();
105 105
106 if ((ret = __srs_do_simple_handshake(rtmp)) != 0) { 106 if ((ret = __srs_do_simple_handshake(rtmp)) != 0) {
107 - srs_trace("do simple handshake failed. ret=%d", ret); 107 + srs_lib_trace("do simple handshake failed. ret=%d", ret);
108 goto rtmp_destroy; 108 goto rtmp_destroy;
109 } 109 }
110 - srs_trace("do simple handshake success"); 110 + srs_lib_trace("do simple handshake success");
111 111
112 if ((ret = srs_connect_app(rtmp)) != 0) { 112 if ((ret = srs_connect_app(rtmp)) != 0) {
113 - srs_trace("connect vhost/app failed. ret=%d", ret); 113 + srs_lib_trace("connect vhost/app failed. ret=%d", ret);
114 goto rtmp_destroy; 114 goto rtmp_destroy;
115 } 115 }
116 - srs_trace("connect vhost/app success"); 116 + srs_lib_trace("connect vhost/app success");
117 117
118 if ((ret = srs_play_stream(rtmp)) != 0) { 118 if ((ret = srs_play_stream(rtmp)) != 0) {
119 - srs_trace("play stream failed. ret=%d", ret); 119 + srs_lib_trace("play stream failed. ret=%d", ret);
120 goto rtmp_destroy; 120 goto rtmp_destroy;
121 } 121 }
122 - srs_trace("play stream success"); 122 + srs_lib_trace("play stream success");
123 time_play_stream = srs_get_time_ms(); 123 time_play_stream = srs_get_time_ms();
124 124
125 for (;;) { 125 for (;;) {
126 if ((ret = srs_read_packet(rtmp, &type, &timestamp, &data, &size)) != 0) { 126 if ((ret = srs_read_packet(rtmp, &type, &timestamp, &data, &size)) != 0) {
127 - srs_trace("read packet failed. ret=%d", ret); 127 + srs_lib_trace("read packet failed. ret=%d", ret);
128 goto rtmp_destroy; 128 goto rtmp_destroy;
129 } 129 }
130 - srs_trace("got packet: type=%s, time=%d, size=%d", 130 + srs_lib_trace("got packet: type=%s, time=%d, size=%d",
131 srs_type2string(type), timestamp, size); 131 srs_type2string(type), timestamp, size);
132 132
133 if (SRS_RTMP_TYPE_VIDEO == type || SRS_RTMP_TYPE_AUDIO == type) { 133 if (SRS_RTMP_TYPE_VIDEO == type || SRS_RTMP_TYPE_AUDIO == type) {
@@ -142,12 +142,12 @@ int main(int argc, char** argv) @@ -142,12 +142,12 @@ int main(int argc, char** argv)
142 free(data); 142 free(data);
143 143
144 if (srs_get_time_ms() - time_startup > timeout * 1000) { 144 if (srs_get_time_ms() - time_startup > timeout * 1000) {
145 - srs_trace("timeout, terminate."); 145 + srs_lib_trace("timeout, terminate.");
146 goto rtmp_destroy; 146 goto rtmp_destroy;
147 } 147 }
148 148
149 if ((timestamp - basetime) > duration * 1000) { 149 if ((timestamp - basetime) > duration * 1000) {
150 - srs_trace("duration exceed, terminate."); 150 + srs_lib_trace("duration exceed, terminate.");
151 goto rtmp_destroy; 151 goto rtmp_destroy;
152 } 152 }
153 } 153 }
@@ -196,8 +196,8 @@ rtmp_destroy: @@ -196,8 +196,8 @@ rtmp_destroy:
196 "\"remark2\": \"if code is not 0, user must ignore all data\"" 196 "\"remark2\": \"if code is not 0, user must ignore all data\""
197 ); 197 );
198 198
199 - srs_trace("");  
200 - srs_trace("completed"); 199 + srs_lib_trace("");
  200 + srs_lib_trace("completed");
201 201
202 return ret; 202 return ret;
203 } 203 }
@@ -76,9 +76,9 @@ int main(int argc, char** argv) @@ -76,9 +76,9 @@ int main(int argc, char** argv)
76 tmp_file = (char*)malloc(tmp_file_size); 76 tmp_file = (char*)malloc(tmp_file_size);
77 snprintf(tmp_file, tmp_file_size, "%s.tmp", out_flv_file); 77 snprintf(tmp_file, tmp_file_size, "%s.tmp", out_flv_file);
78 78
79 - srs_trace("input: %s", in_flv_file);  
80 - srs_trace("output: %s", out_flv_file);  
81 - srs_trace("tmp_file: %s", tmp_file); 79 + srs_lib_trace("input: %s", in_flv_file);
  80 + srs_lib_trace("output: %s", out_flv_file);
  81 + srs_lib_trace("tmp_file: %s", tmp_file);
82 82
83 ret = process(in_flv_file, tmp_file, &ic, &oc); 83 ret = process(in_flv_file, tmp_file, &ic, &oc);
84 84
@@ -89,13 +89,13 @@ int main(int argc, char** argv) @@ -89,13 +89,13 @@ int main(int argc, char** argv)
89 unlink(tmp_file); 89 unlink(tmp_file);
90 if (ret == ERROR_INJECTED) { 90 if (ret == ERROR_INJECTED) {
91 ret = 0; 91 ret = 0;
92 - srs_trace("file already injected."); 92 + srs_lib_trace("file already injected.");
93 } else { 93 } else {
94 - srs_trace("error, remove tmp file."); 94 + srs_lib_trace("error, remove tmp file.");
95 } 95 }
96 } else { 96 } else {
97 rename(tmp_file, out_flv_file); 97 rename(tmp_file, out_flv_file);
98 - srs_trace("completed, rename to %s", out_flv_file); 98 + srs_lib_trace("completed, rename to %s", out_flv_file);
99 } 99 }
100 100
101 free(tmp_file); 101 free(tmp_file);
@@ -123,14 +123,14 @@ int process(const char* in_flv_file, const char* out_flv_file, srs_flv_t* pic, s @@ -123,14 +123,14 @@ int process(const char* in_flv_file, const char* out_flv_file, srs_flv_t* pic, s
123 123
124 if ((ic = srs_flv_open_read(in_flv_file)) == NULL) { 124 if ((ic = srs_flv_open_read(in_flv_file)) == NULL) {
125 ret = 2; 125 ret = 2;
126 - srs_trace("open input flv file failed. ret=%d", ret); 126 + srs_lib_trace("open input flv file failed. ret=%d", ret);
127 return ret; 127 return ret;
128 } 128 }
129 *pic = ic; 129 *pic = ic;
130 130
131 if ((oc = srs_flv_open_write(out_flv_file)) == NULL) { 131 if ((oc = srs_flv_open_write(out_flv_file)) == NULL) {
132 ret = 2; 132 ret = 2;
133 - srs_trace("open output flv file failed. ret=%d", ret); 133 + srs_lib_trace("open output flv file failed. ret=%d", ret);
134 return ret; 134 return ret;
135 } 135 }
136 *poc = oc; 136 *poc = oc;
@@ -164,13 +164,13 @@ int parse_metadata(char* data, int size, srs_amf0_t* pname, srs_amf0_t* pdata) @@ -164,13 +164,13 @@ int parse_metadata(char* data, int size, srs_amf0_t* pname, srs_amf0_t* pdata)
164 *pname = srs_amf0_parse(data, size, &nparsed); 164 *pname = srs_amf0_parse(data, size, &nparsed);
165 165
166 if (*pname == NULL || nparsed >= size) { 166 if (*pname == NULL || nparsed >= size) {
167 - srs_trace("invalid amf0 name data."); 167 + srs_lib_trace("invalid amf0 name data.");
168 return -1; 168 return -1;
169 } 169 }
170 170
171 *pdata = srs_amf0_parse(data + nparsed, size - nparsed, &nparsed); 171 *pdata = srs_amf0_parse(data + nparsed, size - nparsed, &nparsed);
172 if (*pdata == NULL || nparsed > size) { 172 if (*pdata == NULL || nparsed > size) {
173 - srs_trace("invalid amf0 value data"); 173 + srs_lib_trace("invalid amf0 value data");
174 return -1; 174 return -1;
175 } 175 }
176 176
@@ -206,22 +206,22 @@ int build_keyframes(srs_flv_t ic, srs_amf0_t *pname, srs_amf0_t* pdata, srs_amf0 @@ -206,22 +206,22 @@ int build_keyframes(srs_flv_t ic, srs_amf0_t *pname, srs_amf0_t* pdata, srs_amf0
206 return ret; 206 return ret;
207 } 207 }
208 208
209 - srs_trace("build keyframe infos from flv"); 209 + srs_lib_trace("build keyframe infos from flv");
210 for (;;) { 210 for (;;) {
211 offset = srs_flv_tellg(ic); 211 offset = srs_flv_tellg(ic);
212 212
213 // tag header 213 // tag header
214 if ((ret = srs_flv_read_tag_header(ic, &type, &size, &timestamp)) != 0) { 214 if ((ret = srs_flv_read_tag_header(ic, &type, &size, &timestamp)) != 0) {
215 if (srs_flv_is_eof(ret)) { 215 if (srs_flv_is_eof(ret)) {
216 - srs_trace("parse completed."); 216 + srs_lib_trace("parse completed.");
217 return 0; 217 return 0;
218 } 218 }
219 - srs_trace("flv get packet failed. ret=%d", ret); 219 + srs_lib_trace("flv get packet failed. ret=%d", ret);
220 return ret; 220 return ret;
221 } 221 }
222 222
223 if (size <= 0) { 223 if (size <= 0) {
224 - srs_trace("invalid size=%d", size); 224 + srs_lib_trace("invalid size=%d", size);
225 return ret; 225 return ret;
226 } 226 }
227 227
@@ -343,20 +343,20 @@ int do_inject_flv(srs_flv_t ic, srs_flv_t oc, srs_amf0_t amf0_name, srs_amf0_t a @@ -343,20 +343,20 @@ int do_inject_flv(srs_flv_t ic, srs_flv_t oc, srs_amf0_t amf0_name, srs_amf0_t a
343 free(data); 343 free(data);
344 } 344 }
345 345
346 - srs_trace("build keyframe infos from flv"); 346 + srs_lib_trace("build keyframe infos from flv");
347 for (;;) { 347 for (;;) {
348 // tag header 348 // tag header
349 if ((ret = srs_flv_read_tag_header(ic, &type, &size, &timestamp)) != 0) { 349 if ((ret = srs_flv_read_tag_header(ic, &type, &size, &timestamp)) != 0) {
350 if (srs_flv_is_eof(ret)) { 350 if (srs_flv_is_eof(ret)) {
351 - srs_trace("parse completed."); 351 + srs_lib_trace("parse completed.");
352 return 0; 352 return 0;
353 } 353 }
354 - srs_trace("flv get packet failed. ret=%d", ret); 354 + srs_lib_trace("flv get packet failed. ret=%d", ret);
355 return ret; 355 return ret;
356 } 356 }
357 357
358 if (size <= 0) { 358 if (size <= 0) {
359 - srs_trace("invalid size=%d", size); 359 + srs_lib_trace("invalid size=%d", size);
360 break; 360 break;
361 } 361 }
362 362
@@ -61,11 +61,11 @@ int main(int argc, char** argv) @@ -61,11 +61,11 @@ int main(int argc, char** argv)
61 } 61 }
62 62
63 in_flv_file = argv[1]; 63 in_flv_file = argv[1];
64 - srs_trace("input: %s", in_flv_file); 64 + srs_lib_trace("input: %s", in_flv_file);
65 65
66 if ((flv = srs_flv_open_read(in_flv_file)) == NULL) { 66 if ((flv = srs_flv_open_read(in_flv_file)) == NULL) {
67 ret = 2; 67 ret = 2;
68 - srs_trace("open flv file failed. ret=%d", ret); 68 + srs_lib_trace("open flv file failed. ret=%d", ret);
69 return ret; 69 return ret;
70 } 70 }
71 71
@@ -147,12 +147,12 @@ int parse_script_data(u_int32_t timestamp, char* data, int size, int64_t offset) @@ -147,12 +147,12 @@ int parse_script_data(u_int32_t timestamp, char* data, int size, int64_t offset)
147 // amf0 147 // amf0
148 amf0_name = srs_amf0_parse(data, size, &nparsed); 148 amf0_name = srs_amf0_parse(data, size, &nparsed);
149 if (amf0_name == NULL || nparsed >= size) { 149 if (amf0_name == NULL || nparsed >= size) {
150 - srs_trace("invalid amf0 name data."); 150 + srs_lib_trace("invalid amf0 name data.");
151 return -1; 151 return -1;
152 } 152 }
153 amf0_data = srs_amf0_parse(data + nparsed, size - nparsed, &nparsed); 153 amf0_data = srs_amf0_parse(data + nparsed, size - nparsed, &nparsed);
154 154
155 - srs_trace("packet type=%s, time=%d, size=%d, data-size=%d, \n" 155 + srs_lib_trace("packet type=%s, time=%d, size=%d, data-size=%d, \n"
156 "offset=%d\n[+00, +15] %s\n[-15, EOF] %s\n%s%s", 156 "offset=%d\n[+00, +15] %s\n[-15, EOF] %s\n%s%s",
157 srs_type2string(SRS_RTMP_TYPE_SCRIPT), timestamp, size + FLV_HEADER_SIZE, size, 157 srs_type2string(SRS_RTMP_TYPE_SCRIPT), timestamp, size + FLV_HEADER_SIZE, size,
158 (int)offset, hbuf, tbuf, 158 (int)offset, hbuf, tbuf,
@@ -178,7 +178,7 @@ int parse_audio_data(u_int32_t timestamp, char* data, int size, int64_t offset) @@ -178,7 +178,7 @@ int parse_audio_data(u_int32_t timestamp, char* data, int size, int64_t offset)
178 // bytes 178 // bytes
179 parse_bytes(data, size, hbuf, sizeof(hbuf), tbuf, sizeof(tbuf), 16); 179 parse_bytes(data, size, hbuf, sizeof(hbuf), tbuf, sizeof(tbuf), 16);
180 180
181 - srs_trace("packet type=%s, time=%d, size=%d, data-size=%d, \n" 181 + srs_lib_trace("packet type=%s, time=%d, size=%d, data-size=%d, \n"
182 "offset=%d\n[+00, +15] %s\n[-15, EOF] %s\n", 182 "offset=%d\n[+00, +15] %s\n[-15, EOF] %s\n",
183 srs_type2string(SRS_RTMP_TYPE_AUDIO), timestamp, size + FLV_HEADER_SIZE, size, 183 srs_type2string(SRS_RTMP_TYPE_AUDIO), timestamp, size + FLV_HEADER_SIZE, size,
184 (int)offset, hbuf, tbuf); 184 (int)offset, hbuf, tbuf);
@@ -196,7 +196,7 @@ int parse_video_data(u_int32_t timestamp, char* data, int size, int64_t offset) @@ -196,7 +196,7 @@ int parse_video_data(u_int32_t timestamp, char* data, int size, int64_t offset)
196 // bytes 196 // bytes
197 parse_bytes(data, size, hbuf, sizeof(hbuf), tbuf, sizeof(tbuf), 16); 197 parse_bytes(data, size, hbuf, sizeof(hbuf), tbuf, sizeof(tbuf), 16);
198 198
199 - srs_trace("packet type=%s, time=%d, size=%d, data-size=%d, \n" 199 + srs_lib_trace("packet type=%s, time=%d, size=%d, data-size=%d, \n"
200 "offset=%d\n[+00, +15] %s\n[-15, EOF] %s\n", 200 "offset=%d\n[+00, +15] %s\n[-15, EOF] %s\n",
201 srs_type2string(SRS_RTMP_TYPE_VIDEO), timestamp, size + FLV_HEADER_SIZE, size, 201 srs_type2string(SRS_RTMP_TYPE_VIDEO), timestamp, size + FLV_HEADER_SIZE, size,
202 (int)offset, hbuf, tbuf); 202 (int)offset, hbuf, tbuf);
@@ -221,22 +221,22 @@ int parse_flv(srs_flv_t flv) @@ -221,22 +221,22 @@ int parse_flv(srs_flv_t flv)
221 return ret; 221 return ret;
222 } 222 }
223 223
224 - srs_trace("start parse flv"); 224 + srs_lib_trace("start parse flv");
225 for (;;) { 225 for (;;) {
226 offset = srs_flv_tellg(flv); 226 offset = srs_flv_tellg(flv);
227 227
228 // tag header 228 // tag header
229 if ((ret = srs_flv_read_tag_header(flv, &type, &size, &timestamp)) != 0) { 229 if ((ret = srs_flv_read_tag_header(flv, &type, &size, &timestamp)) != 0) {
230 if (srs_flv_is_eof(ret)) { 230 if (srs_flv_is_eof(ret)) {
231 - srs_trace("parse completed."); 231 + srs_lib_trace("parse completed.");
232 return 0; 232 return 0;
233 } 233 }
234 - srs_trace("flv get packet failed. ret=%d", ret); 234 + srs_lib_trace("flv get packet failed. ret=%d", ret);
235 return ret; 235 return ret;
236 } 236 }
237 237
238 if (size <= 0) { 238 if (size <= 0) {
239 - srs_trace("invalid size=%d", size); 239 + srs_lib_trace("invalid size=%d", size);
240 break; 240 break;
241 } 241 }
242 242
@@ -44,7 +44,7 @@ int read_h264_frame(char* data, int size, char** pp, int* pnb_start_code, int fp @@ -44,7 +44,7 @@ int read_h264_frame(char* data, int size, char** pp, int* pnb_start_code, int fp
44 // we search the h264 frame from the buffer which cached the h264 data. 44 // we search the h264 frame from the buffer which cached the h264 data.
45 // please get h264 raw data from device, it always a encoded frame. 45 // please get h264 raw data from device, it always a encoded frame.
46 if (!srs_h264_startswith_annexb(p, size - (p - data), pnb_start_code)) { 46 if (!srs_h264_startswith_annexb(p, size - (p - data), pnb_start_code)) {
47 - srs_trace("h264 raw data invalid."); 47 + srs_lib_trace("h264 raw data invalid.");
48 return -1; 48 return -1;
49 } 49 }
50 50
@@ -63,7 +63,7 @@ int read_h264_frame(char* data, int size, char** pp, int* pnb_start_code, int fp @@ -63,7 +63,7 @@ int read_h264_frame(char* data, int size, char** pp, int* pnb_start_code, int fp
63 *pp = p; 63 *pp = p;
64 *frame_size = p - *frame; 64 *frame_size = p - *frame;
65 if (*frame_size <= 0) { 65 if (*frame_size <= 0) {
66 - srs_trace("h264 raw data invalid."); 66 + srs_lib_trace("h264 raw data invalid.");
67 return -1; 67 return -1;
68 } 68 }
69 69
@@ -95,32 +95,32 @@ int main(int argc, char** argv) @@ -95,32 +95,32 @@ int main(int argc, char** argv)
95 95
96 const char* raw_file = argv[1]; 96 const char* raw_file = argv[1];
97 const char* rtmp_url = argv[2]; 97 const char* rtmp_url = argv[2];
98 - srs_trace("raw_file=%s, rtmp_url=%s", raw_file, rtmp_url); 98 + srs_lib_trace("raw_file=%s, rtmp_url=%s", raw_file, rtmp_url);
99 99
100 // open file 100 // open file
101 int raw_fd = open(raw_file, O_RDONLY); 101 int raw_fd = open(raw_file, O_RDONLY);
102 if (raw_fd < 0) { 102 if (raw_fd < 0) {
103 - srs_trace("open h264 raw file %s failed.", raw_fd); 103 + srs_lib_trace("open h264 raw file %s failed.", raw_fd);
104 goto rtmp_destroy; 104 goto rtmp_destroy;
105 } 105 }
106 106
107 off_t file_size = lseek(raw_fd, 0, SEEK_END); 107 off_t file_size = lseek(raw_fd, 0, SEEK_END);
108 if (file_size <= 0) { 108 if (file_size <= 0) {
109 - srs_trace("h264 raw file %s empty.", raw_file); 109 + srs_lib_trace("h264 raw file %s empty.", raw_file);
110 goto rtmp_destroy; 110 goto rtmp_destroy;
111 } 111 }
112 - srs_trace("read entirely h264 raw file, size=%dKB", (int)(file_size / 1024)); 112 + srs_lib_trace("read entirely h264 raw file, size=%dKB", (int)(file_size / 1024));
113 113
114 char* h264_raw = (char*)malloc(file_size); 114 char* h264_raw = (char*)malloc(file_size);
115 if (!h264_raw) { 115 if (!h264_raw) {
116 - srs_trace("alloc raw buffer failed for file %s.", raw_file); 116 + srs_lib_trace("alloc raw buffer failed for file %s.", raw_file);
117 goto rtmp_destroy; 117 goto rtmp_destroy;
118 } 118 }
119 119
120 lseek(raw_fd, 0, SEEK_SET); 120 lseek(raw_fd, 0, SEEK_SET);
121 ssize_t nb_read = 0; 121 ssize_t nb_read = 0;
122 if ((nb_read = read(raw_fd, h264_raw, file_size)) != file_size) { 122 if ((nb_read = read(raw_fd, h264_raw, file_size)) != file_size) {
123 - srs_trace("buffer %s failed, expect=%dKB, actual=%dKB.", 123 + srs_lib_trace("buffer %s failed, expect=%dKB, actual=%dKB.",
124 raw_file, (int)(file_size / 1024), (int)(nb_read / 1024)); 124 raw_file, (int)(file_size / 1024), (int)(nb_read / 1024));
125 goto rtmp_destroy; 125 goto rtmp_destroy;
126 } 126 }
@@ -129,22 +129,22 @@ int main(int argc, char** argv) @@ -129,22 +129,22 @@ int main(int argc, char** argv)
129 srs_rtmp_t rtmp = srs_rtmp_create(rtmp_url); 129 srs_rtmp_t rtmp = srs_rtmp_create(rtmp_url);
130 130
131 if (srs_simple_handshake(rtmp) != 0) { 131 if (srs_simple_handshake(rtmp) != 0) {
132 - srs_trace("simple handshake failed."); 132 + srs_lib_trace("simple handshake failed.");
133 goto rtmp_destroy; 133 goto rtmp_destroy;
134 } 134 }
135 - srs_trace("simple handshake success"); 135 + srs_lib_trace("simple handshake success");
136 136
137 if (srs_connect_app(rtmp) != 0) { 137 if (srs_connect_app(rtmp) != 0) {
138 - srs_trace("connect vhost/app failed."); 138 + srs_lib_trace("connect vhost/app failed.");
139 goto rtmp_destroy; 139 goto rtmp_destroy;
140 } 140 }
141 - srs_trace("connect vhost/app success"); 141 + srs_lib_trace("connect vhost/app success");
142 142
143 if (srs_publish_stream(rtmp) != 0) { 143 if (srs_publish_stream(rtmp) != 0) {
144 - srs_trace("publish stream failed."); 144 + srs_lib_trace("publish stream failed.");
145 goto rtmp_destroy; 145 goto rtmp_destroy;
146 } 146 }
147 - srs_trace("publish stream success"); 147 + srs_lib_trace("publish stream success");
148 148
149 u_int32_t dts = 0; 149 u_int32_t dts = 0;
150 u_int32_t pts = 0; 150 u_int32_t pts = 0;
@@ -161,27 +161,27 @@ int main(int argc, char** argv) @@ -161,27 +161,27 @@ int main(int argc, char** argv)
161 if (read_h264_frame(h264_raw, file_size, &p, &nb_start_code, fps, 161 if (read_h264_frame(h264_raw, file_size, &p, &nb_start_code, fps,
162 &data, &size, &dts, &pts) < 0 162 &data, &size, &dts, &pts) < 0
163 ) { 163 ) {
164 - srs_trace("read a frame from file buffer failed."); 164 + srs_lib_trace("read a frame from file buffer failed.");
165 goto rtmp_destroy; 165 goto rtmp_destroy;
166 } 166 }
167 167
168 // send out the h264 packet over RTMP 168 // send out the h264 packet over RTMP
169 if (srs_write_h264_raw_frames(rtmp, data, size, dts, pts) != 0) { 169 if (srs_write_h264_raw_frames(rtmp, data, size, dts, pts) != 0) {
170 - srs_trace("send h264 raw data failed."); 170 + srs_lib_trace("send h264 raw data failed.");
171 goto rtmp_destroy; 171 goto rtmp_destroy;
172 } 172 }
173 173
174 // 5bits, 7.3.1 NAL unit syntax, 174 // 5bits, 7.3.1 NAL unit syntax,
175 // H.264-AVC-ISO_IEC_14496-10.pdf, page 44. 175 // H.264-AVC-ISO_IEC_14496-10.pdf, page 44.
176 u_int8_t nut = (char)data[nb_start_code] & 0x1f; 176 u_int8_t nut = (char)data[nb_start_code] & 0x1f;
177 - srs_trace("sent packet: type=%s, time=%d, size=%d, fps=%d, b[%d]=%#x(%s)", 177 + srs_lib_trace("sent packet: type=%s, time=%d, size=%d, fps=%d, b[%d]=%#x(%s)",
178 srs_type2string(SRS_RTMP_TYPE_VIDEO), dts, size, fps, nb_start_code, (char)data[nb_start_code], 178 srs_type2string(SRS_RTMP_TYPE_VIDEO), dts, size, fps, nb_start_code, (char)data[nb_start_code],
179 (nut == 7? "SPS":(nut == 8? "PPS":(nut == 5? "I":(nut == 1? "P":"Unknown"))))); 179 (nut == 7? "SPS":(nut == 8? "PPS":(nut == 5? "I":(nut == 1? "P":"Unknown")))));
180 180
181 // @remark, when use encode device, it not need to sleep. 181 // @remark, when use encode device, it not need to sleep.
182 usleep(1000 / fps * 1000); 182 usleep(1000 / fps * 1000);
183 } 183 }
184 - srs_trace("h264 raw data completed"); 184 + srs_lib_trace("h264 raw data completed");
185 185
186 rtmp_destroy: 186 rtmp_destroy:
187 srs_rtmp_destroy(rtmp); 187 srs_rtmp_destroy(rtmp);
@@ -89,19 +89,19 @@ int main(int argc, char** argv) @@ -89,19 +89,19 @@ int main(int argc, char** argv)
89 } 89 }
90 } 90 }
91 91
92 - srs_trace("input: %s", in_flv_file);  
93 - srs_trace("output: %s", out_rtmp_url); 92 + srs_lib_trace("input: %s", in_flv_file);
  93 + srs_lib_trace("output: %s", out_rtmp_url);
94 94
95 if ((flv = srs_flv_open_read(in_flv_file)) == NULL) { 95 if ((flv = srs_flv_open_read(in_flv_file)) == NULL) {
96 ret = 2; 96 ret = 2;
97 - srs_trace("open flv file failed. ret=%d", ret); 97 + srs_lib_trace("open flv file failed. ret=%d", ret);
98 return ret; 98 return ret;
99 } 99 }
100 100
101 ortmp = srs_rtmp_create(out_rtmp_url); 101 ortmp = srs_rtmp_create(out_rtmp_url);
102 102
103 ret = proxy(flv, ortmp); 103 ret = proxy(flv, ortmp);
104 - srs_trace("ingest flv to RTMP completed"); 104 + srs_lib_trace("ingest flv to RTMP completed");
105 105
106 srs_rtmp_destroy(ortmp); 106 srs_rtmp_destroy(ortmp);
107 srs_flv_close(flv); 107 srs_flv_close(flv);
@@ -118,20 +118,20 @@ int do_proxy(srs_flv_t flv, srs_rtmp_t ortmp, int64_t re, u_int32_t* ptimestamp) @@ -118,20 +118,20 @@ int do_proxy(srs_flv_t flv, srs_rtmp_t ortmp, int64_t re, u_int32_t* ptimestamp)
118 int size; 118 int size;
119 char* data = NULL; 119 char* data = NULL;
120 120
121 - srs_trace("start ingest flv to RTMP stream"); 121 + srs_lib_trace("start ingest flv to RTMP stream");
122 for (;;) { 122 for (;;) {
123 // tag header 123 // tag header
124 if ((ret = srs_flv_read_tag_header(flv, &type, &size, ptimestamp)) != 0) { 124 if ((ret = srs_flv_read_tag_header(flv, &type, &size, ptimestamp)) != 0) {
125 if (srs_flv_is_eof(ret)) { 125 if (srs_flv_is_eof(ret)) {
126 - srs_trace("parse completed."); 126 + srs_lib_trace("parse completed.");
127 return 0; 127 return 0;
128 } 128 }
129 - srs_trace("flv get packet failed. ret=%d", ret); 129 + srs_lib_trace("flv get packet failed. ret=%d", ret);
130 return ret; 130 return ret;
131 } 131 }
132 132
133 if (size <= 0) { 133 if (size <= 0) {
134 - srs_trace("invalid size=%d", size); 134 + srs_lib_trace("invalid size=%d", size);
135 break; 135 break;
136 } 136 }
137 137
@@ -142,10 +142,10 @@ int do_proxy(srs_flv_t flv, srs_rtmp_t ortmp, int64_t re, u_int32_t* ptimestamp) @@ -142,10 +142,10 @@ int do_proxy(srs_flv_t flv, srs_rtmp_t ortmp, int64_t re, u_int32_t* ptimestamp)
142 } 142 }
143 143
144 if ((ret = srs_write_packet(ortmp, type, *ptimestamp, data, size)) != 0) { 144 if ((ret = srs_write_packet(ortmp, type, *ptimestamp, data, size)) != 0) {
145 - srs_trace("irtmp get packet failed. ret=%d", ret); 145 + srs_lib_trace("irtmp get packet failed. ret=%d", ret);
146 return ret; 146 return ret;
147 } 147 }
148 - srs_verbose("ortmp sent packet: type=%s, time=%d, size=%d", 148 + srs_lib_verbose("ortmp sent packet: type=%s, time=%d, size=%d",
149 srs_type2string(type), *ptimestamp, size); 149 srs_type2string(type), *ptimestamp, size);
150 150
151 re_update(re, *ptimestamp); 151 re_update(re, *ptimestamp);
@@ -182,22 +182,22 @@ int connect_oc(srs_rtmp_t ortmp) @@ -182,22 +182,22 @@ int connect_oc(srs_rtmp_t ortmp)
182 int ret = 0; 182 int ret = 0;
183 183
184 if ((ret = srs_simple_handshake(ortmp)) != 0) { 184 if ((ret = srs_simple_handshake(ortmp)) != 0) {
185 - srs_trace("ortmp simple handshake failed. ret=%d", ret); 185 + srs_lib_trace("ortmp simple handshake failed. ret=%d", ret);
186 return ret; 186 return ret;
187 } 187 }
188 - srs_trace("ortmp simple handshake success"); 188 + srs_lib_trace("ortmp simple handshake success");
189 189
190 if ((ret = srs_connect_app(ortmp)) != 0) { 190 if ((ret = srs_connect_app(ortmp)) != 0) {
191 - srs_trace("ortmp connect vhost/app failed. ret=%d", ret); 191 + srs_lib_trace("ortmp connect vhost/app failed. ret=%d", ret);
192 return ret; 192 return ret;
193 } 193 }
194 - srs_trace("ortmp connect vhost/app success"); 194 + srs_lib_trace("ortmp connect vhost/app success");
195 195
196 if ((ret = srs_publish_stream(ortmp)) != 0) { 196 if ((ret = srs_publish_stream(ortmp)) != 0) {
197 - srs_trace("ortmp publish stream failed. ret=%d", ret); 197 + srs_lib_trace("ortmp publish stream failed. ret=%d", ret);
198 return ret; 198 return ret;
199 } 199 }
200 - srs_trace("ortmp publish stream success"); 200 + srs_lib_trace("ortmp publish stream success");
201 201
202 return ret; 202 return ret;
203 } 203 }
@@ -209,16 +209,16 @@ int64_t re_create() @@ -209,16 +209,16 @@ int64_t re_create()
209 209
210 // use the starttime to get the deviation 210 // use the starttime to get the deviation
211 int64_t deviation = re - tools_main_entrance_startup_time; 211 int64_t deviation = re - tools_main_entrance_startup_time;
212 - srs_trace("deviation is %d ms, pulse is %d ms", (int)(deviation), (int)(RE_PULSE_MS)); 212 + srs_lib_trace("deviation is %d ms, pulse is %d ms", (int)(deviation), (int)(RE_PULSE_MS));
213 213
214 // so, we adjust time to max(0, deviation) 214 // so, we adjust time to max(0, deviation)
215 // because the last pulse, we already sleeped 215 // because the last pulse, we already sleeped
216 int adjust = (int)(deviation); 216 int adjust = (int)(deviation);
217 if (adjust > 0) { 217 if (adjust > 0) {
218 - srs_trace("adjust re time for %d ms", adjust); 218 + srs_lib_trace("adjust re time for %d ms", adjust);
219 re -= adjust; 219 re -= adjust;
220 } else { 220 } else {
221 - srs_trace("no need to adjust re time"); 221 + srs_lib_trace("no need to adjust re time");
222 } 222 }
223 223
224 return re; 224 return re;
@@ -239,7 +239,7 @@ void re_cleanup(int64_t re, u_int32_t time) @@ -239,7 +239,7 @@ void re_cleanup(int64_t re, u_int32_t time)
239 int64_t now = srs_get_time_ms(); 239 int64_t now = srs_get_time_ms();
240 int64_t diff = time - (now -re); 240 int64_t diff = time - (now -re);
241 if (diff > 0) { 241 if (diff > 0) {
242 - srs_trace("re_cleanup sleep for the last pulse for %d ms", (int)diff); 242 + srs_lib_trace("re_cleanup sleep for the last pulse for %d ms", (int)diff);
243 usleep(diff * 1000); 243 usleep(diff * 1000);
244 } 244 }
245 } 245 }
@@ -74,14 +74,14 @@ int main(int argc, char** argv) @@ -74,14 +74,14 @@ int main(int argc, char** argv)
74 } 74 }
75 } 75 }
76 76
77 - srs_trace("input: %s", in_rtmp_url);  
78 - srs_trace("output: %s", out_rtmp_url); 77 + srs_lib_trace("input: %s", in_rtmp_url);
  78 + srs_lib_trace("output: %s", out_rtmp_url);
79 79
80 irtmp = srs_rtmp_create(in_rtmp_url); 80 irtmp = srs_rtmp_create(in_rtmp_url);
81 ortmp = srs_rtmp_create(out_rtmp_url); 81 ortmp = srs_rtmp_create(out_rtmp_url);
82 82
83 ret = proxy(irtmp, ortmp); 83 ret = proxy(irtmp, ortmp);
84 - srs_trace("proxy completed"); 84 + srs_lib_trace("proxy completed");
85 85
86 srs_rtmp_destroy(irtmp); 86 srs_rtmp_destroy(irtmp);
87 srs_rtmp_destroy(ortmp); 87 srs_rtmp_destroy(ortmp);
@@ -105,20 +105,20 @@ int proxy(srs_rtmp_t irtmp, srs_rtmp_t ortmp) @@ -105,20 +105,20 @@ int proxy(srs_rtmp_t irtmp, srs_rtmp_t ortmp)
105 return ret; 105 return ret;
106 } 106 }
107 107
108 - srs_trace("start proxy RTMP stream"); 108 + srs_lib_trace("start proxy RTMP stream");
109 for (;;) { 109 for (;;) {
110 if ((ret = srs_read_packet(irtmp, &type, &timestamp, &data, &size)) != 0) { 110 if ((ret = srs_read_packet(irtmp, &type, &timestamp, &data, &size)) != 0) {
111 - srs_trace("irtmp get packet failed. ret=%d", ret); 111 + srs_lib_trace("irtmp get packet failed. ret=%d", ret);
112 return ret; 112 return ret;
113 } 113 }
114 - srs_verbose("irtmp got packet: type=%s, time=%d, size=%d", 114 + srs_lib_verbose("irtmp got packet: type=%s, time=%d, size=%d",
115 srs_type2string(type), timestamp, size); 115 srs_type2string(type), timestamp, size);
116 116
117 if ((ret = srs_write_packet(ortmp, type, timestamp, data, size)) != 0) { 117 if ((ret = srs_write_packet(ortmp, type, timestamp, data, size)) != 0) {
118 - srs_trace("irtmp get packet failed. ret=%d", ret); 118 + srs_lib_trace("irtmp get packet failed. ret=%d", ret);
119 return ret; 119 return ret;
120 } 120 }
121 - srs_verbose("ortmp sent packet: type=%s, time=%d, size=%d", 121 + srs_lib_verbose("ortmp sent packet: type=%s, time=%d, size=%d",
122 srs_type2string(type), timestamp, size); 122 srs_type2string(type), timestamp, size);
123 } 123 }
124 124
@@ -130,22 +130,22 @@ int connect_ic(srs_rtmp_t irtmp) @@ -130,22 +130,22 @@ int connect_ic(srs_rtmp_t irtmp)
130 int ret = 0; 130 int ret = 0;
131 131
132 if ((ret = srs_simple_handshake(irtmp)) != 0) { 132 if ((ret = srs_simple_handshake(irtmp)) != 0) {
133 - srs_trace("irtmp simple handshake failed. ret=%d", ret); 133 + srs_lib_trace("irtmp simple handshake failed. ret=%d", ret);
134 return ret; 134 return ret;
135 } 135 }
136 - srs_trace("irtmp simple handshake success"); 136 + srs_lib_trace("irtmp simple handshake success");
137 137
138 if ((ret = srs_connect_app(irtmp)) != 0) { 138 if ((ret = srs_connect_app(irtmp)) != 0) {
139 - srs_trace("irtmp connect vhost/app failed. ret=%d", ret); 139 + srs_lib_trace("irtmp connect vhost/app failed. ret=%d", ret);
140 return ret; 140 return ret;
141 } 141 }
142 - srs_trace("irtmp connect vhost/app success"); 142 + srs_lib_trace("irtmp connect vhost/app success");
143 143
144 if ((ret = srs_play_stream(irtmp)) != 0) { 144 if ((ret = srs_play_stream(irtmp)) != 0) {
145 - srs_trace("irtmp play stream failed. ret=%d", ret); 145 + srs_lib_trace("irtmp play stream failed. ret=%d", ret);
146 return ret; 146 return ret;
147 } 147 }
148 - srs_trace("irtmp play stream success"); 148 + srs_lib_trace("irtmp play stream success");
149 149
150 return ret; 150 return ret;
151 } 151 }
@@ -155,22 +155,22 @@ int connect_oc(srs_rtmp_t ortmp) @@ -155,22 +155,22 @@ int connect_oc(srs_rtmp_t ortmp)
155 int ret = 0; 155 int ret = 0;
156 156
157 if ((ret = srs_simple_handshake(ortmp)) != 0) { 157 if ((ret = srs_simple_handshake(ortmp)) != 0) {
158 - srs_trace("ortmp simple handshake failed. ret=%d", ret); 158 + srs_lib_trace("ortmp simple handshake failed. ret=%d", ret);
159 return ret; 159 return ret;
160 } 160 }
161 - srs_trace("ortmp simple handshake success"); 161 + srs_lib_trace("ortmp simple handshake success");
162 162
163 if ((ret = srs_connect_app(ortmp)) != 0) { 163 if ((ret = srs_connect_app(ortmp)) != 0) {
164 - srs_trace("ortmp connect vhost/app failed. ret=%d", ret); 164 + srs_lib_trace("ortmp connect vhost/app failed. ret=%d", ret);
165 return ret; 165 return ret;
166 } 166 }
167 - srs_trace("ortmp connect vhost/app success"); 167 + srs_lib_trace("ortmp connect vhost/app success");
168 168
169 if ((ret = srs_publish_stream(ortmp)) != 0) { 169 if ((ret = srs_publish_stream(ortmp)) != 0) {
170 - srs_trace("ortmp publish stream failed. ret=%d", ret); 170 + srs_lib_trace("ortmp publish stream failed. ret=%d", ret);
171 return ret; 171 return ret;
172 } 172 }
173 - srs_trace("ortmp publish stream success"); 173 + srs_lib_trace("ortmp publish stream success");
174 174
175 return ret; 175 return ret;
176 } 176 }
@@ -44,26 +44,26 @@ int main(int argc, char** argv) @@ -44,26 +44,26 @@ int main(int argc, char** argv)
44 exit(-1); 44 exit(-1);
45 } 45 }
46 46
47 - srs_trace("rtmp url: %s", argv[1]); 47 + srs_lib_trace("rtmp url: %s", argv[1]);
48 srs_rtmp_t rtmp = srs_rtmp_create(argv[1]); 48 srs_rtmp_t rtmp = srs_rtmp_create(argv[1]);
49 49
50 if (srs_simple_handshake(rtmp) != 0) { 50 if (srs_simple_handshake(rtmp) != 0) {
51 - srs_trace("simple handshake failed."); 51 + srs_lib_trace("simple handshake failed.");
52 goto rtmp_destroy; 52 goto rtmp_destroy;
53 } 53 }
54 - srs_trace("simple handshake success"); 54 + srs_lib_trace("simple handshake success");
55 55
56 if (srs_connect_app(rtmp) != 0) { 56 if (srs_connect_app(rtmp) != 0) {
57 - srs_trace("connect vhost/app failed."); 57 + srs_lib_trace("connect vhost/app failed.");
58 goto rtmp_destroy; 58 goto rtmp_destroy;
59 } 59 }
60 - srs_trace("connect vhost/app success"); 60 + srs_lib_trace("connect vhost/app success");
61 61
62 if (srs_play_stream(rtmp) != 0) { 62 if (srs_play_stream(rtmp) != 0) {
63 - srs_trace("play stream failed."); 63 + srs_lib_trace("play stream failed.");
64 goto rtmp_destroy; 64 goto rtmp_destroy;
65 } 65 }
66 - srs_trace("play stream success"); 66 + srs_lib_trace("play stream success");
67 67
68 for (;;) { 68 for (;;) {
69 int type, size; 69 int type, size;
@@ -73,7 +73,7 @@ int main(int argc, char** argv) @@ -73,7 +73,7 @@ int main(int argc, char** argv)
73 if (srs_read_packet(rtmp, &type, &timestamp, &data, &size) != 0) { 73 if (srs_read_packet(rtmp, &type, &timestamp, &data, &size) != 0) {
74 goto rtmp_destroy; 74 goto rtmp_destroy;
75 } 75 }
76 - srs_trace("got packet: type=%s, time=%d, size=%d", 76 + srs_lib_trace("got packet: type=%s, time=%d, size=%d",
77 srs_type2string(type), timestamp, size); 77 srs_type2string(type), timestamp, size);
78 78
79 free(data); 79 free(data);
@@ -47,31 +47,31 @@ int main(int argc, char** argv) @@ -47,31 +47,31 @@ int main(int argc, char** argv)
47 47
48 // warn it . 48 // warn it .
49 // @see: https://github.com/winlinvip/simple-rtmp-server/issues/126 49 // @see: https://github.com/winlinvip/simple-rtmp-server/issues/126
50 - srs_trace("\033[33m%s\033[0m", 50 + srs_lib_trace("\033[33m%s\033[0m",
51 "[warning] it's only a sample to use librtmp. " 51 "[warning] it's only a sample to use librtmp. "
52 "please never use it to publish and test forward/transcode/edge/HLS whatever. " 52 "please never use it to publish and test forward/transcode/edge/HLS whatever. "
53 "you should refer to this tool to use the srs-librtmp to publish the real media stream." 53 "you should refer to this tool to use the srs-librtmp to publish the real media stream."
54 "read about: https://github.com/winlinvip/simple-rtmp-server/issues/126"); 54 "read about: https://github.com/winlinvip/simple-rtmp-server/issues/126");
55 - srs_trace("rtmp url: %s", argv[1]); 55 + srs_lib_trace("rtmp url: %s", argv[1]);
56 srs_rtmp_t rtmp = srs_rtmp_create(argv[1]); 56 srs_rtmp_t rtmp = srs_rtmp_create(argv[1]);
57 57
58 if (srs_simple_handshake(rtmp) != 0) { 58 if (srs_simple_handshake(rtmp) != 0) {
59 - srs_trace("simple handshake failed."); 59 + srs_lib_trace("simple handshake failed.");
60 goto rtmp_destroy; 60 goto rtmp_destroy;
61 } 61 }
62 - srs_trace("simple handshake success"); 62 + srs_lib_trace("simple handshake success");
63 63
64 if (srs_connect_app(rtmp) != 0) { 64 if (srs_connect_app(rtmp) != 0) {
65 - srs_trace("connect vhost/app failed."); 65 + srs_lib_trace("connect vhost/app failed.");
66 goto rtmp_destroy; 66 goto rtmp_destroy;
67 } 67 }
68 - srs_trace("connect vhost/app success"); 68 + srs_lib_trace("connect vhost/app success");
69 69
70 if (srs_publish_stream(rtmp) != 0) { 70 if (srs_publish_stream(rtmp) != 0) {
71 - srs_trace("publish stream failed."); 71 + srs_lib_trace("publish stream failed.");
72 goto rtmp_destroy; 72 goto rtmp_destroy;
73 } 73 }
74 - srs_trace("publish stream success"); 74 + srs_lib_trace("publish stream success");
75 75
76 u_int32_t timestamp = 0; 76 u_int32_t timestamp = 0;
77 for (;;) { 77 for (;;) {
@@ -84,7 +84,7 @@ int main(int argc, char** argv) @@ -84,7 +84,7 @@ int main(int argc, char** argv)
84 if (srs_write_packet(rtmp, type, timestamp, data, size) != 0) { 84 if (srs_write_packet(rtmp, type, timestamp, data, size) != 0) {
85 goto rtmp_destroy; 85 goto rtmp_destroy;
86 } 86 }
87 - srs_trace("sent packet: type=%s, time=%d, size=%d", 87 + srs_lib_trace("sent packet: type=%s, time=%d, size=%d",
88 srs_type2string(type), timestamp, size); 88 srs_type2string(type), timestamp, size);
89 89
90 usleep(40 * 1000); 90 usleep(40 * 1000);
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 // current release version 31 // current release version
32 #define VERSION_MAJOR 2 32 #define VERSION_MAJOR 2
33 #define VERSION_MINOR 0 33 #define VERSION_MINOR 0
34 -#define VERSION_REVISION 11 34 +#define VERSION_REVISION 12
35 // server info. 35 // server info.
36 #define RTMP_SIG_SRS_KEY "SRS" 36 #define RTMP_SIG_SRS_KEY "SRS"
37 #define RTMP_SIG_SRS_ROLE "origin/edge server" 37 #define RTMP_SIG_SRS_ROLE "origin/edge server"
@@ -237,8 +237,8 @@ extern int64_t srs_get_nrecv_bytes(srs_rtmp_t rtmp); @@ -237,8 +237,8 @@ extern int64_t srs_get_nrecv_bytes(srs_rtmp_t rtmp);
237 237
238 // log to console, for use srs-librtmp application. 238 // log to console, for use srs-librtmp application.
239 extern const char* srs_format_time(); 239 extern const char* srs_format_time();
240 -#define srs_trace(msg, ...) printf("[%s] ", srs_format_time());printf(msg, ##__VA_ARGS__);printf("\n")  
241 -#define srs_verbose(msg, ...) printf("[%s] ", srs_format_time());printf(msg, ##__VA_ARGS__);printf("\n") 240 +#define srs_lib_trace(msg, ...) printf("[%s] ", srs_format_time());printf(msg, ##__VA_ARGS__);printf("\n")
  241 +#define srs_lib_verbose(msg, ...) printf("[%s] ", srs_format_time());printf(msg, ##__VA_ARGS__);printf("\n")
242 242
243 /************************************************************* 243 /*************************************************************
244 ************************************************************** 244 **************************************************************