1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

rename the confict macro to srs_lib_trace

This commit is contained in:
winlin 2014-11-08 18:37:15 +08:00
parent 3405f35d06
commit 606fc13a03
11 changed files with 135 additions and 135 deletions

View file

@ -89,19 +89,19 @@ int main(int argc, char** argv)
}
}
srs_trace("input: %s", in_flv_file);
srs_trace("output: %s", out_rtmp_url);
srs_lib_trace("input: %s", in_flv_file);
srs_lib_trace("output: %s", out_rtmp_url);
if ((flv = srs_flv_open_read(in_flv_file)) == NULL) {
ret = 2;
srs_trace("open flv file failed. ret=%d", ret);
srs_lib_trace("open flv file failed. ret=%d", ret);
return ret;
}
ortmp = srs_rtmp_create(out_rtmp_url);
ret = proxy(flv, ortmp);
srs_trace("ingest flv to RTMP completed");
srs_lib_trace("ingest flv to RTMP completed");
srs_rtmp_destroy(ortmp);
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)
int size;
char* data = NULL;
srs_trace("start ingest flv to RTMP stream");
srs_lib_trace("start ingest flv to RTMP stream");
for (;;) {
// tag header
if ((ret = srs_flv_read_tag_header(flv, &type, &size, ptimestamp)) != 0) {
if (srs_flv_is_eof(ret)) {
srs_trace("parse completed.");
srs_lib_trace("parse completed.");
return 0;
}
srs_trace("flv get packet failed. ret=%d", ret);
srs_lib_trace("flv get packet failed. ret=%d", ret);
return ret;
}
if (size <= 0) {
srs_trace("invalid size=%d", size);
srs_lib_trace("invalid size=%d", size);
break;
}
@ -142,10 +142,10 @@ int do_proxy(srs_flv_t flv, srs_rtmp_t ortmp, int64_t re, u_int32_t* ptimestamp)
}
if ((ret = srs_write_packet(ortmp, type, *ptimestamp, data, size)) != 0) {
srs_trace("irtmp get packet failed. ret=%d", ret);
srs_lib_trace("irtmp get packet failed. ret=%d", ret);
return ret;
}
srs_verbose("ortmp sent packet: type=%s, time=%d, size=%d",
srs_lib_verbose("ortmp sent packet: type=%s, time=%d, size=%d",
srs_type2string(type), *ptimestamp, size);
re_update(re, *ptimestamp);
@ -182,22 +182,22 @@ int connect_oc(srs_rtmp_t ortmp)
int ret = 0;
if ((ret = srs_simple_handshake(ortmp)) != 0) {
srs_trace("ortmp simple handshake failed. ret=%d", ret);
srs_lib_trace("ortmp simple handshake failed. ret=%d", ret);
return ret;
}
srs_trace("ortmp simple handshake success");
srs_lib_trace("ortmp simple handshake success");
if ((ret = srs_connect_app(ortmp)) != 0) {
srs_trace("ortmp connect vhost/app failed. ret=%d", ret);
srs_lib_trace("ortmp connect vhost/app failed. ret=%d", ret);
return ret;
}
srs_trace("ortmp connect vhost/app success");
srs_lib_trace("ortmp connect vhost/app success");
if ((ret = srs_publish_stream(ortmp)) != 0) {
srs_trace("ortmp publish stream failed. ret=%d", ret);
srs_lib_trace("ortmp publish stream failed. ret=%d", ret);
return ret;
}
srs_trace("ortmp publish stream success");
srs_lib_trace("ortmp publish stream success");
return ret;
}
@ -209,16 +209,16 @@ int64_t re_create()
// use the starttime to get the deviation
int64_t deviation = re - tools_main_entrance_startup_time;
srs_trace("deviation is %d ms, pulse is %d ms", (int)(deviation), (int)(RE_PULSE_MS));
srs_lib_trace("deviation is %d ms, pulse is %d ms", (int)(deviation), (int)(RE_PULSE_MS));
// so, we adjust time to max(0, deviation)
// because the last pulse, we already sleeped
int adjust = (int)(deviation);
if (adjust > 0) {
srs_trace("adjust re time for %d ms", adjust);
srs_lib_trace("adjust re time for %d ms", adjust);
re -= adjust;
} else {
srs_trace("no need to adjust re time");
srs_lib_trace("no need to adjust re time");
}
return re;
@ -239,7 +239,7 @@ void re_cleanup(int64_t re, u_int32_t time)
int64_t now = srs_get_time_ms();
int64_t diff = time - (now -re);
if (diff > 0) {
srs_trace("re_cleanup sleep for the last pulse for %d ms", (int)diff);
srs_lib_trace("re_cleanup sleep for the last pulse for %d ms", (int)diff);
usleep(diff * 1000);
}
}