diff options
author | Joshua Colp <jcolp@digium.com> | 2016-11-16 17:40:36 -0600 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2016-11-16 17:40:36 -0600 |
commit | 19ca0e7fc86cdcdfcc48a31b73f407453e18c492 (patch) | |
tree | 254a7513535123b73009cc6dcb4a688a9da77d9b | |
parent | b745c326c2d59a4ac29d62f081e248320a276f82 (diff) | |
parent | ed0f1afc8cea8918171a1aabc9b6885bba41e3c4 (diff) |
Merge "codec_opus: Fix warning when Opus negotiated but codec_opus not loaded." into 13
-rw-r--r-- | main/codec_builtin.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/main/codec_builtin.c b/main/codec_builtin.c index 973423d55..da03cce6b 100644 --- a/main/codec_builtin.c +++ b/main/codec_builtin.c @@ -701,6 +701,21 @@ static struct ast_codec g719 = { .get_length = g719_length, }; +static int opus_samples(struct ast_frame *frame) +{ + /* + * XXX This is likely not at all what's intended from this + * callback. If you have codec_opus.so loaded then this + * function is overridden anyway. However, since opus is + * variable bit rate and I cannot extract the calculation code + * from the opus library, I am going to punt and assume 20ms + * worth of samples. In testing, this has worked just fine. + * Pass through support doesn't seem to care about the value + * returned anyway. + */ + return ast_format_get_sample_rate(frame->subclass.format) / 50; +} + static struct ast_codec opus = { .name = "opus", .description = "Opus Codec", @@ -709,6 +724,7 @@ static struct ast_codec opus = { .minimum_ms = 20, .maximum_ms = 60, .default_ms = 20, + .samples_count = opus_samples, .minimum_bytes = 10, }; |