mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-24 13:12:03 +00:00
FS-4781 --resolve I added some more code to the jb for seq but I still think the timestamp is more reliable than the seq since we can't know if the rtp is passing over a media proxy who may preserve the timestamps but still rewrite the seq, its more likely the ts shows the more accurate order of the rtp stream
This commit is contained in:
@@ -4,6 +4,7 @@ SILK_BUILDDIR=$(switch_builddir)/libs/silk
|
||||
LOCAL_CFLAGS=-I$(SILK_DIR)/src -I$(SILK_DIR)/interface
|
||||
SILK_LA=$(SILK_BUILDDIR)/.libs/libSKP_SILK_SDK.la
|
||||
LOCAL_LIBADD=$(SILK_LA)
|
||||
LOCAL_OBJS=$(BASE)/libs/stfu/stfu.o
|
||||
include $(BASE)/build/modmake.rules
|
||||
|
||||
$(SILK_LA): $(SILK_DIR)/.update
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
*/
|
||||
|
||||
#include "switch.h"
|
||||
#include "stfu.h"
|
||||
#include "SKP_Silk_SDK_API.h"
|
||||
|
||||
SWITCH_MODULE_LOAD_FUNCTION(mod_silk_load);
|
||||
@@ -321,23 +322,43 @@ static switch_status_t switch_silk_decode(switch_codec_t *codec,
|
||||
SKP_int16 ret, len;
|
||||
int16_t *target = decoded_data;
|
||||
switch_core_session_t *session = codec->session;
|
||||
stfu_instance_t *jb;
|
||||
stfu_instance_t *jb = NULL;
|
||||
|
||||
SKP_int lost_flag = (*flag & SFF_PLC);
|
||||
stfu_frame_t next_frame;
|
||||
|
||||
SKP_uint8 recbuff[STFU_DATALEN];
|
||||
SKP_int16 reclen;
|
||||
int32_t found_frame;
|
||||
switch_bool_t did_lbrr = SWITCH_FALSE;
|
||||
|
||||
*decoded_data_len = 0;
|
||||
|
||||
if (session) {
|
||||
jb = switch_core_session_get_jb(session, SWITCH_MEDIA_TYPE_AUDIO);
|
||||
}
|
||||
|
||||
if (jb) {
|
||||
/* to allow compile */
|
||||
jb = NULL;
|
||||
if (lost_flag) {
|
||||
if (session) {
|
||||
jb = switch_core_session_get_jb(session, SWITCH_MEDIA_TYPE_AUDIO);
|
||||
}
|
||||
if (jb && codec && codec->cur_frame) {
|
||||
for (int i = 1; i <= MAX_LBRR_DELAY; i++) {
|
||||
found_frame = stfu_n_copy_next_frame(jb, codec->cur_frame->timestamp, codec->cur_frame->seq, i, &next_frame);
|
||||
if (found_frame) {
|
||||
SKP_Silk_SDK_search_for_LBRR(next_frame.data, next_frame.dlen, i, (SKP_uint8*) &recbuff, &reclen);
|
||||
if (reclen) {
|
||||
encoded_data = &recbuff;
|
||||
encoded_data_len = reclen;
|
||||
lost_flag = SKP_FALSE;
|
||||
did_lbrr = SWITCH_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
do {
|
||||
ret = SKP_Silk_SDK_Decode(context->dec_state,
|
||||
&context->decoder_object,
|
||||
((*flag & SFF_PLC)),
|
||||
lost_flag,
|
||||
encoded_data,
|
||||
encoded_data_len,
|
||||
target,
|
||||
@@ -345,6 +366,8 @@ static switch_status_t switch_silk_decode(switch_codec_t *codec,
|
||||
if (ret){
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SKP_Silk_Decode returned %d!\n", ret);
|
||||
printSilkError(ret);
|
||||
/* if FEC was activated, we can ignore bit errors*/
|
||||
if (! (ret == SKP_SILK_DEC_PAYLOAD_ERROR && did_lbrr))
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user