From 8a5bbe19e8363c05a0ef5842839b4270fe8fb30e Mon Sep 17 00:00:00 2001 From: Seven Du Date: Mon, 4 Dec 2017 22:14:52 +0800 Subject: [PATCH] [mod_shout] use 0xFFFFFFFF flag to query frame_size --- src/mod/formats/mod_shout/mod_shout.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/mod/formats/mod_shout/mod_shout.c b/src/mod/formats/mod_shout/mod_shout.c index 942f1ff6d2..99ea757700 100644 --- a/src/mod/formats/mod_shout/mod_shout.c +++ b/src/mod/formats/mod_shout/mod_shout.c @@ -1683,6 +1683,17 @@ static switch_status_t switch_mp3_encode(switch_codec_t *codec, return SWITCH_STATUS_FALSE; } + if (flag && *flag == 0xFFFFFFFF) { // query frame_size + *(uint32_t *)encoded_data = lame_get_framesize(context->gfp); + *encoded_data_len = sizeof(uint32_t); + return SWITCH_STATUS_SUCCESS; + } + + if (decoded_data_len == 0) { // flush encoder buffer + *encoded_data_len = lame_encode_flush(context->gfp, encoded_data, *encoded_data_len); + return SWITCH_STATUS_SUCCESS; + } + if (codec->implementation->number_of_channels == 2) { len = lame_encode_buffer_interleaved(context->gfp, decoded_data, decoded_data_len / 4, encoded_data, *encoded_data_len); } else {