From 5716ca636d8638060e525f428a497ddee18b4072 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Wed, 6 Sep 2017 23:42:19 +0300 Subject: osmo-gapk: add an option to enable / disable benchmark If the codec benchmarking is required in particular case, it could be activated by a special command line option introduced by this change. --- src/main.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 3596ec1..661f246 100644 --- a/src/main.c +++ b/src/main.c @@ -56,6 +56,8 @@ struct gapk_options } rtp_out; const char *alsa_out; const struct osmo_gapk_format_desc *fmt_out; + + int benchmark; }; struct gapk_state @@ -104,6 +106,7 @@ print_help(char *progname) #endif fprintf(stdout, " -f, --input-format=FMT\tInput format (see below)\n"); fprintf(stdout, " -g, --output-format=FMT\tOutput format (see below)\n"); + fprintf(stdout, " -b, --enable-benchmark\tEnable codec benchmarking\n"); fprintf(stdout, "\n"); /* Print all codecs */ @@ -172,9 +175,10 @@ parse_options(struct gapk_state *state, int argc, char *argv[]) #endif {"input-format", 1, 0, 'f'}, {"output-format", 1, 0, 'g'}, + {"enable-benchmark", 0, 0, 'b'}, {"help", 0, 0, 'h'}, }; - const char *short_options = "i:o:I:O:f:g:h" + const char *short_options = "i:o:I:O:f:g:bh" #ifdef HAVE_ALSA "a:A:" #endif @@ -246,6 +250,10 @@ parse_options(struct gapk_state *state, int argc, char *argv[]) } break; + case 'b': + opt->benchmark = 1; + break; + case 'h': return 1; @@ -502,7 +510,8 @@ make_processing_chain(struct gapk_state *gs) osmo_gapk_pq_queue_codec(gs->pq, codec_in, 0); /* Allocate memory for benchmarking */ - osmo_gapk_bench_enable(fmt_in->codec_type); + if (gs->opts.benchmark) + osmo_gapk_bench_enable(fmt_in->codec_type); } else if (fmt_in->type != fmt_out->type) { @@ -517,7 +526,8 @@ make_processing_chain(struct gapk_state *gs) osmo_gapk_pq_queue_codec(gs->pq, codec_out, 1); /* Allocate memory for benchmarking */ - osmo_gapk_bench_enable(fmt_out->codec_type); + if (gs->opts.benchmark) + osmo_gapk_bench_enable(fmt_out->codec_type); /* Convert encoder output to output fmt */ if (fmt_out->type != codec_out->codec_enc_format_type) -- cgit v1.2.3