diff options
author | Vadim Yanitskiy <axilirator@gmail.com> | 2017-09-06 23:42:19 +0300 |
---|---|---|
committer | Vadim Yanitskiy <axilirator@gmail.com> | 2017-12-31 12:20:59 +0100 |
commit | 5716ca636d8638060e525f428a497ddee18b4072 (patch) | |
tree | 37074ec112ef5e766b44ac28d40144e3604d9312 | |
parent | 539af39e29726fc196e874b5d9cd6ec619dc5f3c (diff) |
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.
-rw-r--r-- | src/main.c | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -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) |