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

Refine srs-librtmp API, change print to format

This commit is contained in:
winlin 2017-03-01 10:52:57 +08:00
parent ad87bd7cf2
commit 72c4ae4a8c
8 changed files with 95 additions and 59 deletions

View file

@ -174,6 +174,7 @@ int do_proxy(srs_rtmp_t rtmp, srs_flv_t flv)
uint32_t pre_timestamp = 0;
int64_t pre_now = -1;
int64_t start_time = -1;
char buffer[1024];
for (;;) {
int size;
char type;
@ -192,10 +193,12 @@ int do_proxy(srs_rtmp_t rtmp, srs_flv_t flv)
start_time = srs_utils_time_ms();
}
if ((ret = srs_human_print_rtmp_packet4(type, timestamp, data, size, pre_timestamp, pre_now, start_time, nb_packets++)) != 0) {
if ((ret = srs_human_format_rtmp_packet2(buffer, sizeof(buffer), type, timestamp, data, size, pre_timestamp, pre_now, start_time, nb_packets++)) != 0) {
srs_human_trace("print rtmp packet failed, ret=%d", ret);
return ret;
}
srs_human_trace("%s", buffer);
pre_timestamp = timestamp;
pre_now = srs_utils_time_ms();