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

@ -129,6 +129,8 @@ int proxy(srs_rtmp_t irtmp, srs_rtmp_t ortmp)
} else {
srs_human_verbose("start proxy RTMP stream");
}
char buffer[1024];
for (;;) {
if ((ret = srs_rtmp_read_packet(irtmp, &type, &timestamp, &data, &size)) != 0) {
srs_human_trace("irtmp get packet failed. ret=%d", ret);
@ -146,10 +148,11 @@ int proxy(srs_rtmp_t irtmp, srs_rtmp_t ortmp)
}
if (verbose || ((nb_msgs++ % PITHY_PRINT_EVERY_MSGS) == 0 && nb_msgs > 10)) {
if ((ret = srs_human_print_rtmp_packet(type, timestamp, data, size)) != 0) {
if ((ret = srs_human_format_rtmp_packet(buffer, sizeof(buffer), type, timestamp, data, size)) != 0) {
srs_human_trace("print packet failed. ret=%d", ret);
return ret;
}
srs_human_trace("%s", buffer);
}
if ((ret = srs_rtmp_write_packet(ortmp, type, timestamp, data, size)) != 0) {