From 11fc4538e3bdceff8fe5239329bb6261cd84f410 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Tue, 8 Apr 2014 23:00:41 +0200 Subject: [PATCH 1/4] Some usage improvements * note that audio scaling is done on receiver * moved RTDXT usage at the beginning to be show even if module fails --- src/main.cpp | 3 ++- src/video_compress/dxt_glsl.cpp | 18 +++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index fd7413bf7..ed1581f55 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -249,7 +249,8 @@ static void usage(void) printf("\n"); printf("\t--audio-channel-map | help\n"); printf("\n"); - printf("\t--audio-scale | | help\n"); + printf("\t--audio-scale | | help\n"); + printf("\t \tscales received audio\n"); printf("\n"); printf("\t--audio-capture-channels number of input channels that will\n"); printf("\t be captured (default 2).\n"); diff --git a/src/video_compress/dxt_glsl.cpp b/src/video_compress/dxt_glsl.cpp index 81b2b8915..81e50b4d7 100644 --- a/src/video_compress/dxt_glsl.cpp +++ b/src/video_compress/dxt_glsl.cpp @@ -205,6 +205,15 @@ struct module *dxt_glsl_compress_init(struct module *parent, const struct video_ struct state_video_compress_rtdxt *s; const char *opts = params->cfg; + if(strcmp(opts, "help") == 0) { + printf("DXT GLSL comperssion usage:\n"); + printf("\t-c RTDXT:DXT1\n"); + printf("\t\tcompress with DXT1\n"); + printf("\t-c RTDXT:DXT5\n"); + printf("\t\tcompress with DXT5 YCoCg\n"); + return &compress_init_noerr; + } + s = (struct state_video_compress_rtdxt *) calloc(1, sizeof(struct state_video_compress_rtdxt)); s->decoded = NULL; @@ -216,15 +225,6 @@ struct module *dxt_glsl_compress_init(struct module *parent, const struct video_ return NULL; } - if(strcmp(opts, "help") == 0) { - printf("DXT GLSL comperssion usage:\n"); - printf("\t-c RTDXT:DXT1\n"); - printf("\t\tcompress with DXT1\n"); - printf("\t-c RTDXT:DXT5\n"); - printf("\t\tcompress with DXT5 YCoCg\n"); - return &compress_init_noerr; - } - if (strcasecmp(opts, "DXT5") == 0) { s->color_spec = DXT5; } else if (strcasecmp(opts, "DXT1") == 0) { From d83ed205cd82e65237ea4a4b330cc1ee35a0a3d8 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Thu, 10 Apr 2014 14:35:12 +0200 Subject: [PATCH 2/4] Audio decoder: message change --- src/rtp/audio_decoders.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rtp/audio_decoders.c b/src/rtp/audio_decoders.c index bcd61a573..07a93bd68 100644 --- a/src/rtp/audio_decoders.c +++ b/src/rtp/audio_decoders.c @@ -430,8 +430,8 @@ int decode_audio_frame(struct coded_data *cdata, void *data) if(device_sample_rate == sample_rate) // no resampling device_bps = bps; - printf("New incoming audio format detected: %d Hz, %d channels, %d bits per sample, codec %s\n", - sample_rate, input_channels, bps * 8, + printf("New incoming audio format detected: %d Hz, %d channel%s, %d bits per sample, codec %s\n", + sample_rate, input_channels, input_channels == 1 ? "": "s", bps * 8, get_name_to_audio_codec(get_audio_codec_to_tag(audio_tag))); From 078a1e05841ed784bf4314f217a9afc0b4bd3484 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Thu, 10 Apr 2014 15:56:23 +0200 Subject: [PATCH 3/4] Hd-rum-translator: do not occupy port+2 --- src/hd-rum-translator/hd-rum-decompress.cpp | 4 ++-- src/hd-rum-translator/hd-rum-decompress.h | 2 +- src/hd-rum-translator/hd-rum-translator.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hd-rum-translator/hd-rum-decompress.cpp b/src/hd-rum-translator/hd-rum-decompress.cpp index 5439ddcef..7534484e3 100644 --- a/src/hd-rum-translator/hd-rum-decompress.cpp +++ b/src/hd-rum-translator/hd-rum-decompress.cpp @@ -392,7 +392,7 @@ next_iteration: return NULL; } -void *hd_rum_decompress_init(unsigned short rx_port) +void *hd_rum_decompress_init() { struct state_transcoder_decompress *s; int ttl = 255; @@ -402,7 +402,7 @@ void *hd_rum_decompress_init(unsigned short rx_port) initialize_video_decompress(); s = new state_transcoder_decompress; - s->network_device = rtp_init_if("localhost", (char *) NULL, rx_port, rx_port, ttl, + s->network_device = rtp_init_if("localhost", (char *) NULL, 0, 0, ttl, rtcp_bw, FALSE, hd_rum_receive_pkt, (uint8_t *) s, use_ipv6, false); s->my_last_ssrc = -1; diff --git a/src/hd-rum-translator/hd-rum-decompress.h b/src/hd-rum-translator/hd-rum-decompress.h index 5ef37eedd..b7626f214 100644 --- a/src/hd-rum-translator/hd-rum-decompress.h +++ b/src/hd-rum-translator/hd-rum-decompress.h @@ -3,7 +3,7 @@ extern "C" { #endif ssize_t hd_rum_decompress_write(void *state, void *buf, size_t count); -void *hd_rum_decompress_init(unsigned short rx_port); +void *hd_rum_decompress_init(); void hd_rum_decompress_done(void *state); void hd_rum_decompress_add_port(void *decompress_state, void *recompress_state); void hd_rum_decompress_add_inactive_port(void *decompress_state, void *recompress_state); diff --git a/src/hd-rum-translator/hd-rum-translator.c b/src/hd-rum-translator/hd-rum-translator.c index 03bf9aaa2..ec7f2c21b 100644 --- a/src/hd-rum-translator/hd-rum-translator.c +++ b/src/hd-rum-translator/hd-rum-translator.c @@ -490,7 +490,7 @@ int main(int argc, char **argv) } // we need only one shared receiver decompressor for all recompressing streams - state.decompress = hd_rum_decompress_init(port + 2); + state.decompress = hd_rum_decompress_init(); if(!state.decompress) { return EXIT_INIT_PORT; } From 12bcd8a25e31d182b62072494ed7006501a9dce5 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Fri, 11 Apr 2014 17:23:28 +0200 Subject: [PATCH 4/4] Hd-rum-translator: added option to set a custom port --- src/hd-rum-translator/hd-rum-translator.c | 28 +++++++++++++++-------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/hd-rum-translator/hd-rum-translator.c b/src/hd-rum-translator/hd-rum-translator.c index ec7f2c21b..44a02a6fc 100644 --- a/src/hd-rum-translator/hd-rum-translator.c +++ b/src/hd-rum-translator/hd-rum-translator.c @@ -250,8 +250,10 @@ static void usage(const char *progname) { printf("\twhere global_opts may be:\n" "\t\t--control-port - control port to connect to\n"); printf("\tand hostX_options may be:\n" + "\t\t-P - TX port to be used\n" "\t\t-c - compression\n" - "\t\t-m - MTU size. Will be used only with compression.\n" + "\t\tFollowing options will be used only if '-c' parameter is set:\n" + "\t\t-m - MTU size\n" "\t\t-l - bitrate to be shaped to\n" "\t\t-f - FEC that will be used for transmission.\n" ); @@ -259,6 +261,7 @@ static void usage(const char *progname) { struct host_opts { char *addr; + int port; int mtu; char *compression; char *fec; @@ -309,6 +312,9 @@ static void parse_fmt(int argc, char **argv, char **bufsize, unsigned short *por for(int i = 1; i < argc; ++i) { if (argv[i][0] == '-') { switch(argv[i][1]) { + case 'P': + (*host_opts)[host_idx].port = atoi(argv[i + 1]); + break; case 'm': (*host_opts)[host_idx].mtu = atoi(argv[i + 1]); break; @@ -497,33 +503,37 @@ int main(int argc, char **argv) state.host_count = host_count; for (i = 0; i < host_count; i++) { + int mtu = 1500; + if(hosts[i].mtu) { + mtu = hosts[i].mtu; + } + int tx_port = port; + if(hosts[i].port) { + tx_port = hosts[i].port; + } + state.replicas[i].magic = REPLICA_MAGIC; state.replicas[i].host = hosts[i].addr; state.replicas[i].port = port; - state.replicas[i].sock = output_socket(port, hosts[i].addr, + state.replicas[i].sock = output_socket(tx_port, hosts[i].addr, bufsize); module_init_default(&state.replicas[i].mod); state.replicas[i].mod.cls = MODULE_CLASS_PORT; if(hosts[i].compression == NULL) { state.replicas[i].type = USE_SOCK; - int mtu = 1500; char compress[] = "none"; char *fec = NULL; state.replicas[i].recompress = recompress_init(&state.replicas[i].mod, hosts[i].addr, compress, - 0, port, mtu, fec, hosts[i].packet_rate); + 0, tx_port, mtu, fec, hosts[i].packet_rate); hd_rum_decompress_add_inactive_port(state.decompress, state.replicas[i].recompress); } else { state.replicas[i].type = RECOMPRESS; - int mtu = 1500; - if(hosts[i].mtu) { - mtu = hosts[i].mtu; - } state.replicas[i].recompress = recompress_init(&state.replicas[i].mod, hosts[i].addr, hosts[i].compression, - 0, port, mtu, hosts[i].fec, hosts[i].packet_rate); + 0, tx_port, mtu, hosts[i].fec, hosts[i].packet_rate); if(state.replicas[i].recompress == 0) { fprintf(stderr, "Initializing output port '%s' failed!\n", hosts[i].addr);