Port video buffer to also support audio and remove original STFU jitter buffer
Add some more resilience to video packet loss
Add codec control mechanism for both call-specific debug and codec/call specfic params
Make opus function better in packet loss and latent situations
Use new codec control prams to make JB lookahead FEC optionally enabled or disabled mid-call
Add Param to allow JB lookahead to be enabled.
This commit is contained in:
Anthony Minessale 2015-09-11 11:37:01 -05:00
parent c195ee4c60
commit eea76c8856
36 changed files with 1888 additions and 2532 deletions

View File

@ -224,7 +224,7 @@ library_include_HEADERS = \
src/include/switch_types.h \
src/include/switch_utils.h \
src/include/switch_rtp.h \
src/include/switch_vidderbuffer.h \
src/include/switch_jitterbuffer.h \
src/include/switch_rtcp_frame.h \
src/include/switch_stun.h \
src/include/switch_nat.h \
@ -234,7 +234,6 @@ library_include_HEADERS = \
src/include/switch_cpp.h \
src/include/switch_curl.h \
src/include/switch_json.h \
src/include/switch_stfu.h \
src/include/switch_utf8.h \
src/include/switch_vpx.h \
libs/libteletone/src/libteletone_detect.h \
@ -290,7 +289,7 @@ libfreeswitch_la_SOURCES = \
src/switch_resample.c \
src/switch_regex.c \
src/switch_rtp.c \
src/switch_vidderbuffer.c \
src/switch_jitterbuffer.c \
src/switch_ivr_bridge.c \
src/switch_ivr_originate.c \
src/switch_ivr_async.c \
@ -315,7 +314,6 @@ libfreeswitch_la_SOURCES = \
src/switch_json.c \
src/switch_curl.c \
src/switch_hashtable.c\
src/switch_stfu.c \
src/switch_utf8.c \
libs/libtpl-1.5/src/tpl.c \
libs/libteletone/src/libteletone_detect.c \

View File

@ -9,7 +9,7 @@
<!--<param name="asymmetric-sample-rates" value="1"/>-->
<!-- Keep FEC Enabled -->
<param name="keep-fec-enabled" value="1"/>
<!--<param name="use-jb-lookahead" value="true"/> -->
<!--
maxaveragebitrate: the maximum average codec bitrate (values: 6000 to 510000 in bps) 0 is not considered
maxplaybackrate: the maximum codec internal frequency (values: 8000, 12000, 16000, 24000, 48000 in Hz) 0 is not considered

View File

@ -1279,9 +1279,6 @@ PREDEFINED =SWITCH_DECLARE(type)=type \
SPAN_DECLARE(type)=type \
SPAN_DECLARE_NONSTD(type)=type \
SPAN_DECLARE_DATA= \
STFU_DECLARE(type)=type \
STFU_DECLARE_NONSTD(type)=type \
STFU_DECLARE_DATA= \
FT_DECLARE(type)=type \
FT_DECLARE_NONSTD(type)=type \
FT_DECLARE_INLINE(type)=type \

View File

@ -52,7 +52,6 @@ switch_log.c
switch_xml.c
switch_config.c
switch_time.c
switch_stfu.c
switch_cpp.cpp
g711.c
switch_pcm.c

View File

@ -111,7 +111,6 @@
#include "switch_platform.h"
#include "switch_types.h"
#include "switch_stfu.h"
#include "switch_apr.h"
#include "switch_mprintf.h"
#include "switch_core_db.h"
@ -144,6 +143,7 @@
#include "switch_limit.h"
#include "switch_core_media.h"
#include "switch_core_video.h"
#include "switch_jitterbuffer.h"
#include <libteletone.h>

View File

@ -861,7 +861,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_loglevel(switch_core_ses
*/
SWITCH_DECLARE(switch_log_level_t) switch_core_session_get_loglevel(switch_core_session_t *session);
SWITCH_DECLARE(stfu_instance_t *) switch_core_session_get_jb(switch_core_session_t *session, switch_media_type_t type);
SWITCH_DECLARE(switch_jb_t *) switch_core_session_get_jb(switch_core_session_t *session, switch_media_type_t type);
SWITCH_DECLARE(void) switch_core_session_soft_lock(switch_core_session_t *session, uint32_t sec);
SWITCH_DECLARE(void) switch_core_session_soft_unlock(switch_core_session_t *session);
SWITCH_DECLARE(void) switch_core_session_set_dmachine(switch_core_session_t *session, switch_ivr_dmachine_t *dmachine, switch_digit_action_target_t target);
@ -1651,6 +1651,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_encode_video(switch_codec_t *c
\param cmd the command to send
\param ctype the type of the arguement
\param cmd_data a void pointer to the data matching the passed type
\param atype the type of the extra arguement
\param cmd_arg a void pointer to the data matching the passed type
\param rtype the type of the response if any
\param ret_data a void pointer to a pointer of return data
\return SWITCH_STATUS_SUCCESS if the command was received
@ -1659,6 +1661,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_control(switch_codec_t *codec,
switch_codec_control_command_t cmd,
switch_codec_control_type_t ctype,
void *cmd_data,
switch_codec_control_type_t atype,
void *cmd_arg,
switch_codec_control_type_t *rtype,
void **ret_data);

View File

@ -253,7 +253,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_udptl_mode(switch_core_session
SWITCH_DECLARE(void) switch_core_media_set_rtp_flag(switch_core_session_t *session, switch_media_type_t type, switch_rtp_flag_t flag);
SWITCH_DECLARE(void) switch_core_media_clear_rtp_flag(switch_core_session_t *session, switch_media_type_t type, switch_rtp_flag_t flag);
SWITCH_DECLARE(stfu_instance_t *) switch_core_media_get_jb(switch_core_session_t *session, switch_media_type_t type);
SWITCH_DECLARE(switch_jb_t *) switch_core_media_get_jb(switch_core_session_t *session, switch_media_type_t type);
SWITCH_DECLARE(switch_rtp_stats_t *) switch_core_media_get_stats(switch_core_session_t *session, switch_media_type_t type, switch_memory_pool_t *pool);
@ -307,15 +307,17 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_codec_control(switch_core_sess
switch_codec_control_command_t cmd,
switch_codec_control_type_t ctype,
void *cmd_data,
switch_codec_control_type_t atype,
void *cmd_arg,
switch_codec_control_type_t *rtype,
void **ret_data);
#define switch_core_media_gen_key_frame(_session) switch_core_media_codec_control(_session, SWITCH_MEDIA_TYPE_VIDEO, SWITCH_IO_WRITE, \
SCC_VIDEO_REFRESH, SCCT_NONE, NULL, NULL, NULL) \
SCC_VIDEO_REFRESH, SCCT_NONE, NULL, SCCT_NONE, NULL, NULL, NULL) \
#define switch_core_media_write_bandwidth(_session, _val) switch_core_media_codec_control(_session, SWITCH_MEDIA_TYPE_VIDEO, SWITCH_IO_WRITE, \
SCC_VIDEO_BANDWIDTH, SCCT_STRING, _val, NULL, NULL) \
SCC_VIDEO_BANDWIDTH, SCCT_STRING, _val, SCCT_NONE, NULL, NULL, NULL) \
SWITCH_DECLARE(switch_timer_t *) switch_core_media_get_timer(switch_core_session_t *session, switch_media_type_t mtype);

View File

@ -0,0 +1,79 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
*
* The Initial Developer of the Original Code is
* Anthony Minessale II <anthm@freeswitch.org>
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Anthony Minessale II <anthm@freeswitch.org>
*
* switch_jitterbuffer.h -- Audio/Video Jitter Buffer
*
*/
#ifndef SWITCH_VIDDERBUFFER_H
#define SWITCH_VIDDERBUFFER_H
typedef enum {
SJB_QUEUE_ONLY = (1 << 0)
} switch_jb_flag_t;
typedef enum {
SJB_VIDEO = 0,
SJB_AUDIO
} switch_jb_type_t;
SWITCH_BEGIN_EXTERN_C
SWITCH_DECLARE(switch_status_t) switch_jb_create(switch_jb_t **jbp, switch_jb_type_t type,
uint32_t min_frame_len, uint32_t max_frame_len, switch_memory_pool_t *pool);
SWITCH_DECLARE(switch_status_t) switch_jb_set_frames(switch_jb_t *jb, uint32_t min_frame_len, uint32_t max_frame_len);
SWITCH_DECLARE(switch_status_t) switch_jb_peek_frame(switch_jb_t *jb, uint16_t seq, int peek, switch_frame_t *frame);
SWITCH_DECLARE(switch_status_t) switch_jb_get_frames(switch_jb_t *jb, uint32_t *min_frame_len, uint32_t *max_frame_len, uint32_t *cur_frame_len, uint32_t *highest_frame_len);
SWITCH_DECLARE(switch_status_t) switch_jb_destroy(switch_jb_t **jbp);
SWITCH_DECLARE(void) switch_jb_reset(switch_jb_t *jb);
SWITCH_DECLARE(void) switch_jb_debug_level(switch_jb_t *jb, uint8_t level);
SWITCH_DECLARE(int) switch_jb_frame_count(switch_jb_t *jb);
SWITCH_DECLARE(int) switch_jb_poll(switch_jb_t *jb);
SWITCH_DECLARE(switch_status_t) switch_jb_push_packet(switch_jb_t *jb, switch_rtp_packet_t *packet, switch_size_t len);
SWITCH_DECLARE(switch_status_t) switch_jb_put_packet(switch_jb_t *jb, switch_rtp_packet_t *packet, switch_size_t len);
SWITCH_DECLARE(switch_size_t) switch_jb_get_last_read_len(switch_jb_t *jb);
SWITCH_DECLARE(switch_status_t) switch_jb_get_packet(switch_jb_t *jb, switch_rtp_packet_t *packet, switch_size_t *len);
SWITCH_DECLARE(uint32_t) switch_jb_pop_nack(switch_jb_t *jb);
SWITCH_DECLARE(switch_status_t) switch_jb_get_packet_by_seq(switch_jb_t *jb, uint16_t seq, switch_rtp_packet_t *packet, switch_size_t *len);
SWITCH_DECLARE(void) switch_jb_set_session(switch_jb_t *jb, switch_core_session_t *session);
SWITCH_DECLARE(void) switch_jb_set_flag(switch_jb_t *jb, switch_jb_flag_t flag);
SWITCH_DECLARE(void) switch_jb_clear_flag(switch_jb_t *jb, switch_jb_flag_t flag);
SWITCH_END_EXTERN_C
#endif
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -119,7 +119,7 @@ typedef switch_status_t (*switch_io_state_change_t) (switch_core_session_t *);
typedef switch_status_t (*switch_io_state_run_t) (switch_core_session_t *);
typedef switch_status_t (*switch_io_read_video_frame_t) (switch_core_session_t *, switch_frame_t **, switch_io_flag_t, int);
typedef switch_status_t (*switch_io_write_video_frame_t) (switch_core_session_t *, switch_frame_t *, switch_io_flag_t, int);
typedef stfu_instance_t *(*switch_io_get_jb_t) (switch_core_session_t *, switch_media_type_t);
typedef switch_jb_t *(*switch_io_get_jb_t) (switch_core_session_t *, switch_media_type_t);
typedef enum {
SWITCH_IO_OUTGOING_CHANNEL,

View File

@ -128,6 +128,7 @@ typedef int gid_t;
#include <arpa/inet.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#endif // _MSC_VER
#ifndef __LITTLE_ENDIAN
#define __LITTLE_ENDIAN 1234

View File

@ -328,8 +328,8 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_rtcp(switch_rtp_t *rtp_sessi
SWITCH_DECLARE(switch_timer_t *) switch_rtp_get_media_timer(switch_rtp_t *rtp_session);
SWITCH_DECLARE(switch_status_t) switch_rtp_set_video_buffer_size(switch_rtp_t *rtp_session, uint32_t frames);
SWITCH_DECLARE(uint32_t) switch_rtp_get_video_buffer_size(switch_rtp_t *rtp_session);
SWITCH_DECLARE(switch_status_t) switch_rtp_set_video_buffer_size(switch_rtp_t *rtp_session, uint32_t frames, uint32_t max_frames);
SWITCH_DECLARE(switch_status_t) switch_rtp_get_video_buffer_size(switch_rtp_t *rtp_session, uint32_t *min_frame_len, uint32_t *max_frame_len, uint32_t *cur_frame_len, uint32_t *highest_frame_len);
/*!
\brief Acvite a jitter buffer on an RTP session
@ -340,13 +340,13 @@ SWITCH_DECLARE(uint32_t) switch_rtp_get_video_buffer_size(switch_rtp_t *rtp_sess
SWITCH_DECLARE(switch_status_t) switch_rtp_activate_jitter_buffer(switch_rtp_t *rtp_session,
uint32_t queue_frames,
uint32_t max_queue_frames,
uint32_t samples_per_packet, uint32_t samples_per_second, uint32_t max_drift);
uint32_t samples_per_packet, uint32_t samples_per_second);
SWITCH_DECLARE(switch_status_t) switch_rtp_debug_jitter_buffer(switch_rtp_t *rtp_session, const char *name);
SWITCH_DECLARE(switch_status_t) switch_rtp_deactivate_jitter_buffer(switch_rtp_t *rtp_session);
SWITCH_DECLARE(switch_status_t) switch_rtp_pause_jitter_buffer(switch_rtp_t *rtp_session, switch_bool_t pause);
SWITCH_DECLARE(stfu_instance_t *) switch_rtp_get_jitter_buffer(switch_rtp_t *rtp_session);
SWITCH_DECLARE(switch_jb_t *) switch_rtp_get_jitter_buffer(switch_rtp_t *rtp_session);

View File

@ -1,206 +0,0 @@
/*
* STFU (S)ort (T)ransportable (F)ramed (U)tterances
* Copyright (c) 2007-2014 Anthony Minessale II <anthm@freeswitch.org>
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* THOSE WHO DISAGREE MAY CERTAINLY STFU
*/
#ifndef STFU_H
#define STFU_H
#include <switch.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __STUPIDFORMATBUG__
}
#endif
#if !defined(MACOSX) && !defined(_XOPEN_SOURCE) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__cplusplus)
#define _XOPEN_SOURCE 600
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#if (_MSC_VER >= 1400) // VC8+
#define stfu_assert(expr) assert(expr);__analysis_assume( expr )
#endif
#ifndef stfu_assert
#define stfu_assert(_x) assert(_x)
#endif
#ifdef _MSC_VER
#if _MSC_VER < 1900
#if !defined(_STDINT) && !defined(uint32_t)
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
typedef __int8 int8_t;
typedef __int16 int16_t;
typedef __int32 int32_t;
typedef __int64 int64_t;
typedef unsigned long in_addr_t;
#endif
#define snprintf _snprintf
#endif
#else
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>
#include <inttypes.h>
#endif
#include <assert.h>
#ifdef WIN32
#include <winsock2.h>
#include <windows.h>
typedef SOCKET stfu_socket_t;
#ifndef _STDINT
typedef unsigned __int64 uint64_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int8 uint8_t;
typedef __int64 int64_t;
typedef __int32 int32_t;
typedef __int16 int16_t;
typedef __int8 int8_t;
#endif
typedef intptr_t stfu_ssize_t;
typedef int stfu_filehandle_t;
#define STFU_SOCK_INVALID INVALID_SOCKET
#define strerror_r(num, buf, size) strerror_s(buf, size, num)
#else
#include <stdint.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <stdarg.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#define STFU_SOCK_INVALID -1
typedef int stfu_socket_t;
typedef ssize_t stfu_ssize_t;
typedef int stfu_filehandle_t;
#endif
#define STFU_PRE __FILE__, __SWITCH_FUNC__, __LINE__
#define STFU_LOG_LEVEL_DEBUG 7
#define STFU_LOG_LEVEL_INFO 6
#define STFU_LOG_LEVEL_NOTICE 5
#define STFU_LOG_LEVEL_WARNING 4
#define STFU_LOG_LEVEL_ERROR 3
#define STFU_LOG_LEVEL_CRIT 2
#define STFU_LOG_LEVEL_ALERT 1
#define STFU_LOG_LEVEL_EMERG 0
#define STFU_LOG_DEBUG STFU_PRE, STFU_LOG_LEVEL_DEBUG
#define STFU_LOG_INFO STFU_PRE, STFU_LOG_LEVEL_INFO
#define STFU_LOG_NOTICE STFU_PRE, STFU_LOG_LEVEL_NOTICE
#define STFU_LOG_WARNING STFU_PRE, STFU_LOG_LEVEL_WARNING
#define STFU_LOG_ERROR STFU_PRE, STFU_LOG_LEVEL_ERROR
#define STFU_LOG_CRIT STFU_PRE, STFU_LOG_LEVEL_CRIT
#define STFU_LOG_ALERT STFU_PRE, STFU_LOG_LEVEL_ALERT
#define STFU_LOG_EMERG STFU_PRE, STFU_LOG_LEVEL_EMERG
typedef void (*stfu_logger_t)(const char *file, const char *func, int line, int level, const char *fmt, ...);
int stfu_vasprintf(char **ret, const char *fmt, va_list ap);
extern stfu_logger_t stfu_log;
/*! Sets the logger for libstfu. Default is the null_logger */
void stfu_global_set_logger(stfu_logger_t logger);
/*! Sets the default log level for libstfu */
void stfu_global_set_default_logger(int level);
#define STFU_DATALEN 16384
#define STFU_QLEN 300
#define STFU_MAX_TRACK 256
typedef enum {
STFU_IT_FAILED,
STFU_IT_WORKED,
STFU_IM_DONE,
STFU_ITS_TOO_LATE
} stfu_status_t;
struct stfu_frame {
uint32_t ts;
uint16_t seq;
uint32_t pt;
uint8_t data[STFU_DATALEN];
size_t dlen;
uint8_t was_read;
uint8_t plc;
};
typedef struct stfu_frame stfu_frame_t;
struct stfu_instance;
typedef struct stfu_instance stfu_instance_t;
typedef struct {
uint32_t qlen;
uint32_t packet_in_count;
uint32_t clean_count;
uint32_t consecutive_good_count;
uint32_t consecutive_bad_count;
double period_jitter_percent;
double period_missing_percent;
} stfu_report_t;
typedef void (*stfu_n_call_me_t)(stfu_instance_t *i, void *);
void stfu_n_report(stfu_instance_t *i, stfu_report_t *r);
void stfu_n_destroy(stfu_instance_t **i);
stfu_instance_t *stfu_n_init(uint32_t qlen, uint32_t max_qlen, uint32_t samples_per_packet, uint32_t samples_per_second, uint32_t max_drift_ms);
stfu_status_t _stfu_n_resize(stfu_instance_t *i, uint32_t qlen, int line);
#define stfu_n_resize(_i, _ql) _stfu_n_resize(_i, _ql, __LINE__)
stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint16_t seq, uint32_t pt, void *data, size_t datalen, uint32_t timer_ts, int last);
stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i);
SWITCH_DECLARE(int32_t) stfu_n_peek_frame(stfu_instance_t *jb, uint32_t timestamp, uint16_t seq, uint16_t distance, stfu_frame_t **rframe);
void _stfu_n_reset(stfu_instance_t *i, const char *file, const char *func, int line);
#define stfu_n_reset(_i) _stfu_n_reset(_i, STFU_PRE)
stfu_status_t stfu_n_sync(stfu_instance_t *i, uint32_t packets);
void stfu_n_call_me(stfu_instance_t *i, stfu_n_call_me_t callback, void *udata);
void stfu_n_debug(stfu_instance_t *i, const char *name);
int32_t stfu_n_get_drift(stfu_instance_t *i);
int32_t stfu_n_get_most_qlen(stfu_instance_t *i);
#define stfu_im_done(i) stfu_n_add_data(i, 0, 0, NULL, 0, 0, 1)
#define stfu_n_eat(i,t,s,p,d,l,tt) stfu_n_add_data(i, t, s, p, d, l, tt, 0)
#ifdef __cplusplus
}
#endif
#endif /*STFU_H*/

View File

@ -1077,6 +1077,8 @@ typedef enum {
SWITCH_MESSAGE_INDICATE_HARD_MUTE,
SWITCH_MESSAGE_INDICATE_BITRATE_REQ,
SWITCH_MESSAGE_INDICATE_BITRATE_ACK,
SWITCH_MESSAGE_INDICATE_CODEC_DEBUG_REQ,
SWITCH_MESSAGE_INDICATE_CODEC_SPECIFIC_REQ,
SWITCH_MESSAGE_REFER_EVENT,
SWITCH_MESSAGE_ANSWER_EVENT,
SWITCH_MESSAGE_PROGRESS_EVENT,
@ -1473,6 +1475,7 @@ typedef enum {
CF_3PCC,
CF_VIDEO_PASSIVE,
CF_NOVIDEO,
CF_VIDEO_BITRATE_UNMANAGABLE,
CF_VIDEO_ECHO,
CF_VIDEO_BLANK,
CF_SLA_INTERCEPT,
@ -2243,7 +2246,9 @@ typedef enum {
SCC_VIDEO_REFRESH = 0,
SCC_VIDEO_BANDWIDTH,
SCC_VIDEO_RESET,
SCC_AUDIO_PACKET_LOSS
SCC_AUDIO_PACKET_LOSS,
SCC_DEBUG,
SCC_CODEC_SPECIFIC
} switch_codec_control_command_t;
typedef enum {
@ -2261,6 +2266,8 @@ typedef switch_status_t (*switch_core_codec_control_func_t) (switch_codec_t *cod
switch_codec_control_command_t cmd,
switch_codec_control_type_t ctype,
void *cmd_data,
switch_codec_control_type_t atype,
void *cmd_arg,
switch_codec_control_type_t *rtype,
void **ret_data);
@ -2554,8 +2561,8 @@ typedef struct switch_waitlist_s {
uint32_t revents;
} switch_waitlist_t;
struct switch_vb_s;
typedef struct switch_vb_s switch_vb_t;
struct switch_jb_s;
typedef struct switch_jb_s switch_jb_t;
struct switch_img_txt_handle_s;
typedef struct switch_img_txt_handle_s switch_img_txt_handle_t;

View File

@ -1,70 +0,0 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
*
* The Initial Developer of the Original Code is
* Anthony Minessale II <anthm@freeswitch.org>
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Anthony Minessale II <anthm@freeswitch.org>
*
* switch_vidderbuffer.h -- Video Buffer
*
*/
#ifndef SWITCH_VIDDERBUFFER_H
#define SWITCH_VIDDERBUFFER_H
typedef enum {
SVB_QUEUE_ONLY = (1 << 0)
} switch_vb_flag_t;
SWITCH_BEGIN_EXTERN_C
SWITCH_DECLARE(switch_status_t) switch_vb_create(switch_vb_t **vbp, uint32_t min_frame_len, uint32_t max_frame_len, switch_memory_pool_t *pool);
SWITCH_DECLARE(switch_status_t) switch_vb_set_frames(switch_vb_t *vb, uint32_t min_frame_len, uint32_t max_frame_len);
SWITCH_DECLARE(switch_status_t) switch_vb_get_frames(switch_vb_t *vb, uint32_t *min_frame_len, uint32_t *max_frame_len);
SWITCH_DECLARE(switch_status_t) switch_vb_destroy(switch_vb_t **vbp);
SWITCH_DECLARE(void) switch_vb_reset(switch_vb_t *vb);
SWITCH_DECLARE(void) switch_vb_debug_level(switch_vb_t *vb, uint8_t level);
SWITCH_DECLARE(int) switch_vb_frame_count(switch_vb_t *vb);
SWITCH_DECLARE(int) switch_vb_poll(switch_vb_t *vb);
SWITCH_DECLARE(switch_status_t) switch_vb_push_packet(switch_vb_t *vb, switch_rtp_packet_t *packet, switch_size_t len);
SWITCH_DECLARE(switch_status_t) switch_vb_put_packet(switch_vb_t *vb, switch_rtp_packet_t *packet, switch_size_t len);
SWITCH_DECLARE(switch_status_t) switch_vb_get_packet(switch_vb_t *vb, switch_rtp_packet_t *packet, switch_size_t *len);
SWITCH_DECLARE(uint32_t) switch_vb_pop_nack(switch_vb_t *vb);
SWITCH_DECLARE(switch_status_t) switch_vb_get_packet_by_seq(switch_vb_t *vb, uint16_t seq, switch_rtp_packet_t *packet, switch_size_t *len);
SWITCH_DECLARE(void) switch_vb_set_flag(switch_vb_t *vb, switch_vb_flag_t flag);
SWITCH_DECLARE(void) switch_vb_clear_flag(switch_vb_t *vb, switch_vb_flag_t flag);
SWITCH_END_EXTERN_C
#endif
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -1284,6 +1284,8 @@ static switch_status_t switch_h264_control(switch_codec_t *codec,
switch_codec_control_command_t cmd,
switch_codec_control_type_t ctype,
void *cmd_data,
switch_codec_control_type_t atype,
void *cmd_arg,
switch_codec_control_type_t *rtype,
void **ret_data) {

View File

@ -4086,6 +4086,100 @@ SWITCH_STANDARD_API(uuid_video_bitrate_function)
return SWITCH_STATUS_SUCCESS;
}
#define CODEC_DEBUG_SYNTAX "<uuid> audio|video <level>"
SWITCH_STANDARD_API(uuid_codec_debug_function)
{
switch_status_t status = SWITCH_STATUS_FALSE;
char *mycmd = NULL, *argv[3] = { 0 };
int argc = 0;
if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
if (argc < 3) {
stream->write_function(stream, "-USAGE: %s\n", CODEC_DEBUG_SYNTAX);
} else {
switch_core_session_t *lsession = NULL;
if ((lsession = switch_core_session_locate(argv[0]))) {
int level = atoi(argv[2]);
switch_media_type_t type = SWITCH_MEDIA_TYPE_AUDIO;
switch_core_session_message_t msg = { 0 };
if (!strcasecmp(argv[1], "video")) {
type = SWITCH_MEDIA_TYPE_VIDEO;
}
if (level < 0) level = 0;
msg.message_id = SWITCH_MESSAGE_INDICATE_CODEC_DEBUG_REQ;
msg.numeric_arg = level;
msg.numeric_reply = type;
msg.from = __FILE__;
switch_core_session_receive_message(lsession, &msg);
status = SWITCH_STATUS_SUCCESS;
switch_core_session_rwunlock(lsession);
}
}
if (status == SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "+OK Success\n");
} else {
stream->write_function(stream, "-ERR Operation Failed\n");
}
switch_safe_free(mycmd);
return SWITCH_STATUS_SUCCESS;
}
#define CODEC_PARAM_SYNTAX "<uuid> audio|video read|write <param> <val>"
SWITCH_STANDARD_API(uuid_codec_param_function)
{
switch_status_t status = SWITCH_STATUS_FALSE;
char *mycmd = NULL, *argv[5] = { 0 };
int argc = 0;
switch_core_session_message_t msg = { 0 };
msg.string_array_arg[4] = "NOT SENT";
if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
if (argc < 3) {
stream->write_function(stream, "-USAGE: %s\n", CODEC_PARAM_SYNTAX);
} else {
switch_core_session_t *lsession = NULL;
if ((lsession = switch_core_session_locate(argv[0]))) {
msg.message_id = SWITCH_MESSAGE_INDICATE_CODEC_SPECIFIC_REQ;
msg.string_array_arg[0] = argv[1];
msg.string_array_arg[1] = argv[2];
msg.string_array_arg[2] = argv[3];
msg.string_array_arg[3] = argv[4];
msg.from = __FILE__;
switch_core_session_receive_message(lsession, &msg);
status = SWITCH_STATUS_SUCCESS;
switch_core_session_rwunlock(lsession);
}
}
if (status == SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "+OK Command sent reply: [%s]\n", msg.string_array_arg[4]);
} else {
stream->write_function(stream, "-ERR Operation Failed [%s]\n", msg.string_array_arg[4]);
}
switch_safe_free(mycmd);
return SWITCH_STATUS_SUCCESS;
}
#define DEBUG_MEDIA_SYNTAX "<uuid> <read|write|both|vread|vwrite|vboth|all> <on|off>"
SWITCH_STANDARD_API(uuid_debug_media_function)
@ -6967,6 +7061,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
SWITCH_ADD_API(commands_api_interface, "uuid_broadcast", "Execute dialplan application", uuid_broadcast_function, BROADCAST_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "uuid_buglist", "List media bugs on a session", uuid_buglist_function, BUGLIST_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "uuid_chat", "Send a chat message", uuid_chat, UUID_CHAT_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "uuid_codec_debug", "Send codec a debug message", uuid_codec_debug_function, CODEC_DEBUG_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "uuid_codec_param", "Send codec a param", uuid_codec_param_function, CODEC_PARAM_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "uuid_debug_media", "Debug media", uuid_debug_media_function, DEBUG_MEDIA_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "uuid_deflect", "Send a deflect", uuid_deflect, UUID_DEFLECT_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "uuid_displace", "Displace audio", session_displace_function, "<uuid> [start|stop] <path> [<limit>] [mux]");
@ -7144,6 +7240,12 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
switch_console_set_complete("add uuid_broadcast ::console::list_uuid");
switch_console_set_complete("add uuid_buglist ::console::list_uuid");
switch_console_set_complete("add uuid_chat ::console::list_uuid");
switch_console_set_complete("add uuid_codec_debug ::console::list_uuid audio");
switch_console_set_complete("add uuid_codec_debug ::console::list_uuid video");
switch_console_set_complete("add uuid_codec_param ::console::list_uuid audio read");
switch_console_set_complete("add uuid_codec_param ::console::list_uuid audio write");
switch_console_set_complete("add uuid_codec_param ::console::list_uuid video read");
switch_console_set_complete("add uuid_codec_param ::console::list_uuid video write");
switch_console_set_complete("add uuid_debug_media ::console::list_uuid");
switch_console_set_complete("add uuid_deflect ::console::list_uuid");
switch_console_set_complete("add uuid_displace ::console::list_uuid");

View File

@ -1219,12 +1219,12 @@ void conference_video_write_canvas_image_to_codec_group(conference_obj_t *confer
if (need_reset) {
int type = 1; // sum flags: 1 encoder; 2; decoder
switch_core_codec_control(&codec_set->codec, SCC_VIDEO_RESET, SCCT_INT, (void *)&type, NULL, NULL);
switch_core_codec_control(&codec_set->codec, SCC_VIDEO_RESET, SCCT_INT, (void *)&type, SCCT_NONE, NULL, NULL, NULL);
need_refresh = SWITCH_TRUE;
}
if (need_refresh || need_keyframe) {
switch_core_codec_control(&codec_set->codec, SCC_VIDEO_REFRESH, SCCT_NONE, NULL, NULL, NULL);
switch_core_codec_control(&codec_set->codec, SCC_VIDEO_REFRESH, SCCT_NONE, NULL, SCCT_NONE, NULL, NULL, NULL);
}
do {
@ -1817,7 +1817,8 @@ void conference_video_pop_next_image(conference_member_t *member, switch_image_t
void conference_video_check_auto_bitrate(conference_member_t *member, mcu_layer_t *layer)
{
if (conference_utils_test_flag(member->conference, CFLAG_MANAGE_INBOUND_VIDEO_BITRATE) && !member->managed_kps) {
if (conference_utils_test_flag(member->conference, CFLAG_MANAGE_INBOUND_VIDEO_BITRATE) && !member->managed_kps &&
!switch_channel_test_flag(member->channel, CF_VIDEO_BITRATE_UNMANAGABLE)) {
switch_core_session_message_t msg = { 0 };
int kps;
int w = 320;
@ -2570,7 +2571,8 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
timestamp, need_refresh, need_keyframe, need_reset);
if (canvas->video_write_bandwidth) {
switch_core_codec_control(&write_codecs[i]->codec, SCC_VIDEO_BANDWIDTH, SCCT_INT, &canvas->video_write_bandwidth, NULL, NULL);
switch_core_codec_control(&write_codecs[i]->codec, SCC_VIDEO_BANDWIDTH,
SCCT_INT, &canvas->video_write_bandwidth, SCCT_NONE, NULL, NULL, NULL);
canvas->video_write_bandwidth = 0;
}
@ -2912,7 +2914,8 @@ void *SWITCH_THREAD_FUNC conference_video_super_muxing_thread_run(switch_thread_
conference_video_write_canvas_image_to_codec_group(conference, canvas, write_codecs[i], i, timestamp, need_refresh, need_keyframe, need_reset);
if (canvas->video_write_bandwidth) {
switch_core_codec_control(&write_codecs[i]->codec, SCC_VIDEO_BANDWIDTH, SCCT_INT, &canvas->video_write_bandwidth, NULL, NULL);
switch_core_codec_control(&write_codecs[i]->codec, SCC_VIDEO_BANDWIDTH,
SCCT_INT, &canvas->video_write_bandwidth, SCCT_NONE, NULL, NULL, NULL);
canvas->video_write_bandwidth = 0;
}
}

View File

@ -733,6 +733,8 @@ static switch_status_t switch_h264_control(switch_codec_t *codec,
switch_codec_control_command_t cmd,
switch_codec_control_type_t ctype,
void *cmd_data,
switch_codec_control_type_t atype,
void *cmd_arg,
switch_codec_control_type_t *rtype,
void **ret_data) {

View File

@ -75,6 +75,8 @@ struct opus_context {
uint32_t enc_frame_size;
uint32_t dec_frame_size;
uint32_t old_plpct;
uint32_t debug;
uint32_t use_jb_lookahead;
opus_codec_settings_t codec_settings;
};
@ -89,6 +91,7 @@ struct {
int asymmetric_samplerates;
int keep_fec;
int debuginfo;
uint32_t use_jb_lookahead;
switch_mutex_t *mutex;
} opus_prefs;
@ -534,7 +537,7 @@ static switch_status_t switch_opus_encode(switch_codec_t *codec,
bytes = opus_encode(context->encoder_object, (void *) decoded_data, context->enc_frame_size, (unsigned char *) encoded_data, len);
if (globals.debug) {
if (globals.debug || context->debug > 1) {
int samplerate = context->enc_frame_size * 1000 / (codec->implementation->microseconds_per_packet / 1000);
switch_opus_info(encoded_data, bytes, samplerate, "encode");
}
@ -552,6 +555,7 @@ static switch_status_t switch_opus_encode(switch_codec_t *codec,
return SWITCH_STATUS_GENERR;
}
static switch_status_t switch_opus_decode(switch_codec_t *codec,
switch_codec_t *other_codec,
void *encoded_data,
@ -573,24 +577,57 @@ static switch_status_t switch_opus_decode(switch_codec_t *codec,
frame_size = frame_samples - (frame_samples % (codec->implementation->actual_samples_per_second / 400));
if (*flag & SFF_PLC) {
switch_core_session_t *session = codec->session;
switch_jb_t *jb = NULL;
int got_frame = 0;
plc = 1;
encoded_data = NULL;
opus_decoder_ctl(context->decoder_object, OPUS_GET_LAST_PACKET_DURATION(&frame_size));
if (!frame_size) {
frame_size = frame_samples - (frame_samples % (codec->implementation->actual_samples_per_second / 400));
if (opus_prefs.use_jb_lookahead || context->use_jb_lookahead) {
fec = 1;
}
if (context->codec_settings.useinbandfec) {
fec = 1;
if (!fec && context->codec_settings.useinbandfec && session) {
if (opus_packet_get_bandwidth(codec->cur_frame->data) != OPUS_BANDWIDTH_FULLBAND &&
codec->cur_frame && (jb = switch_core_session_get_jb(session, SWITCH_MEDIA_TYPE_AUDIO))) {
switch_frame_t frame = { 0 };
uint8_t buf[SWITCH_RTP_MAX_BUF_LEN];
frame.data = buf;
frame.buflen = sizeof(buf);
if (switch_jb_peek_frame(jb, codec->cur_frame->seq, 1, &frame)) {
got_frame = 1;
fec = 1;
encoded_data = frame.data;
encoded_data_len = frame.datalen;
}
}
}
if (!got_frame) {
opus_decoder_ctl(context->decoder_object, OPUS_GET_LAST_PACKET_DURATION(&frame_size));
if (!frame_size) {
frame_size = frame_samples - (frame_samples % (codec->implementation->actual_samples_per_second / 400));
}
}
if (globals.debug || context->debug) {
if (opus_prefs.use_jb_lookahead || context->use_jb_lookahead) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "MISSING FRAME: %s\n", fec ? "Look-ahead FEC" : "PLC");
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "MISSING FRAME: OPUS_PLC\n");
}
}
*flag &= ~SFF_PLC;
}
if (globals.debug) {
if (globals.debug || context->debug > 1) {
int samplerate = context->dec_frame_size * 1000 / (codec->implementation->microseconds_per_packet / 1000);
switch_opus_info((*flag & SFF_PLC) ? NULL : encoded_data, encoded_data_len,
switch_opus_info(encoded_data, encoded_data_len,
samplerate ? samplerate : codec->implementation->actual_samples_per_second, "decode");
}
@ -660,7 +697,7 @@ static switch_status_t switch_opus_encode_repacketize(switch_codec_t *codec,
ret = opus_repacketizer_out(rp, encoded_data, total_len+opus_repacketizer_get_nb_frames(rp));
if (globals.debug) {
if (globals.debug || context->debug) {
int samplerate = context->enc_frame_size * 1000 / (codec->implementation->microseconds_per_packet / 1000);
switch_opus_info(encoded_data, ret, samplerate, "encode_repacketize");
}
@ -706,6 +743,8 @@ static switch_status_t opus_load_config(switch_bool_t reload)
opus_prefs.plpct = atoi(val);
} else if (!strcasecmp(key, "asymmetric-sample-rates")) {
opus_prefs.asymmetric_samplerates = atoi(val);
} else if (!strcasecmp(key, "use-jb-lookahead")) {
opus_prefs.use_jb_lookahead = switch_true(val);
} else if (!strcasecmp(key, "keep-fec-enabled")) {
opus_prefs.keep_fec = atoi(val);
} else if (!strcasecmp(key, "maxaveragebitrate")) {
@ -777,7 +816,7 @@ static switch_status_t switch_opus_keep_fec_enabled(switch_codec_t *codec)
* If yes, then keep the current bitrate. If not, modify bitrate to keep FEC on. */
if (real_target_bitrate > LBRR_threshold_bitrate) {
/*FEC is already enabled, do nothing*/
if (globals.debug) {
if (globals.debug || context->debug) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opus encoder: FEC is enabled\n");
}
return SWITCH_STATUS_SUCCESS;
@ -789,7 +828,7 @@ static switch_status_t switch_opus_keep_fec_enabled(switch_codec_t *codec)
opus_encoder_ctl(context->encoder_object,OPUS_SET_BITRATE(current_bitrate));
if (globals.debug) {
if (globals.debug || context->debug) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opus encoder: increased bitrate to [%d] to keep FEC enabled\n", current_bitrate);
}
@ -801,12 +840,46 @@ static switch_status_t switch_opus_control(switch_codec_t *codec,
switch_codec_control_command_t cmd,
switch_codec_control_type_t ctype,
void *cmd_data,
switch_codec_control_type_t atype,
void *cmd_arg,
switch_codec_control_type_t *rtype,
void **ret_data)
{
struct opus_context *context = codec->private_info;
switch(cmd) {
case SCC_CODEC_SPECIFIC:
{
const char *cmd = (const char *)cmd_data;
const char *arg = (const char *)cmd_arg;
switch_codec_control_type_t reply_type = SCCT_STRING;
const char *reply = "ERROR INVALID COMMAND";
if (!zstr(cmd)) {
if (!strcasecmp(cmd, "jb_lookahead")) {
if (!zstr(arg)) {
context->use_jb_lookahead = switch_true(arg);
}
reply = context->use_jb_lookahead ? "LOOKAHEAD ON" : "LOOKAHEAD OFF";
}
}
if (rtype) {
*rtype = reply_type;
if (reply) {
*ret_data = (void *)reply;
}
}
}
break;
case SCC_DEBUG:
{
int32_t level = *((uint32_t *) cmd_data);
context->debug = level;
}
break;
case SCC_AUDIO_PACKET_LOSS:
{
uint32_t plpct = *((uint32_t *) cmd_data);
@ -830,7 +903,7 @@ static switch_status_t switch_opus_control(switch_codec_t *codec,
switch_opus_keep_fec_enabled(codec);
}
if (globals.debug) {
if (globals.debug || context->debug) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opus Adjusting packet loss percent from %d%% to %d%%!\n",
context->old_plpct, plpct);
}

View File

@ -62,7 +62,7 @@ struct silk_context {
SKP_SILK_SDK_DecControlStruct decoder_object;
void *enc_state;
void *dec_state;
SKP_uint8 recbuff[STFU_DATALEN];
SKP_uint8 recbuff[SWITCH_RTP_MAX_BUF_LEN];
SKP_int16 reclen;
};
@ -326,12 +326,8 @@ 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 = NULL;
switch_jb_t *jb = NULL;
SKP_int lost_flag = (*flag & SFF_PLC);
stfu_frame_t *next_frame = NULL;
int32_t found_frame;
switch_bool_t did_lbrr = SWITCH_FALSE;
int i;
@ -345,11 +341,14 @@ static switch_status_t switch_silk_decode(switch_codec_t *codec,
}
if (jb && codec->cur_frame) {
for (i = 1; i <= MAX_LBRR_DELAY; i++) {
found_frame = stfu_n_peek_frame(jb, (uint32_t)codec->cur_frame->timestamp, codec->cur_frame->seq, (uint16_t)i, &next_frame);
switch_frame_t frame = { 0 };
uint8_t buf[SWITCH_RTP_MAX_BUF_LEN];
frame.data = buf;
frame.buflen = sizeof(buf);
if (found_frame) {
SKP_Silk_SDK_search_for_LBRR(next_frame->data, (const int)next_frame->dlen, i, (SKP_uint8*) &context->recbuff, &context->reclen);
for (i = 1; i <= MAX_LBRR_DELAY; i++) {
if (switch_jb_peek_frame(jb, codec->cur_frame->seq, (uint16_t)i, &frame)) {
SKP_Silk_SDK_search_for_LBRR(frame.data, (const int)frame.datalen, i, (SKP_uint8*) &context->recbuff, &context->reclen);
if (context->reclen) {
encoded_data = &context->recbuff;

View File

@ -940,6 +940,8 @@ static switch_status_t switch_vpx_control(switch_codec_t *codec,
switch_codec_control_command_t cmd,
switch_codec_control_type_t ctype,
void *cmd_data,
switch_codec_control_type_t atype,
void *cmd_arg,
switch_codec_control_type_t *rtype,
void **ret_data)
{

View File

@ -269,7 +269,7 @@ static switch_status_t rtc_receive_event(switch_core_session_t *session, switch_
return SWITCH_STATUS_SUCCESS;
}
static stfu_instance_t *rtc_get_jb(switch_core_session_t *session, switch_media_type_t type)
static switch_jb_t *rtc_get_jb(switch_core_session_t *session, switch_media_type_t type)
{
private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);

View File

@ -264,7 +264,7 @@ char *generate_pai_str(private_object_t *tech_pvt)
return pai;
}
static stfu_instance_t *sofia_get_jb(switch_core_session_t *session, switch_media_type_t type)
static switch_jb_t *sofia_get_jb(switch_core_session_t *session, switch_media_type_t type)
{
private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);

View File

@ -591,10 +591,10 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
case SWITCH_MESSAGE_INDICATE_JITTER_BUFFER:
{
if (switch_rtp_ready(tech_pvt->rtp_session)) {
int len = 0, maxlen = 0, qlen = 0, maxqlen = 50, max_drift = 0;
int len = 0, maxlen = 0, qlen = 0, maxqlen = 50;
if (msg->string_arg) {
char *p, *q;
char *p;
const char *s;
if (!strcasecmp(msg->string_arg, "pause")) {
@ -624,10 +624,6 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
if ((p = strchr(msg->string_arg, ':'))) {
p++;
maxlen = atol(p);
if ((q = strchr(p, ':'))) {
q++;
max_drift = abs(atoi(q));
}
}
}
@ -643,10 +639,10 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
}
if (switch_rtp_activate_jitter_buffer(tech_pvt->rtp_session, qlen, maxqlen,
tech_pvt->read_codec.implementation->samples_per_packet,
tech_pvt->read_codec.implementation->samples_per_second, max_drift) == SWITCH_STATUS_SUCCESS) {
tech_pvt->read_codec.implementation->samples_per_second) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session),
SWITCH_LOG_DEBUG, "Setting Jitterbuffer to %dms (%d frames) (%d max frames) (%d max drift)\n",
len, qlen, maxqlen, max_drift);
SWITCH_LOG_DEBUG, "Setting Jitterbuffer to %dms (%d frames) (%d max frames)\n",
len, qlen, maxqlen);
switch_channel_set_flag(tech_pvt->channel, CF_JITTERBUFFER);
if (!switch_false(switch_channel_get_variable(tech_pvt->channel, "rtp_jitter_buffer_plc"))) {
switch_channel_set_flag(tech_pvt->channel, CF_JITTERBUFFER_PLC);

View File

@ -11885,11 +11885,11 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_get_jb(void * jarg1, in
void * jresult ;
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
switch_media_type_t arg2 ;
stfu_instance_t *result = 0 ;
switch_jb_t *result = 0 ;
arg1 = (switch_core_session_t *)jarg1;
arg2 = (switch_media_type_t)jarg2;
result = (stfu_instance_t *)switch_core_session_get_jb(arg1,arg2);
result = (switch_jb_t *)switch_core_session_get_jb(arg1,arg2);
jresult = (void *)result;
return jresult;
}
@ -25139,6 +25139,28 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_mm_t_vbuf_get(void * jarg1) {
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_mm_t_vencspd_set(void * jarg1, int jarg2) {
switch_mm_s *arg1 = (switch_mm_s *) 0 ;
switch_video_encode_speed_t arg2 ;
arg1 = (switch_mm_s *)jarg1;
arg2 = (switch_video_encode_speed_t)jarg2;
if (arg1) (arg1)->vencspd = arg2;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_mm_t_vencspd_get(void * jarg1) {
int jresult ;
switch_mm_s *arg1 = (switch_mm_s *) 0 ;
switch_video_encode_speed_t result;
arg1 = (switch_mm_s *)jarg1;
result = (switch_video_encode_speed_t) ((arg1)->vencspd);
jresult = result;
return jresult;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_mm_t() {
void * jresult ;
switch_mm_s *result = 0 ;
@ -37404,6 +37426,18 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_parse_all_signal_data(void * jarg1)
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_parse_next_signal_data(void * jarg1) {
int jresult ;
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
switch_status_t result;
arg1 = (switch_core_session_t *)jarg1;
result = (switch_status_t)switch_ivr_parse_next_signal_data(arg1);
jresult = result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_process_indications(void * jarg1, void * jarg2) {
int jresult ;
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
@ -38362,6 +38396,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_media(char * jarg1, unsigned long j
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_3p_media(char * jarg1, unsigned long jarg2) {
int jresult ;
char *arg1 = (char *) 0 ;
switch_media_flag_t arg2 ;
switch_status_t result;
arg1 = (char *)jarg1;
arg2 = (switch_media_flag_t)jarg2;
result = (switch_status_t)switch_ivr_3p_media((char const *)arg1,arg2);
jresult = result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_nomedia(char * jarg1, unsigned long jarg2) {
int jresult ;
char *arg1 = (char *) 0 ;
@ -38376,6 +38424,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_nomedia(char * jarg1, unsigned long
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_3p_nomedia(char * jarg1, unsigned long jarg2) {
int jresult ;
char *arg1 = (char *) 0 ;
switch_media_flag_t arg2 ;
switch_status_t result;
arg1 = (char *)jarg1;
arg2 = (switch_media_flag_t)jarg2;
result = (switch_status_t)switch_ivr_3p_nomedia((char const *)arg1,arg2);
jresult = result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_hold_uuid(char * jarg1, char * jarg2, int jarg3) {
int jresult ;
char *arg1 = (char *) 0 ;
@ -40930,15 +40992,17 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_get_media_timer(void * jarg1) {
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_set_video_buffer_size(void * jarg1, unsigned long jarg2) {
SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_set_video_buffer_size(void * jarg1, unsigned long jarg2, unsigned long jarg3) {
int jresult ;
switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
uint32_t arg2 ;
uint32_t arg3 ;
switch_status_t result;
arg1 = (switch_rtp_t *)jarg1;
arg2 = (uint32_t)jarg2;
result = (switch_status_t)switch_rtp_set_video_buffer_size(arg1,arg2);
arg3 = (uint32_t)jarg3;
result = (switch_status_t)switch_rtp_set_video_buffer_size(arg1,arg2,arg3);
jresult = result;
return jresult;
}
@ -40956,14 +41020,13 @@ SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_rtp_get_video_buffer_size(voi
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_activate_jitter_buffer(void * jarg1, unsigned long jarg2, unsigned long jarg3, unsigned long jarg4, unsigned long jarg5, unsigned long jarg6) {
SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_activate_jitter_buffer(void * jarg1, unsigned long jarg2, unsigned long jarg3, unsigned long jarg4, unsigned long jarg5) {
int jresult ;
switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
uint32_t arg2 ;
uint32_t arg3 ;
uint32_t arg4 ;
uint32_t arg5 ;
uint32_t arg6 ;
switch_status_t result;
arg1 = (switch_rtp_t *)jarg1;
@ -40971,8 +41034,7 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_activate_jitter_buffer(void * jarg1
arg3 = (uint32_t)jarg3;
arg4 = (uint32_t)jarg4;
arg5 = (uint32_t)jarg5;
arg6 = (uint32_t)jarg6;
result = (switch_status_t)switch_rtp_activate_jitter_buffer(arg1,arg2,arg3,arg4,arg5,arg6);
result = (switch_status_t)switch_rtp_activate_jitter_buffer(arg1,arg2,arg3,arg4,arg5);
jresult = result;
return jresult;
}
@ -41021,10 +41083,10 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_pause_jitter_buffer(void * jarg1, i
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_get_jitter_buffer(void * jarg1) {
void * jresult ;
switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
stfu_instance_t *result = 0 ;
switch_jb_t *result = 0 ;
arg1 = (switch_rtp_t *)jarg1;
result = (stfu_instance_t *)switch_rtp_get_jitter_buffer(arg1);
result = (switch_jb_t *)switch_rtp_get_jitter_buffer(arg1);
jresult = (void *)result;
return jresult;
}

View File

@ -1723,9 +1723,9 @@ public class freeswitch {
return ret;
}
public static SWIGTYPE_p_stfu_instance_t switch_core_session_get_jb(SWIGTYPE_p_switch_core_session session, switch_media_type_t type) {
public static SWIGTYPE_p_switch_jb_s switch_core_session_get_jb(SWIGTYPE_p_switch_core_session session, switch_media_type_t type) {
IntPtr cPtr = freeswitchPINVOKE.switch_core_session_get_jb(SWIGTYPE_p_switch_core_session.getCPtr(session), (int)type);
SWIGTYPE_p_stfu_instance_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_stfu_instance_t(cPtr, false);
SWIGTYPE_p_switch_jb_s ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_jb_s(cPtr, false);
return ret;
}
@ -5615,6 +5615,11 @@ public class freeswitch {
return ret;
}
public static switch_status_t switch_ivr_parse_next_signal_data(SWIGTYPE_p_switch_core_session session) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_parse_next_signal_data(SWIGTYPE_p_switch_core_session.getCPtr(session));
return ret;
}
public static switch_status_t switch_ivr_process_indications(SWIGTYPE_p_switch_core_session session, switch_core_session_message message) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_process_indications(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_core_session_message.getCPtr(message));
return ret;
@ -5887,11 +5892,21 @@ public class freeswitch {
return ret;
}
public static switch_status_t switch_ivr_3p_media(string uuid, uint flags) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_3p_media(uuid, flags);
return ret;
}
public static switch_status_t switch_ivr_nomedia(string uuid, uint flags) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_nomedia(uuid, flags);
return ret;
}
public static switch_status_t switch_ivr_3p_nomedia(string uuid, uint flags) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_3p_nomedia(uuid, flags);
return ret;
}
public static switch_status_t switch_ivr_hold_uuid(string uuid, string message, switch_bool_t moh) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_hold_uuid(uuid, message, (int)moh);
return ret;
@ -6431,8 +6446,8 @@ public class freeswitch {
return ret;
}
public static switch_status_t switch_rtp_set_video_buffer_size(SWIGTYPE_p_switch_rtp rtp_session, uint frames) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_set_video_buffer_size(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), frames);
public static switch_status_t switch_rtp_set_video_buffer_size(SWIGTYPE_p_switch_rtp rtp_session, uint frames, uint max_frames) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_set_video_buffer_size(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), frames, max_frames);
return ret;
}
@ -6441,8 +6456,8 @@ public class freeswitch {
return ret;
}
public static switch_status_t switch_rtp_activate_jitter_buffer(SWIGTYPE_p_switch_rtp rtp_session, uint queue_frames, uint max_queue_frames, uint samples_per_packet, uint samples_per_second, uint max_drift) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_activate_jitter_buffer(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), queue_frames, max_queue_frames, samples_per_packet, samples_per_second, max_drift);
public static switch_status_t switch_rtp_activate_jitter_buffer(SWIGTYPE_p_switch_rtp rtp_session, uint queue_frames, uint max_queue_frames, uint samples_per_packet, uint samples_per_second) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_activate_jitter_buffer(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), queue_frames, max_queue_frames, samples_per_packet, samples_per_second);
return ret;
}
@ -6461,9 +6476,9 @@ public class freeswitch {
return ret;
}
public static SWIGTYPE_p_stfu_instance_t switch_rtp_get_jitter_buffer(SWIGTYPE_p_switch_rtp rtp_session) {
public static SWIGTYPE_p_switch_jb_s switch_rtp_get_jitter_buffer(SWIGTYPE_p_switch_rtp rtp_session) {
IntPtr cPtr = freeswitchPINVOKE.switch_rtp_get_jitter_buffer(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
SWIGTYPE_p_stfu_instance_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_stfu_instance_t(cPtr, false);
SWIGTYPE_p_switch_jb_s ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_jb_s(cPtr, false);
return ret;
}
@ -13779,6 +13794,12 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_mm_t_vbuf_get")]
public static extern int switch_mm_t_vbuf_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_mm_t_vencspd_set")]
public static extern void switch_mm_t_vencspd_set(HandleRef jarg1, int jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_mm_t_vencspd_get")]
public static extern int switch_mm_t_vencspd_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_new_switch_mm_t")]
public static extern IntPtr new_switch_mm_t();
@ -16800,6 +16821,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_parse_all_signal_data")]
public static extern int switch_ivr_parse_all_signal_data(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_parse_next_signal_data")]
public static extern int switch_ivr_parse_next_signal_data(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_process_indications")]
public static extern int switch_ivr_process_indications(HandleRef jarg1, HandleRef jarg2);
@ -16962,9 +16986,15 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_media")]
public static extern int switch_ivr_media(string jarg1, uint jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_3p_media")]
public static extern int switch_ivr_3p_media(string jarg1, uint jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_nomedia")]
public static extern int switch_ivr_nomedia(string jarg1, uint jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_3p_nomedia")]
public static extern int switch_ivr_3p_nomedia(string jarg1, uint jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_hold_uuid")]
public static extern int switch_ivr_hold_uuid(string jarg1, string jarg2, int jarg3);
@ -17512,13 +17542,13 @@ class freeswitchPINVOKE {
public static extern IntPtr switch_rtp_get_media_timer(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_video_buffer_size")]
public static extern int switch_rtp_set_video_buffer_size(HandleRef jarg1, uint jarg2);
public static extern int switch_rtp_set_video_buffer_size(HandleRef jarg1, uint jarg2, uint jarg3);
[DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_get_video_buffer_size")]
public static extern uint switch_rtp_get_video_buffer_size(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_activate_jitter_buffer")]
public static extern int switch_rtp_activate_jitter_buffer(HandleRef jarg1, uint jarg2, uint jarg3, uint jarg4, uint jarg5, uint jarg6);
public static extern int switch_rtp_activate_jitter_buffer(HandleRef jarg1, uint jarg2, uint jarg3, uint jarg4, uint jarg5);
[DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_debug_jitter_buffer")]
public static extern int switch_rtp_debug_jitter_buffer(HandleRef jarg1, string jarg2);
@ -21212,36 +21242,6 @@ namespace FreeSWITCH.Native {
using System;
using System.Runtime.InteropServices;
public class SWIGTYPE_p_f_p_switch_core_session_enum_switch_media_type_t__p_stfu_instance_t {
private HandleRef swigCPtr;
internal SWIGTYPE_p_f_p_switch_core_session_enum_switch_media_type_t__p_stfu_instance_t(IntPtr cPtr, bool futureUse) {
swigCPtr = new HandleRef(this, cPtr);
}
protected SWIGTYPE_p_f_p_switch_core_session_enum_switch_media_type_t__p_stfu_instance_t() {
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_enum_switch_media_type_t__p_stfu_instance_t obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
}
}
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.12
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace FreeSWITCH.Native {
using System;
using System.Runtime.InteropServices;
public class SWIGTYPE_p_f_p_switch_core_session__int {
private HandleRef swigCPtr;
@ -21872,6 +21872,36 @@ namespace FreeSWITCH.Native {
using System;
using System.Runtime.InteropServices;
public class SWIGTYPE_p_f_p_switch_core_session_t_switch_media_type_t__p_switch_jb_s {
private HandleRef swigCPtr;
internal SWIGTYPE_p_f_p_switch_core_session_t_switch_media_type_t__p_switch_jb_s(IntPtr cPtr, bool futureUse) {
swigCPtr = new HandleRef(this, cPtr);
}
protected SWIGTYPE_p_f_p_switch_core_session_t_switch_media_type_t__p_switch_jb_s() {
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_t_switch_media_type_t__p_switch_jb_s obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
}
}
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.12
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace FreeSWITCH.Native {
using System;
using System.Runtime.InteropServices;
public class SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char_p_char__switch_status_t {
private HandleRef swigCPtr;
@ -24812,36 +24842,6 @@ namespace FreeSWITCH.Native {
using System;
using System.Runtime.InteropServices;
public class SWIGTYPE_p_stfu_instance_t {
private HandleRef swigCPtr;
internal SWIGTYPE_p_stfu_instance_t(IntPtr cPtr, bool futureUse) {
swigCPtr = new HandleRef(this, cPtr);
}
protected SWIGTYPE_p_stfu_instance_t() {
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
internal static HandleRef getCPtr(SWIGTYPE_p_stfu_instance_t obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
}
}
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.12
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace FreeSWITCH.Native {
using System;
using System.Runtime.InteropServices;
public class SWIGTYPE_p_switch_buffer {
private HandleRef swigCPtr;
@ -25472,6 +25472,36 @@ namespace FreeSWITCH.Native {
using System;
using System.Runtime.InteropServices;
public class SWIGTYPE_p_switch_jb_s {
private HandleRef swigCPtr;
internal SWIGTYPE_p_switch_jb_s(IntPtr cPtr, bool futureUse) {
swigCPtr = new HandleRef(this, cPtr);
}
protected SWIGTYPE_p_switch_jb_s() {
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
internal static HandleRef getCPtr(SWIGTYPE_p_switch_jb_s obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
}
}
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.12
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace FreeSWITCH.Native {
using System;
using System.Runtime.InteropServices;
public class SWIGTYPE_p_switch_live_array_s {
private HandleRef swigCPtr;
@ -29166,6 +29196,10 @@ public enum switch_channel_flag_t {
CF_VIDEO_MIRROR_INPUT,
CF_VIDEO_READ_FILE_ATTACHED,
CF_VIDEO_WRITE_FILE_ATTACHED,
CF_3P_MEDIA_REQUESTED,
CF_3P_NOMEDIA_REQUESTED,
CF_3P_NOMEDIA_REQUESTED_BLEG,
CF_VIDEO_SDP_RECVD,
CF_FLAG_MAX
}
@ -31208,7 +31242,9 @@ public enum switch_core_session_message_types_t {
SWITCH_MESSAGE_INDICATE_TRANSFER,
SWITCH_MESSAGE_INDICATE_RINGING,
SWITCH_MESSAGE_INDICATE_MEDIA,
SWITCH_MESSAGE_INDICATE_3P_MEDIA,
SWITCH_MESSAGE_INDICATE_NOMEDIA,
SWITCH_MESSAGE_INDICATE_3P_NOMEDIA,
SWITCH_MESSAGE_INDICATE_HOLD,
SWITCH_MESSAGE_INDICATE_UNHOLD,
SWITCH_MESSAGE_INDICATE_REDIRECT,
@ -36550,13 +36586,13 @@ public class switch_io_routines : IDisposable {
}
}
public SWIGTYPE_p_f_p_switch_core_session_enum_switch_media_type_t__p_stfu_instance_t get_jb {
public SWIGTYPE_p_f_p_switch_core_session_t_switch_media_type_t__p_switch_jb_s get_jb {
set {
freeswitchPINVOKE.switch_io_routines_get_jb_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_enum_switch_media_type_t__p_stfu_instance_t.getCPtr(value));
freeswitchPINVOKE.switch_io_routines_get_jb_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_t_switch_media_type_t__p_switch_jb_s.getCPtr(value));
}
get {
IntPtr cPtr = freeswitchPINVOKE.switch_io_routines_get_jb_get(swigCPtr);
SWIGTYPE_p_f_p_switch_core_session_enum_switch_media_type_t__p_stfu_instance_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_enum_switch_media_type_t__p_stfu_instance_t(cPtr, false);
SWIGTYPE_p_f_p_switch_core_session_t_switch_media_type_t__p_switch_jb_s ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_t_switch_media_type_t__p_switch_jb_s(cPtr, false);
return ret;
}
}
@ -38000,6 +38036,16 @@ public class switch_mm_t : IDisposable {
}
}
public switch_video_encode_speed_t vencspd {
set {
freeswitchPINVOKE.switch_mm_t_vencspd_set(swigCPtr, (int)value);
}
get {
switch_video_encode_speed_t ret = (switch_video_encode_speed_t)freeswitchPINVOKE.switch_mm_t_vencspd_get(swigCPtr);
return ret;
}
}
public switch_mm_t() : this(freeswitchPINVOKE.new_switch_mm_t(), true) {
}
@ -42597,6 +42643,24 @@ public class switch_video_codec_settings : IDisposable {
namespace FreeSWITCH.Native {
public enum switch_video_encode_speed_t {
SWITCH_VIDEO_ENCODE_SPEED_DEFAULT,
SWITCH_VIDEO_ENCODE_SPEED_SLOW,
SWITCH_VIDEO_ENCODE_SPEED_MEDIUM,
SWITCH_VIDEO_ENCODE_SPEED_FAST
}
}
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.12
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace FreeSWITCH.Native {
public enum switch_video_read_flag_t {
SVR_BLOCK = (1 << 0),
SVR_FLUSH = (1 << 1),

View File

@ -878,6 +878,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_control(switch_codec_t *codec,
switch_codec_control_command_t cmd,
switch_codec_control_type_t ctype,
void *cmd_data,
switch_codec_control_type_t atype,
void *cmd_arg,
switch_codec_control_type_t *rtype,
void **ret_data)
{
@ -898,7 +900,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_control(switch_codec_t *codec,
if (codec->mutex) switch_mutex_lock(codec->mutex);
if (codec->implementation->codec_control) {
status = codec->implementation->codec_control(codec, cmd, ctype, cmd_data, rtype, ret_data);
status = codec->implementation->codec_control(codec, cmd, ctype, cmd_data, atype, cmd_arg, rtype, ret_data);
}
if (codec->mutex) switch_mutex_unlock(codec->mutex);

View File

@ -1853,12 +1853,17 @@ static void check_jb(switch_core_session_t *session, const char *input, int32_t
if (v_engine->rtp_session) {
if (!strncasecmp(input, "vbsize:", 7)) {
int frames = 0;
int frames = 0, max_frames = 0;
s = input + 7;
frames = atoi(s);
if ((s = strchr(s, ':')) && *(s+1) != '\0') {
max_frames = atoi(s+1);
}
if (frames > 0) {
switch_rtp_set_video_buffer_size(v_engine->rtp_session, frames);
switch_rtp_set_video_buffer_size(v_engine->rtp_session, frames, max_frames);
}
return;
} else if (!strncasecmp(input, "vdebug:", 7)) {
@ -1875,27 +1880,30 @@ static void check_jb(switch_core_session_t *session, const char *input, int32_t
if (jb_msec || (val = switch_channel_get_variable(session->channel, "jitterbuffer_msec")) || (val = smh->mparams->jb_msec)) {
int max_drift = 0;
char *p, *q;
char *p;
if (!jb_msec) {
jb_msec = atoi(val);
if (strchr(val, 'p') && jb_msec > 0) {
jb_msec *= -1;
}
if ((p = strchr(val, ':'))) {
p++;
maxlen = atoi(p);
if ((q = strchr(p, ':'))) {
q++;
max_drift = abs(atoi(q));
if (strchr(p, 'p') && maxlen > 0) {
maxlen *= -1;
}
}
}
if (jb_msec < 0 && jb_msec > -20) {
if (jb_msec < 0 && jb_msec > -1000) {
jb_msec = (a_engine->read_codec.implementation->microseconds_per_packet / 1000) * abs(jb_msec);
}
if (maxlen < 0 && maxlen > -20) {
if (maxlen < 0 && maxlen > -1000) {
maxlen = (a_engine->read_codec.implementation->microseconds_per_packet / 1000) * abs(maxlen);
}
@ -1903,7 +1911,7 @@ static void check_jb(switch_core_session_t *session, const char *input, int32_t
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR,
"Invalid Jitterbuffer spec [%d] must be between 10 and 10000\n", jb_msec);
} else {
int qlen, maxqlen = 10;
int qlen, maxqlen = 30;
qlen = jb_msec / (a_engine->read_impl.microseconds_per_packet / 1000);
@ -1916,11 +1924,11 @@ static void check_jb(switch_core_session_t *session, const char *input, int32_t
}
if (switch_rtp_activate_jitter_buffer(a_engine->rtp_session, qlen, maxqlen,
a_engine->read_impl.samples_per_packet,
a_engine->read_impl.samples_per_second, max_drift) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session),
SWITCH_LOG_DEBUG, "Setting Jitterbuffer to %dms (%d frames) (%d max frames) (%d max drift)\n",
jb_msec, qlen, maxqlen, max_drift);
switch_channel_set_flag(session->channel, CF_JITTERBUFFER);
a_engine->read_impl.samples_per_second) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session),
SWITCH_LOG_DEBUG, "Setting Jitterbuffer to %dms (%d frames) (%d max frames)\n",
jb_msec, qlen, maxqlen);
switch_channel_set_flag(session->channel, CF_JITTERBUFFER);
if (!switch_false(switch_channel_get_variable(session->channel, "rtp_jitter_buffer_plc"))) {
switch_channel_set_flag(session->channel, CF_JITTERBUFFER_PLC);
}
@ -1938,6 +1946,9 @@ static void check_jb_sync(switch_core_session_t *session)
{
int32_t jb_sync_msec = 0;
uint32_t fps, frames = 0;
uint32_t min_frames = 0;
uint32_t max_frames = 0;
uint32_t cur_frames = 0;
switch_media_handle_t *smh;
switch_rtp_engine_t *v_engine = NULL;
const char *var;
@ -1954,7 +1965,7 @@ static void check_jb_sync(switch_core_session_t *session)
v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];
if ((var = switch_channel_get_variable_dup(session->channel, "jb_sync_msec", SWITCH_FALSE, -1))) {
if ((var = switch_channel_get_variable_dup(session->channel, "jb_av_sync_msec", SWITCH_FALSE, -1))) {
int tmp;
char *p;
@ -1980,7 +1991,7 @@ static void check_jb_sync(switch_core_session_t *session)
fps = switch_core_media_get_video_fps(session);
}
if (!fps) return;
if (fps < 15) return;
if (!frames) {
frames = fps / 7.5;
@ -2000,7 +2011,9 @@ static void check_jb_sync(switch_core_session_t *session)
// }
//}
if (frames == switch_rtp_get_video_buffer_size(v_engine->rtp_session)) {
switch_rtp_get_video_buffer_size(v_engine->rtp_session, &min_frames, &max_frames, &cur_frames, NULL);
if (cur_frames > min_frames || frames == min_frames) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session),
SWITCH_LOG_DEBUG1, "%s %s \"%s\" A/V JB not changed %dms %u VFrames FPS %u\n",
switch_core_session_get_uuid(session),
@ -2015,8 +2028,8 @@ static void check_jb_sync(switch_core_session_t *session)
switch_channel_get_variable_dup(session->channel, "caller_id_name", SWITCH_FALSE, -1),
jb_sync_msec, frames, fps);
switch_rtp_set_video_buffer_size(v_engine->rtp_session, frames);
check_jb(session, NULL, jb_sync_msec, jb_sync_msec * 4);
switch_rtp_set_video_buffer_size(v_engine->rtp_session, frames, 0);
check_jb(session, NULL, jb_sync_msec, 0);
}
}
@ -8919,6 +8932,55 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_receive_message(switch_core_se
}
break;
case SWITCH_MESSAGE_INDICATE_CODEC_DEBUG_REQ:
{
switch_rtp_engine_t *engine = &smh->engines[msg->numeric_reply];
uint32_t level = (uint32_t) msg->numeric_arg;
if (engine->rtp_session) {
switch_core_codec_control(&engine->read_codec, SCC_DEBUG, SCCT_INT, (void *)&level, SCCT_NONE, NULL, NULL, NULL);
switch_core_codec_control(&engine->write_codec, SCC_DEBUG, SCCT_INT, (void *)&level, SCCT_NONE, NULL, NULL, NULL);
}
}
break;
case SWITCH_MESSAGE_INDICATE_CODEC_SPECIFIC_REQ:
{
switch_rtp_engine_t *engine;
switch_io_type_t iotype = SWITCH_IO_READ;
switch_media_type_t type = SWITCH_MEDIA_TYPE_AUDIO;
switch_codec_control_type_t reply_type = SCCT_NONE;
void *reply = NULL;
if (!strcasecmp(msg->string_array_arg[0], "video")) {
type = SWITCH_MEDIA_TYPE_VIDEO;
}
if (!strcasecmp(msg->string_array_arg[1], "write")) {
iotype = SWITCH_IO_WRITE;
}
engine = &smh->engines[type];
if (engine->rtp_session) {
if (iotype == SWITCH_IO_READ) {
switch_core_codec_control(&engine->read_codec, SCC_CODEC_SPECIFIC,
SCCT_STRING, (void *)msg->string_array_arg[2],
SCCT_STRING, (void *)msg->string_array_arg[3], &reply_type, &reply);
} else {
switch_core_codec_control(&engine->write_codec, SCC_CODEC_SPECIFIC,
SCCT_STRING, (void *)msg->string_array_arg[2],
SCCT_STRING, (void *)msg->string_array_arg[3], &reply_type, &reply);
}
if (reply_type == SCCT_STRING) {
msg->string_array_arg[4] = (char *)reply;
}
}
}
break;
case SWITCH_MESSAGE_INDICATE_DEBUG_MEDIA:
{
switch_rtp_t *rtp = a_engine->rtp_session;
@ -9417,7 +9479,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_udptl_mode(switch_core_session
}
//?
SWITCH_DECLARE(stfu_instance_t *) switch_core_media_get_jb(switch_core_session_t *session, switch_media_type_t type)
SWITCH_DECLARE(switch_jb_t *) switch_core_media_get_jb(switch_core_session_t *session, switch_media_type_t type)
{
switch_media_handle_t *smh;
@ -9781,12 +9843,12 @@ SWITCH_DECLARE(void) switch_core_session_stop_media(switch_core_session_t *sessi
if (switch_core_codec_ready(&v_engine->read_codec)) {
type = 1;
switch_core_codec_control(&v_engine->read_codec, SCC_VIDEO_RESET, SCCT_INT, (void *)&type, NULL, NULL);
switch_core_codec_control(&v_engine->read_codec, SCC_VIDEO_RESET, SCCT_INT, (void *)&type, SCCT_NONE, NULL, NULL, NULL);
}
if (switch_core_codec_ready(&v_engine->write_codec)) {
type = 2;
switch_core_codec_control(&v_engine->write_codec, SCC_VIDEO_RESET, SCCT_INT, (void *)&type, NULL, NULL);
switch_core_codec_control(&v_engine->write_codec, SCC_VIDEO_RESET, SCCT_INT, (void *)&type, SCCT_NONE, NULL, NULL, NULL);
}
if (a_engine->rtp_session) {
@ -10420,6 +10482,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_codec_control(switch_core_sess
switch_codec_control_command_t cmd,
switch_codec_control_type_t ctype,
void *cmd_data,
switch_codec_control_type_t atype,
void *cmd_arg,
switch_codec_control_type_t *rtype,
void **ret_data)
{
@ -10465,7 +10529,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_codec_control(switch_core_sess
switch_channel_set_flag(session->channel, CF_VIDEO_REFRESH_REQ);
}
return switch_core_codec_control(codec, cmd, ctype, cmd_data, rtype, ret_data);
return switch_core_codec_control(codec, cmd, ctype, cmd_data, atype, cmd_arg, rtype, ret_data);
}
return SWITCH_STATUS_FALSE;
@ -10516,7 +10580,7 @@ SWITCH_DECLARE(void) switch_core_session_video_reinit(switch_core_session_t *ses
switch_core_session_send_and_request_video_refresh(session);
type = 1;
switch_core_media_codec_control(session, SWITCH_MEDIA_TYPE_VIDEO, SWITCH_IO_READ, SCC_VIDEO_RESET, SCCT_INT, (void *)&type, NULL, NULL);
switch_core_media_codec_control(session, SWITCH_MEDIA_TYPE_VIDEO, SWITCH_IO_READ, SCC_VIDEO_RESET, SCCT_INT, (void *)&type, SCCT_NONE, NULL, NULL, NULL);
switch_core_session_request_video_refresh(session);
}

View File

@ -65,7 +65,7 @@ SWITCH_DECLARE(switch_ivr_dmachine_t *) switch_core_session_get_dmachine(switch_
}
SWITCH_DECLARE(stfu_instance_t *) switch_core_session_get_jb(switch_core_session_t *session, switch_media_type_t type)
SWITCH_DECLARE(switch_jb_t *) switch_core_session_get_jb(switch_core_session_t *session, switch_media_type_t type)
{
if (session->endpoint_interface->io_routines->get_jb) {
return session->endpoint_interface->io_routines->get_jb(session, type);
@ -759,6 +759,8 @@ static const char *message_names[] = {
"HARD_MUTE",
"BITRATE_REQ",
"BITRATE_ACK",
"CODEC_DEBUG_REQ",
"CODEC_SPECIFIC_REQ",
"REFER_EVENT",
"ANSWER_EVENT",
"PROGRESS_EVENT",

View File

@ -3159,59 +3159,90 @@ SWITCH_DECLARE(void) switch_ivr_park_session(switch_core_session_t *session)
SWITCH_DECLARE(void) switch_ivr_delay_echo(switch_core_session_t *session, uint32_t delay_ms)
{
stfu_instance_t *jb;
switch_jb_t *jb;
int qlen = 0;
stfu_frame_t *jb_frame;
switch_frame_t *read_frame, write_frame = { 0 };
switch_status_t status;
switch_channel_t *channel = switch_core_session_get_channel(session);
uint32_t interval;
uint32_t ts = 0;
uint16_t seq = 0;
switch_codec_implementation_t read_impl = { 0 };
switch_core_session_get_read_impl(session, &read_impl);
int is_rtp = 0;
int debug = 0;
const char *var;
switch_core_session_get_read_impl(session, &read_impl);
if (delay_ms < 1 || delay_ms > 10000) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid delay [%d] must be between 1 and 10000\n", delay_ms);
return;
}
interval = read_impl.microseconds_per_packet / 1000;
//samples = switch_samples_per_packet(read_impl.samples_per_second, interval);
if (delay_ms < interval * 2) {
delay_ms = interval * 2;
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Minimum possible delay for this codec (%d) has been chosen\n", delay_ms);
}
qlen = delay_ms / (interval);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Setting delay to %dms (%d frames)\n", delay_ms, qlen);
jb = stfu_n_init(qlen, qlen, read_impl.samples_per_packet, read_impl.samples_per_second, 0);
switch_jb_create(&jb, SJB_AUDIO, qlen, qlen, switch_core_session_get_pool(session));
if ((var = switch_channel_get_variable(channel, "delay_echo_debug_level"))) {
debug = atoi(var);
}
if (debug) {
switch_jb_debug_level(jb, debug);
}
write_frame.codec = switch_core_session_get_read_codec(session);
while (switch_channel_ready(channel)) {
switch_rtp_packet_t packet = { {0} };
switch_size_t plen = sizeof(packet);
status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
if (!SWITCH_READ_ACCEPTABLE(status)) {
break;
}
stfu_n_eat(jb, ts, 0, read_frame->payload, read_frame->data, read_frame->datalen, 0);
ts += read_impl.samples_per_packet;
if (switch_test_flag(read_frame, SFF_CNG)) {
continue;
}
if (read_frame->packet) {
is_rtp = 1;
switch_jb_put_packet(jb, (switch_rtp_packet_t *) read_frame->packet, read_frame->packetlen);
} else if (is_rtp) {
continue;
} else {
ts += read_impl.samples_per_packet;
memcpy(packet.body, read_frame->data, read_frame->datalen);
packet.header.ts = htonl(ts);
packet.header.seq = htons(++seq);
packet.header.version = 2;
}
if (switch_jb_get_packet(jb, (switch_rtp_packet_t *) &packet, &plen) == SWITCH_STATUS_SUCCESS) {
write_frame.data = packet.body;
write_frame.datalen = (uint32_t) plen - 12;
write_frame.buflen = (uint32_t) plen;
if ((jb_frame = stfu_n_read_a_frame(jb))) {
write_frame.data = jb_frame->data;
write_frame.datalen = (uint32_t) jb_frame->dlen;
write_frame.buflen = (uint32_t) jb_frame->dlen;
status = switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0);
if (!SWITCH_READ_ACCEPTABLE(status)) {
break;
}
}
}
stfu_n_destroy(&jb);
switch_jb_destroy(&jb);
}
SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session,

1086
src/switch_jitterbuffer.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -54,7 +54,7 @@
#include <srtp.h>
#include <srtp_priv.h>
#include <switch_ssl.h>
#include <switch_vidderbuffer.h>
#include <switch_jitterbuffer.h>
#define JITTER_LEAD_FRAMES 10
#define READ_INC(rtp_session) switch_mutex_lock(rtp_session->read_mutex); rtp_session->reading++
@ -310,7 +310,6 @@ struct switch_rtp {
uint8_t fir_seq;
uint16_t fir_count;
uint16_t pli_count;
uint32_t cur_nack;
uint32_t cur_tmmbr;
uint32_t tmmbr;
uint32_t tmmbn;
@ -404,9 +403,9 @@ struct switch_rtp {
switch_timer_t timer;
uint8_t ready;
uint8_t cn;
stfu_instance_t *jb;
switch_vb_t *vb;
switch_vb_t *vbw;
switch_jb_t *jb;
switch_jb_t *vb;
switch_jb_t *vbw;
uint32_t max_missed_packets;
uint32_t missed_count;
rtp_msg_t write_msg;
@ -625,7 +624,7 @@ static handle_rfc2833_result_t handle_rfc2833(switch_rtp_t *rtp_session, switch_
}
if (rtp_session->jb && (rtp_session->rtp_bugs & RTP_BUG_FLUSH_JB_ON_DTMF)) {
stfu_n_reset(rtp_session->jb);
switch_jb_reset(rtp_session->jb);
}
}
@ -1896,12 +1895,14 @@ static int using_ice(switch_rtp_t *rtp_session)
return 0;
}
#define MAX_NACK 10
static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
{
int ret = 0;
int rtcp_ok = 0, rtcp_fb = 0;
switch_time_t now = switch_micro_time_now();
int rate = 0;
int rate = 0, nack_ttl = 0;
uint32_t cur_nack[MAX_NACK - 1];
if (rtp_session->flags[SWITCH_RTP_FLAG_AUTO_CNG] && rtp_session->send_msg.header.ts && rtp_session->cng_pt != INVALID_PT &&
(rtp_session->timer.samplecount - rtp_session->last_write_samplecount >= rtp_session->samples_per_interval * 60)) {
@ -1922,10 +1923,23 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
rate = rtp_session->rtcp_interval;
if (rtp_session->flags[SWITCH_RTP_FLAG_NACK] && rtp_session->vb) {
int n;
for (n = 0; n < MAX_NACK; n++) {
uint32_t nack = switch_jb_pop_nack(rtp_session->vb);
if (!nack) break;
cur_nack[nack_ttl++] = nack;
}
}
if (rtp_session->rtcp_sent_packets < 4) {
rate = 4000;
} else {
if (rtp_session->pli_count || rtp_session->fir_count || rtp_session->cur_nack || rtp_session->tmmbr || rtp_session->tmmbn) {
if (rtp_session->pli_count || rtp_session->fir_count || nack_ttl || rtp_session->tmmbr || rtp_session->tmmbn) {
//switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "MARK BW/FIR ETC %d %d\n", rtp_session->pli_count, rtp_session->fir_count);
rtcp_ok = 1;
rtcp_fb = 1;
@ -1942,23 +1956,17 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
if (rtcp_ok && using_ice(rtp_session)) {
if (rtp_session->flags[SWITCH_RTP_FLAG_RTCP_MUX]) {
if (!rtp_session->ice.rready) {
//switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "FUCK 1\n");
rtcp_ok = 0;
}
} else {
if (!rtp_session->rtcp_ice.rready) {
//switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "FUCK 2\n");
rtcp_ok = 0;
}
}
}
//switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "WTF %d %d %d\n", rate, rtp_session->rtcp_sent_packets, rtcp_ok);
//switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "WTF %d %d %d %d\n", rate, rtp_session->rtcp_sent_packets, rtcp_ok, nack_ttl);
if (rtp_session->flags[SWITCH_RTP_FLAG_NACK] && rtp_session->vb) {
rtp_session->cur_nack = switch_vb_pop_nack(rtp_session->vb);
}
if (rtp_session->rtcp_sock_output && rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP] && !rtp_session->flags[SWITCH_RTP_FLAG_RTCP_PASSTHRU] && rtcp_ok) {
switch_rtcp_numbers_t * stats = &rtp_session->stats.rtcp;
struct switch_rtcp_receiver_report *rr;
@ -2032,29 +2040,34 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
rtp_session->pli_count = 0;
}
if (rtp_session->flags[SWITCH_RTP_FLAG_NACK] && rtp_session->cur_nack) {
switch_rtcp_ext_hdr_t *ext_hdr;
uint32_t *nack;
p = (uint8_t *) (&rtp_session->rtcp_send_msg) + rtcp_bytes;
ext_hdr = (switch_rtcp_ext_hdr_t *) p;
ext_hdr->version = 2;
ext_hdr->p = 0;
ext_hdr->fmt = _RTCP_RTPFB_NACK;
ext_hdr->pt = _RTCP_PT_RTPFB;
ext_hdr->send_ssrc = htonl(rtp_session->ssrc);
ext_hdr->recv_ssrc = htonl(rtp_session->remote_ssrc);
ext_hdr->length = htons(3);
p += sizeof(switch_rtcp_ext_hdr_t);
nack = (uint32_t *) p;
*nack = rtp_session->cur_nack;
if (rtp_session->flags[SWITCH_RTP_FLAG_NACK] && nack_ttl > 0) {
int n = 0;
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, "Sending RTCP NACK %u\n",
ntohs(*nack & 0xFFFF));
for (n = 0; n < nack_ttl; n++) {
switch_rtcp_ext_hdr_t *ext_hdr;
uint32_t *nack;
p = (uint8_t *) (&rtp_session->rtcp_send_msg) + rtcp_bytes;
ext_hdr = (switch_rtcp_ext_hdr_t *) p;
ext_hdr->version = 2;
ext_hdr->p = 0;
ext_hdr->fmt = _RTCP_RTPFB_NACK;
ext_hdr->pt = _RTCP_PT_RTPFB;
ext_hdr->send_ssrc = htonl(rtp_session->ssrc);
ext_hdr->recv_ssrc = htonl(rtp_session->remote_ssrc);
ext_hdr->length = htons(3);
p += sizeof(switch_rtcp_ext_hdr_t);
nack = (uint32_t *) p;
*nack = cur_nack[n];
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, "Sending RTCP NACK %u\n",
ntohs(*nack & 0xFFFF));
rtcp_bytes += sizeof(switch_rtcp_ext_hdr_t) + sizeof(rtp_session->cur_nack);
rtcp_bytes += sizeof(switch_rtcp_ext_hdr_t) + sizeof(cur_nack[n]);
}
rtp_session->cur_nack = 0;
cur_nack[n] = 0;
nack_ttl = 0;
}
if (rtp_session->fir_count) {
@ -2711,10 +2724,10 @@ SWITCH_DECLARE(void) switch_rtp_reset(switch_rtp_t *rtp_session)
if (rtp_session->ice.ready) {
if (rtp_session->vb) {
switch_vb_reset(rtp_session->vb);
switch_jb_reset(rtp_session->vb);
}
if (rtp_session->vbw) {
switch_vb_reset(rtp_session->vbw);
switch_jb_reset(rtp_session->vbw);
}
rtp_session->ice.ready = rtp_session->ice.rready = 0;
}
@ -3149,15 +3162,15 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_del_dtls(switch_rtp_t *rtp_session, d
}
if (rtp_session->jb) {
stfu_n_reset(rtp_session->jb);
switch_jb_reset(rtp_session->jb);
}
if (rtp_session->vb) {
switch_vb_reset(rtp_session->vb);
switch_jb_reset(rtp_session->vb);
}
if (rtp_session->vbw) {
switch_vb_reset(rtp_session->vbw);
switch_jb_reset(rtp_session->vbw);
}
}
@ -3719,8 +3732,8 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG, "Starting video timer.\n");
}
//switch_vb_create(&rtp_session->vb, 3, 10, rtp_session->pool);
//switch_vb_debug_level(rtp_session->vb, 10);
//switch_jb_create(&rtp_session->vb, 3, 10, rtp_session->pool);
//switch_jb_debug_level(rtp_session->vb, 10);
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG, "Not using a timer\n");
@ -3910,27 +3923,6 @@ SWITCH_DECLARE(void) switch_rtp_set_cng_pt(switch_rtp_t *rtp_session, switch_pay
rtp_session->flags[SWITCH_RTP_FLAG_AUTO_CNG] = 1;
}
static void jb_callback(stfu_instance_t *i, void *udata)
{
switch_core_session_t *session = (switch_core_session_t *) udata;
stfu_report_t r = { 0 };
stfu_n_report(i, &r);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG8,
"%s JB REPORT:\nlen: %u\nin: %u\nclean: %u\ngood: %u\nbad: %u\njitter percent %0.2f\nmissing percent %0.2f\n\n",
switch_core_session_get_name(session),
r.qlen,
r.packet_in_count,
r.clean_count,
r.consecutive_good_count,
r.consecutive_bad_count,
r.period_jitter_percent,
r.period_missing_percent
);
}
SWITCH_DECLARE(switch_timer_t *) switch_rtp_get_media_timer(switch_rtp_t *rtp_session)
{
@ -3945,7 +3937,7 @@ SWITCH_DECLARE(switch_timer_t *) switch_rtp_get_media_timer(switch_rtp_t *rtp_se
}
SWITCH_DECLARE(stfu_instance_t *) switch_rtp_get_jitter_buffer(switch_rtp_t *rtp_session)
SWITCH_DECLARE(switch_jb_t *) switch_rtp_get_jitter_buffer(switch_rtp_t *rtp_session)
{
if (!switch_rtp_ready(rtp_session) || !rtp_session->jb) {
return NULL;
@ -3966,7 +3958,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_pause_jitter_buffer(switch_rtp_t *rtp
}
if (rtp_session->pause_jb && !pause) {
stfu_n_reset(rtp_session->jb);
switch_jb_reset(rtp_session->jb);
}
rtp_session->pause_jb = pause ? 1 : 0;
@ -3986,48 +3978,35 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_deactivate_jitter_buffer(switch_rtp_t
return SWITCH_STATUS_SUCCESS;
}
static void jb_logger(const char *file, const char *func, int line, int level, const char *fmt, ...)
SWITCH_DECLARE(switch_status_t) switch_rtp_get_video_buffer_size(switch_rtp_t *rtp_session, uint32_t *min_frame_len, uint32_t *max_frame_len, uint32_t *cur_frame_len, uint32_t *highest_frame_len)
{
int ret;
char *data;
va_list ap;
va_start(ap, fmt);
ret = switch_vasprintf(&data, fmt, ap);
if (ret != -1) {
switch_log_printf(SWITCH_CHANNEL_ID_LOG_CLEAN, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%d: %s", line, data);
free(data);
}
//switch_log_printf(SWITCH_CHANNEL_ID_LOG_CLEAN, file, func, line, NULL, level, fmt, ap);
va_end(ap);
}
SWITCH_DECLARE(uint32_t) switch_rtp_get_video_buffer_size(switch_rtp_t *rtp_session)
{
uint32_t frames = 0;
if (rtp_session->vb) {
switch_vb_get_frames(rtp_session->vb, &frames, NULL);
return switch_jb_get_frames(rtp_session->vb, min_frame_len, max_frame_len, cur_frame_len, highest_frame_len);
}
return frames;
return SWITCH_STATUS_FALSE;
}
SWITCH_DECLARE(switch_status_t) switch_rtp_set_video_buffer_size(switch_rtp_t *rtp_session, uint32_t frames)
SWITCH_DECLARE(switch_status_t) switch_rtp_set_video_buffer_size(switch_rtp_t *rtp_session, uint32_t frames, uint32_t max_frames)
{
if (!switch_rtp_ready(rtp_session)) {
return SWITCH_STATUS_FALSE;
}
if (!rtp_session->vb) {
switch_vb_create(&rtp_session->vb, frames, frames * 3, rtp_session->pool);
if (!max_frames) {
max_frames = frames * 2;
}
if (!rtp_session->vb) {
switch_jb_create(&rtp_session->vb, SJB_VIDEO, frames, max_frames, rtp_session->pool);
switch_jb_set_session(rtp_session->vb, rtp_session->session);
} else {
switch_vb_set_frames(rtp_session->vb, frames, frames * 3);
switch_jb_set_frames(rtp_session->vb, frames, max_frames);
}
//switch_rtp_flush(rtp_session);
//switch_core_session_request_video_refresh(rtp_session->session);
switch_core_session_request_video_refresh(rtp_session->session);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG, "Setting video buffer %u Frames.\n", frames);
@ -4036,22 +4015,19 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_set_video_buffer_size(switch_rtp_t *r
SWITCH_DECLARE(switch_status_t) switch_rtp_debug_jitter_buffer(switch_rtp_t *rtp_session, const char *name)
{
int x = 0;
if (!switch_rtp_ready(rtp_session)) {
return SWITCH_STATUS_FALSE;
}
if (name) x = atoi(name);
if (x < 0) x = 0;
if (rtp_session->jb) {
stfu_n_debug(rtp_session->jb, name);
stfu_global_set_logger(jb_logger);
switch_jb_debug_level(rtp_session->jb, x);
} else if (rtp_session->vb) {
int x = 0;
if (name) x = atoi(name);
if (x < 0) x = 0;
switch_vb_debug_level(rtp_session->vb, x);
switch_jb_debug_level(rtp_session->vb, x);
}
return SWITCH_STATUS_SUCCESS;
@ -4061,9 +4037,9 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_jitter_buffer(switch_rtp_t *
uint32_t queue_frames,
uint32_t max_queue_frames,
uint32_t samples_per_packet,
uint32_t samples_per_second,
uint32_t max_drift)
uint32_t samples_per_second)
{
switch_status_t status = SWITCH_STATUS_FALSE;
if (!switch_rtp_ready(rtp_session)) {
return SWITCH_STATUS_FALSE;
@ -4080,21 +4056,15 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_jitter_buffer(switch_rtp_t *
READ_INC(rtp_session);
if (rtp_session->jb) {
stfu_n_destroy(&rtp_session->jb);
status = switch_jb_set_frames(rtp_session->jb, queue_frames, max_queue_frames);
} else {
status = switch_jb_create(&rtp_session->jb, SJB_AUDIO, queue_frames, max_queue_frames, rtp_session->pool);
switch_jb_set_session(rtp_session->jb, rtp_session->session);
}
rtp_session->jb = stfu_n_init(queue_frames, max_queue_frames, samples_per_packet, samples_per_second, max_drift);
READ_DEC(rtp_session);
if (rtp_session->jb) {
stfu_n_call_me(rtp_session->jb, jb_callback, rtp_session->session);
return SWITCH_STATUS_SUCCESS;
}
return SWITCH_STATUS_FALSE;
return status;
}
SWITCH_DECLARE(switch_status_t) switch_rtp_activate_rtcp(switch_rtp_t *rtp_session, int send_rate, switch_port_t remote_port, switch_bool_t mux)
@ -4416,15 +4386,15 @@ SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session)
}
if ((*rtp_session)->jb) {
stfu_n_destroy(&(*rtp_session)->jb);
switch_jb_destroy(&(*rtp_session)->jb);
}
if ((*rtp_session)->vb) {
switch_vb_destroy(&(*rtp_session)->vb);
switch_jb_destroy(&(*rtp_session)->vb);
}
if ((*rtp_session)->vbw) {
switch_vb_destroy(&(*rtp_session)->vbw);
switch_jb_destroy(&(*rtp_session)->vbw);
}
if ((*rtp_session)->dtls && (*rtp_session)->dtls == (*rtp_session)->rtcp_dtls) {
@ -4624,7 +4594,7 @@ SWITCH_DECLARE(void) switch_rtp_set_flag(switch_rtp_t *rtp_session, switch_rtp_f
if (rtp_session->jb) {
stfu_n_reset(rtp_session->jb);
switch_jb_reset(rtp_session->jb);
}
} else if (flag == SWITCH_RTP_FLAG_NOBLOCK && rtp_session->sock_input) {
switch_socket_opt_set(rtp_session->sock_input, SWITCH_SO_NONBLOCK, TRUE);
@ -4899,15 +4869,15 @@ static void do_flush(switch_rtp_t *rtp_session, int force)
if (switch_rtp_ready(rtp_session) ) {
if (rtp_session->jb && !rtp_session->pause_jb && jb_valid(rtp_session)) {
stfu_n_reset(rtp_session->jb);
switch_jb_reset(rtp_session->jb);
}
//if (rtp_session->vb) {
// switch_vb_reset(rtp_session->vb);
// switch_jb_reset(rtp_session->vb);
//}
if (rtp_session->vbw) {
switch_vb_reset(rtp_session->vbw);
switch_jb_reset(rtp_session->vbw);
}
if (rtp_session->flags[SWITCH_RTP_FLAG_DEBUG_RTP_READ]) {
@ -4950,13 +4920,6 @@ static void do_flush(switch_rtp_t *rtp_session, int force)
}
} while (bytes > 0);
#if 0
if (rtp_session->jb && flushed) {
stfu_n_sync(rtp_session->jb, flushed);
reset_jitter_seq(rtp_session);
}
#endif
if (was_blocking && switch_rtp_ready(rtp_session)) {
switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_NOBLOCK);
switch_socket_opt_set(rtp_session->sock_input, SWITCH_SO_NONBLOCK, FALSE);
@ -5004,7 +4967,6 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
switch_status_t poll_status, switch_bool_t return_jb_packet)
{
switch_status_t status = SWITCH_STATUS_FALSE;
stfu_frame_t *jb_frame;
uint32_t ts = 0;
unsigned char *b = NULL;
int sync = 0;
@ -5432,25 +5394,25 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
if (rtp_session->flags[SWITCH_RTP_FLAG_KILL_JB]) {
rtp_session->flags[SWITCH_RTP_FLAG_KILL_JB] = 0;
if (rtp_session->jb) {
stfu_n_destroy(&rtp_session->jb);
switch_jb_destroy(&rtp_session->jb);
}
}
if (rtp_session->recv_msg.header.version == 2 && *bytes) {
if (rtp_session->vb) {
switch_vb_put_packet(rtp_session->vb, (switch_rtp_packet_t *) &rtp_session->recv_msg, *bytes);
if (rtp_session->vb && jb_valid(rtp_session)) {
switch_jb_put_packet(rtp_session->vb, (switch_rtp_packet_t *) &rtp_session->recv_msg, *bytes);
status = SWITCH_STATUS_FALSE;
*bytes = 0;
}
if (rtp_session->jb && !rtp_session->pause_jb && jb_valid(rtp_session)) {
if (rtp_session->jb && jb_valid(rtp_session)) {
uint32_t read_ssrc = ntohl(rtp_session->last_rtp_hdr.ssrc);
if (rtp_session->recv_msg.header.m && rtp_session->recv_msg.header.pt != rtp_session->recv_te &&
!rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] && !(rtp_session->rtp_bugs & RTP_BUG_IGNORE_MARK_BIT)) {
stfu_n_reset(rtp_session->jb);
switch_jb_reset(rtp_session->jb);
} else if (rtp_session->last_jb_read_ssrc && rtp_session->last_jb_read_ssrc != read_ssrc) {
stfu_n_reset(rtp_session->jb);
switch_jb_reset(rtp_session->jb);
}
rtp_session->last_jb_read_ssrc = read_ssrc;
@ -5459,13 +5421,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
reset_jitter_seq(rtp_session);
}
if (stfu_n_eat(rtp_session->jb, rtp_session->last_read_ts,
ntohs((uint16_t) rtp_session->recv_msg.header.seq),
rtp_session->recv_msg.header.pt,
RTP_BODY(rtp_session), *bytes - rtp_header_len, rtp_session->timer.samplecount) == STFU_ITS_TOO_LATE) {
goto more;
}
switch_jb_put_packet(rtp_session->jb, (switch_rtp_packet_t *) &rtp_session->recv_msg, *bytes);
status = SWITCH_STATUS_FALSE;
*bytes = 0;
@ -5473,41 +5429,33 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
if (!return_jb_packet) {
return status;
}
}
}
if (!*bytes || rtp_session->recv_msg.header.version == 2) {
if (rtp_session->jb && !rtp_session->pause_jb && jb_valid(rtp_session)) {
if ((jb_frame = stfu_n_read_a_frame(rtp_session->jb))) {
memcpy(RTP_BODY(rtp_session), jb_frame->data, jb_frame->dlen);
switch_status_t jstatus = switch_jb_get_packet(rtp_session->jb, (switch_rtp_packet_t *) &rtp_session->recv_msg, bytes);
if (jb_frame->plc) {
(*flags) |= SFF_PLC;
} else {
rtp_session->stats.inbound.jb_packet_count++;
}
*bytes = jb_frame->dlen + rtp_header_len;
rtp_session->recv_msg.header.version = 2;
rtp_session->recv_msg.header.x = 0;
rtp_session->recv_msg.header.ts = htonl(jb_frame->ts);
rtp_session->recv_msg.header.pt = jb_frame->pt;
rtp_session->recv_msg.header.seq = htons(jb_frame->seq);
rtp_session->recv_msg.header.ssrc = ntohl(rtp_session->remote_ssrc);
rtp_session->last_rtp_hdr = rtp_session->recv_msg.header;
if (jstatus == SWITCH_STATUS_NOTFOUND) {
(*flags) |= SFF_PLC;
status = SWITCH_STATUS_SUCCESS;
rtp_session->recv_msg.header = rtp_session->last_rtp_hdr;
*bytes = switch_jb_get_last_read_len(rtp_session->jb);
} else if (jstatus == SWITCH_STATUS_SUCCESS) {
rtp_session->stats.inbound.jb_packet_count++;
status = SWITCH_STATUS_SUCCESS;
rtp_session->last_rtp_hdr = rtp_session->recv_msg.header;
if (!xcheck_jitter) {
check_jitter(rtp_session);
xcheck_jitter = *bytes;
}
}
}
if (rtp_session->vb) {
switch_status_t vstatus = switch_vb_get_packet(rtp_session->vb, (switch_rtp_packet_t *) &rtp_session->recv_msg, bytes);
if (rtp_session->vb && jb_valid(rtp_session)) {
switch_status_t vstatus = switch_jb_get_packet(rtp_session->vb, (switch_rtp_packet_t *) &rtp_session->recv_msg, bytes);
status = vstatus;
switch(vstatus) {
@ -5561,7 +5509,7 @@ static void handle_nack(switch_rtp_t *rtp_session, uint32_t nack)
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, "Got NACK [%u][0x%x] for seq %u\n", nack, nack, ntohs(seq));
if (switch_vb_get_packet_by_seq(rtp_session->vbw, seq, (switch_rtp_packet_t *) send_msg, &bytes) == SWITCH_STATUS_SUCCESS) {
if (switch_jb_get_packet_by_seq(rtp_session->vbw, seq, (switch_rtp_packet_t *) send_msg, &bytes) == SWITCH_STATUS_SUCCESS) {
if (rtp_session->flags[SWITCH_RTP_FLAG_DEBUG_RTP_WRITE]) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(rtp_session->session), SWITCH_LOG_CONSOLE,
@ -5586,7 +5534,7 @@ static void handle_nack(switch_rtp_t *rtp_session, uint32_t nack)
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, "Also Got NACK for seq %u\n", ntohs(seq) + i + 1);
/* If they are missing more than one, may as well gen a key frame for good measure */
switch_core_media_gen_key_frame(rtp_session->session);
if (switch_vb_get_packet_by_seq(rtp_session->vbw, htons(ntohs(seq) + i + 1), (switch_rtp_packet_t *) &send_msg, &bytes) == SWITCH_STATUS_SUCCESS) {
if (switch_jb_get_packet_by_seq(rtp_session->vbw, htons(ntohs(seq) + i + 1), (switch_rtp_packet_t *) &send_msg, &bytes) == SWITCH_STATUS_SUCCESS) {
if (rtp_session->flags[SWITCH_RTP_FLAG_DEBUG_RTP_WRITE]) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(rtp_session->session), SWITCH_LOG_CONSOLE,
"X %s b=%4ld %s:%u %s:%u %s:%u pt=%d ts=%u seq=%u m=%d\n",
@ -5625,7 +5573,7 @@ static switch_status_t process_rtcp_report(switch_rtp_t *rtp_session, rtcp_msg_t
if (msg->header.type == _RTCP_PT_PSFB && (extp->header.fmt == _RTCP_PSFB_FIR || extp->header.fmt == _RTCP_PSFB_PLI)) {
switch_core_media_gen_key_frame(rtp_session->session);
if (rtp_session->vbw) {
switch_vb_reset(rtp_session->vbw);
switch_jb_reset(rtp_session->vbw);
}
}
@ -5709,7 +5657,7 @@ static switch_status_t process_rtcp_report(switch_rtp_t *rtp_session, rtcp_msg_t
}
if (!rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] && rtp_session->rtcp_frame.reports[i].loss_avg != old_avg) {
switch_core_media_codec_control(rtp_session->session, SWITCH_MEDIA_TYPE_AUDIO, SWITCH_IO_WRITE, SCC_AUDIO_PACKET_LOSS, SCCT_INT, (void *)&rtp_session->rtcp_frame.reports[i].loss_avg, NULL, NULL);
switch_core_media_codec_control(rtp_session->session, SWITCH_MEDIA_TYPE_AUDIO, SWITCH_IO_WRITE, SCC_AUDIO_PACKET_LOSS, SCCT_INT, (void *)&rtp_session->rtcp_frame.reports[i].loss_avg, SCCT_NONE, NULL, NULL, NULL);
}
rtp_session->rtcp_frame.reports[i].ssrc = ntohl(report->ssrc);
@ -6099,7 +6047,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
}
if (rtp_session->vb) {
if (switch_vb_poll(rtp_session->vb)) {
if (switch_jb_poll(rtp_session->vb)) {
pt = 0;
}
}
@ -6125,7 +6073,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
}
if (poll_status == SWITCH_STATUS_SUCCESS || (rtp_session->vb && switch_vb_poll(rtp_session->vb))) {
if (poll_status == SWITCH_STATUS_SUCCESS || (rtp_session->vb && switch_jb_poll(rtp_session->vb))) {
got_rtp_poll = 1;
@ -7330,10 +7278,10 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
if (rtp_session->flags[SWITCH_RTP_FLAG_NACK]) {
if (!rtp_session->vbw) {
switch_vb_create(&rtp_session->vbw, 10, 10, rtp_session->pool);
//switch_vb_debug_level(rtp_session->vbw, 10);
switch_jb_create(&rtp_session->vbw, SJB_VIDEO, 10, 10, rtp_session->pool);
//switch_jb_debug_level(rtp_session->vbw, 10);
}
switch_vb_push_packet(rtp_session->vbw, (switch_rtp_packet_t *)send_msg, bytes);
switch_jb_push_packet(rtp_session->vbw, (switch_rtp_packet_t *)send_msg, bytes);
}
#ifdef RTP_WRITE_PLOSS
@ -7690,7 +7638,7 @@ SWITCH_DECLARE(switch_rtp_stats_t *) switch_rtp_get_stats(switch_rtp_t *rtp_sess
}
if (rtp_session->jb) {
s->inbound.largest_jb_size = stfu_n_get_most_qlen(rtp_session->jb);
switch_jb_get_frames(rtp_session->jb, NULL, NULL, NULL, (uint32_t *)&s->inbound.largest_jb_size);
}
do_mos(rtp_session, SWITCH_FALSE);

File diff suppressed because it is too large Load Diff

View File

@ -1,687 +0,0 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
*
* The Initial Developer of the Original Code is
* Anthony Minessale II <anthm@freeswitch.org>
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Anthony Minessale II <anthm@freeswitch.org>
*
* switch_vidderbuffer.c -- Video Buffer
*
*/
#include <switch.h>
#include <switch_vidderbuffer.h>
#define MAX_MISSING_SEQ 20
#define vb_debug(_vb, _level, _format, ...) if (_vb->debug_level >= _level) switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ALERT, "VB:%p level:%d line:%d ->" _format, (void *) _vb, _level, __LINE__, __VA_ARGS__)
const char *TOKEN_1 = "ONE";
const char *TOKEN_2 = "TWO";
struct switch_vb_s;
typedef struct switch_vb_node_s {
struct switch_vb_s *parent;
switch_rtp_packet_t packet;
uint32_t len;
uint8_t visible;
struct switch_vb_node_s *prev;
struct switch_vb_node_s *next;
} switch_vb_node_t;
struct switch_vb_s {
struct switch_vb_node_s *node_list;
uint32_t last_target_seq;
uint32_t highest_read_ts;
uint32_t highest_read_seq;
uint32_t highest_wrote_ts;
uint32_t highest_wrote_seq;
uint16_t target_seq;
uint32_t visible_nodes;
uint32_t complete_frames;
uint32_t frame_len;
uint32_t min_frame_len;
uint32_t max_frame_len;
uint8_t write_init;
uint8_t read_init;
uint8_t debug_level;
uint16_t next_seq;
switch_inthash_t *missing_seq_hash;
switch_inthash_t *node_hash;
switch_mutex_t *mutex;
switch_mutex_t *list_mutex;
switch_memory_pool_t *pool;
int free_pool;
switch_vb_flag_t flags;
};
static inline switch_vb_node_t *new_node(switch_vb_t *vb)
{
switch_vb_node_t *np;
switch_mutex_lock(vb->list_mutex);
for (np = vb->node_list; np; np = np->next) {
if (!np->visible) {
break;
}
}
if (!np) {
np = switch_core_alloc(vb->pool, sizeof(*np));
np->next = vb->node_list;
if (np->next) {
np->next->prev = np;
}
vb->node_list = np;
}
switch_assert(np);
np->visible = 1;
vb->visible_nodes++;
np->parent = vb;
switch_mutex_unlock(vb->list_mutex);
return np;
}
static inline void push_to_top(switch_vb_t *vb, switch_vb_node_t *node)
{
if (node == vb->node_list) {
vb->node_list = node->next;
} else if (node->prev) {
node->prev->next = node->next;
}
if (node->next) {
node->next->prev = node->prev;
}
node->next = vb->node_list;
node->prev = NULL;
if (node->next) {
node->next->prev = node;
}
vb->node_list = node;
switch_assert(node->next != node);
switch_assert(node->prev != node);
}
static inline void hide_node(switch_vb_node_t *node, switch_bool_t pop)
{
switch_vb_t *vb = node->parent;
switch_mutex_lock(vb->list_mutex);
if (node->visible) {
node->visible = 0;
vb->visible_nodes--;
if (pop) {
push_to_top(vb, node);
}
}
switch_core_inthash_delete(vb->node_hash, node->packet.header.seq);
switch_mutex_unlock(vb->list_mutex);
}
static inline void sort_free_nodes(switch_vb_t *vb)
{
switch_vb_node_t *np, *this_np;
int start = 0;
switch_mutex_lock(vb->list_mutex);
np = vb->node_list;
while(np) {
this_np = np;
np = np->next;
if (this_np->visible) {
start++;
}
if (start && !this_np->visible) {
push_to_top(vb, this_np);
}
}
switch_mutex_unlock(vb->list_mutex);
}
static inline void hide_nodes(switch_vb_t *vb)
{
switch_vb_node_t *np;
switch_mutex_lock(vb->list_mutex);
for (np = vb->node_list; np; np = np->next) {
hide_node(np, SWITCH_FALSE);
}
switch_mutex_unlock(vb->list_mutex);
}
static inline void drop_ts(switch_vb_t *vb, uint32_t ts)
{
switch_vb_node_t *np;
int x = 0;
switch_mutex_lock(vb->list_mutex);
for (np = vb->node_list; np; np = np->next) {
if (!np->visible) continue;
if (ts == np->packet.header.ts) {
hide_node(np, SWITCH_FALSE);
x++;
}
}
if (x) {
sort_free_nodes(vb);
}
switch_mutex_unlock(vb->list_mutex);
if (x) vb->complete_frames--;
}
static inline uint32_t vb_find_lowest_ts(switch_vb_t *vb)
{
switch_vb_node_t *np, *lowest = NULL;
switch_mutex_lock(vb->list_mutex);
for (np = vb->node_list; np; np = np->next) {
if (!np->visible) continue;
if (!lowest || ntohl(lowest->packet.header.ts) > ntohl(np->packet.header.ts)) {
lowest = np;
}
}
switch_mutex_unlock(vb->list_mutex);
return lowest ? lowest->packet.header.ts : 0;
}
static inline void drop_oldest_frame(switch_vb_t *vb)
{
uint32_t ts = vb_find_lowest_ts(vb);
drop_ts(vb, ts);
vb_debug(vb, 1, "Dropping oldest frame ts:%u\n", ntohl(ts));
}
static inline void add_node(switch_vb_t *vb, switch_rtp_packet_t *packet, switch_size_t len)
{
switch_vb_node_t *node = new_node(vb);
node->packet = *packet;
node->len = len;
memcpy(node->packet.body, packet->body, len);
switch_core_inthash_insert(vb->node_hash, node->packet.header.seq, node);
vb_debug(vb, (packet->header.m ? 1 : 2), "PUT packet last_ts:%u ts:%u seq:%u%s\n",
ntohl(vb->highest_wrote_ts), ntohl(node->packet.header.ts), ntohs(node->packet.header.seq), packet->header.m ? " <MARK>" : "");
if (vb->write_init && ((abs(((int)htons(packet->header.seq) - htons(vb->highest_wrote_seq))) > 16) ||
(abs((int)((int64_t)ntohl(node->packet.header.ts) - (int64_t)ntohl(vb->highest_wrote_ts))) > 900000))) {
vb_debug(vb, 2, "%s", "CHANGE DETECTED, PUNT\n");
switch_vb_reset(vb);
}
if (!vb->write_init || ntohs(packet->header.seq) > ntohs(vb->highest_wrote_seq) ||
(ntohs(vb->highest_wrote_seq) > USHRT_MAX - 10 && ntohs(packet->header.seq) <= 10) ) {
vb->highest_wrote_seq = packet->header.seq;
}
if (vb->write_init && htons(packet->header.seq) >= htons(vb->highest_wrote_seq) && (ntohl(node->packet.header.ts) > ntohl(vb->highest_wrote_ts))) {
vb->complete_frames++;
vb_debug(vb, 2, "WRITE frame ts: %u complete=%u/%u n:%u\n", ntohl(node->packet.header.ts), vb->complete_frames , vb->frame_len, vb->visible_nodes);
vb->highest_wrote_ts = packet->header.ts;
} else if (!vb->write_init) {
vb->highest_wrote_ts = packet->header.ts;
}
if (!vb->write_init) vb->write_init = 1;
if (vb->complete_frames > vb->max_frame_len) {
drop_oldest_frame(vb);
}
}
static inline void increment_seq(switch_vb_t *vb)
{
vb->target_seq = htons((ntohs(vb->target_seq) + 1));
}
static inline void set_read_seq(switch_vb_t *vb, uint16_t seq)
{
vb->last_target_seq = seq;
vb->target_seq = htons((ntohs(vb->last_target_seq) + 1));
}
static inline switch_vb_node_t *vb_find_lowest_seq(switch_vb_t *vb)
{
switch_vb_node_t *np, *lowest = NULL;
switch_mutex_lock(vb->list_mutex);
for (np = vb->node_list; np; np = np->next) {
if (!np->visible) continue;
if (!lowest || ntohs(lowest->packet.header.seq) > ntohs(np->packet.header.seq)) {
lowest = np;
}
}
switch_mutex_unlock(vb->list_mutex);
return lowest;
}
static inline switch_status_t vb_next_packet(switch_vb_t *vb, switch_vb_node_t **nodep)
{
switch_vb_node_t *node = NULL;
if (!vb->target_seq) {
if ((node = vb_find_lowest_seq(vb))) {
vb_debug(vb, 2, "No target seq using seq: %u as a starting point\n", ntohs(node->packet.header.seq));
} else {
vb_debug(vb, 1, "%s", "No nodes available....\n");
}
} else if ((node = switch_core_inthash_find(vb->node_hash, vb->target_seq))) {
vb_debug(vb, 2, "FOUND desired seq: %u\n", ntohs(vb->target_seq));
} else {
int x;
vb_debug(vb, 2, "MISSING desired seq: %u\n", ntohs(vb->target_seq));
for (x = 0; x < 10; x++) {
increment_seq(vb);
if ((node = switch_core_inthash_find(vb->node_hash, vb->target_seq))) {
vb_debug(vb, 2, "FOUND incremental seq: %u\n", ntohs(vb->target_seq));
break;
} else {
vb_debug(vb, 2, "MISSING incremental seq: %u\n", ntohs(vb->target_seq));
}
}
}
*nodep = node;
if (node) {
set_read_seq(vb, node->packet.header.seq);
return SWITCH_STATUS_SUCCESS;
}
return SWITCH_STATUS_NOTFOUND;
}
static inline void free_nodes(switch_vb_t *vb)
{
switch_mutex_lock(vb->list_mutex);
vb->node_list = NULL;
switch_mutex_unlock(vb->list_mutex);
}
SWITCH_DECLARE(void) switch_vb_set_flag(switch_vb_t *vb, switch_vb_flag_t flag)
{
switch_set_flag(vb, flag);
}
SWITCH_DECLARE(void) switch_vb_clear_flag(switch_vb_t *vb, switch_vb_flag_t flag)
{
switch_clear_flag(vb, flag);
}
SWITCH_DECLARE(int) switch_vb_poll(switch_vb_t *vb)
{
return (vb->complete_frames >= vb->frame_len);
}
SWITCH_DECLARE(int) switch_vb_frame_count(switch_vb_t *vb)
{
return vb->complete_frames;
}
SWITCH_DECLARE(void) switch_vb_debug_level(switch_vb_t *vb, uint8_t level)
{
vb->debug_level = level;
}
SWITCH_DECLARE(void) switch_vb_reset(switch_vb_t *vb)
{
switch_mutex_lock(vb->mutex);
switch_core_inthash_destroy(&vb->missing_seq_hash);
switch_core_inthash_init(&vb->missing_seq_hash);
switch_mutex_unlock(vb->mutex);
vb_debug(vb, 2, "%s", "RESET BUFFER\n");
vb->last_target_seq = 0;
vb->target_seq = 0;
vb->write_init = 0;
vb->highest_wrote_seq = 0;
vb->highest_wrote_ts = 0;
vb->next_seq = 0;
vb->highest_read_ts = 0;
vb->highest_read_seq = 0;
vb->complete_frames = 0;
vb->read_init = 0;
vb->next_seq = 0;
vb->complete_frames = 0;
switch_mutex_lock(vb->mutex);
hide_nodes(vb);
switch_mutex_unlock(vb->mutex);
}
SWITCH_DECLARE(switch_status_t) switch_vb_get_frames(switch_vb_t *vb, uint32_t *min_frame_len, uint32_t *max_frame_len)
{
switch_mutex_lock(vb->mutex);
if (min_frame_len) {
*min_frame_len = vb->min_frame_len;
}
if (max_frame_len) {
*max_frame_len = vb->max_frame_len;
}
switch_mutex_unlock(vb->mutex);
return SWITCH_STATUS_SUCCESS;
}
SWITCH_DECLARE(switch_status_t) switch_vb_set_frames(switch_vb_t *vb, uint32_t min_frame_len, uint32_t max_frame_len)
{
switch_mutex_lock(vb->mutex);
vb->min_frame_len = vb->frame_len = min_frame_len;
vb->max_frame_len = max_frame_len;
switch_mutex_unlock(vb->mutex);
return SWITCH_STATUS_SUCCESS;
}
SWITCH_DECLARE(switch_status_t) switch_vb_create(switch_vb_t **vbp, uint32_t min_frame_len, uint32_t max_frame_len, switch_memory_pool_t *pool)
{
switch_vb_t *vb;
int free_pool = 0;
if (!pool) {
switch_core_new_memory_pool(&pool);
free_pool = 1;
}
vb = switch_core_alloc(pool, sizeof(*vb));
vb->free_pool = free_pool;
vb->min_frame_len = vb->frame_len = min_frame_len;
vb->max_frame_len = max_frame_len;
vb->pool = pool;
switch_core_inthash_init(&vb->missing_seq_hash);
switch_core_inthash_init(&vb->node_hash);
switch_mutex_init(&vb->mutex, SWITCH_MUTEX_NESTED, pool);
switch_mutex_init(&vb->list_mutex, SWITCH_MUTEX_NESTED, pool);
*vbp = vb;
return SWITCH_STATUS_SUCCESS;
}
SWITCH_DECLARE(switch_status_t) switch_vb_destroy(switch_vb_t **vbp)
{
switch_vb_t *vb = *vbp;
*vbp = NULL;
switch_core_inthash_destroy(&vb->missing_seq_hash);
switch_core_inthash_destroy(&vb->node_hash);
free_nodes(vb);
if (vb->free_pool) {
switch_core_destroy_memory_pool(&vb->pool);
}
return SWITCH_STATUS_SUCCESS;
}
SWITCH_DECLARE(uint32_t) switch_vb_pop_nack(switch_vb_t *vb)
{
switch_hash_index_t *hi = NULL;
uint32_t nack = 0;
uint16_t blp = 0;
uint16_t least = 0;
int i = 0;
void *val;
const void *var;
switch_mutex_lock(vb->mutex);
for (hi = switch_core_hash_first(vb->missing_seq_hash); hi; hi = switch_core_hash_next(&hi)) {
uint16_t seq;
const char *token;
switch_core_hash_this(hi, &var, NULL, &val);
token = (const char *) val;
if (token == TOKEN_2) {
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "SKIP %u %s\n", ntohs(*((uint16_t *) var)), token);
continue;
}
seq = ntohs(*((uint16_t *) var));
if (!least || seq < least) {
least = seq;
}
}
if (least && switch_core_inthash_delete(vb->missing_seq_hash, (uint32_t)htons(least))) {
vb_debug(vb, 3, "Found smallest NACKABLE seq %u\n", least);
nack = (uint32_t) htons(least);
switch_core_inthash_insert(vb->missing_seq_hash, nack, (void *) TOKEN_2);
for(i = 0; i < 16; i++) {
if (switch_core_inthash_delete(vb->missing_seq_hash, (uint32_t)htons(least + i + 1))) {
switch_core_inthash_insert(vb->missing_seq_hash, (uint32_t)htons(least + i + 1), (void *) TOKEN_2);
vb_debug(vb, 3, "Found addtl NACKABLE seq %u\n", least + i + 1);
blp |= (1 << i);
}
}
blp = htons(blp);
nack |= (uint32_t) blp << 16;
}
switch_mutex_unlock(vb->mutex);
return nack;
}
SWITCH_DECLARE(switch_status_t) switch_vb_push_packet(switch_vb_t *vb, switch_rtp_packet_t *packet, switch_size_t len)
{
add_node(vb, packet, len);
return SWITCH_STATUS_SUCCESS;
}
SWITCH_DECLARE(switch_status_t) switch_vb_put_packet(switch_vb_t *vb, switch_rtp_packet_t *packet, switch_size_t len)
{
uint32_t i;
uint16_t want = ntohs(vb->next_seq), got = ntohs(packet->header.seq);
int missing = 0;
switch_mutex_lock(vb->mutex);
if (!want) want = got;
if (switch_test_flag(vb, SVB_QUEUE_ONLY)) {
vb->next_seq = htons(got + 1);
} else {
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "WTF %u\n", got);
if (switch_core_inthash_delete(vb->missing_seq_hash, (uint32_t)htons(got))) {
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "POPPED RESEND %u\n", got);
missing = 1;
}
if (!missing || want == got) {
if (got > want) {
//vb_debug(vb, 2, "GOT %u WANTED %u; MARK SEQS MISSING %u - %u\n", got, want, want, got - 1);
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "XXXXXXXXXXXXXXXXXX WTF GOT %u WANTED %u; MARK SEQS MISSING %u - %u\n", got, want, want, got - 1);
for (i = want; i < got; i++) {
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "MISSING %u\n", i);
switch_core_inthash_insert(vb->missing_seq_hash, (uint32_t)htons(i), (void *)TOKEN_1);
}
}
if (got >= want || (want - got) > 1000) {
vb->next_seq = htons(got + 1);
}
}
}
add_node(vb, packet, len);
switch_mutex_unlock(vb->mutex);
return SWITCH_STATUS_SUCCESS;
}
SWITCH_DECLARE(switch_status_t) switch_vb_get_packet_by_seq(switch_vb_t *vb, uint16_t seq, switch_rtp_packet_t *packet, switch_size_t *len)
{
switch_vb_node_t *node;
if ((node = switch_core_inthash_find(vb->node_hash, seq))) {
vb_debug(vb, 2, "Found buffered seq: %u\n", ntohs(seq));
*packet = node->packet;
*len = node->len;
memcpy(packet->body, node->packet.body, node->len);
return SWITCH_STATUS_SUCCESS;
} else {
vb_debug(vb, 2, "Missing buffered seq: %u\n", ntohs(seq));
}
return SWITCH_STATUS_NOTFOUND;
}
SWITCH_DECLARE(switch_status_t) switch_vb_get_packet(switch_vb_t *vb, switch_rtp_packet_t *packet, switch_size_t *len)
{
switch_vb_node_t *node = NULL;
switch_status_t status;
switch_mutex_lock(vb->mutex);
vb_debug(vb, 2, "GET PACKET %u/%u n:%d\n", vb->complete_frames , vb->frame_len, vb->visible_nodes);
if (vb->complete_frames < vb->frame_len) {
vb_debug(vb, 2, "BUFFERING %u/%u\n", vb->complete_frames , vb->frame_len);
switch_goto_status(SWITCH_STATUS_MORE_DATA, end);
}
if ((status = vb_next_packet(vb, &node)) == SWITCH_STATUS_SUCCESS) {
vb_debug(vb, 2, "Found next frame cur ts: %u seq: %u\n", htonl(node->packet.header.ts), htons(node->packet.header.seq));
if (!vb->read_init || ntohs(node->packet.header.seq) > ntohs(vb->highest_read_seq) ||
(ntohs(vb->highest_read_seq) > USHRT_MAX - 10 && ntohs(node->packet.header.seq) <= 10) ) {
vb->highest_read_seq = node->packet.header.seq;
}
if (vb->read_init && htons(node->packet.header.seq) >= htons(vb->highest_read_seq) && (ntohl(node->packet.header.ts) > ntohl(vb->highest_read_ts))) {
vb->complete_frames--;
vb_debug(vb, 2, "READ frame ts: %u complete=%u/%u n:%u\n", ntohl(node->packet.header.ts), vb->complete_frames , vb->frame_len, vb->visible_nodes);
vb->highest_read_ts = node->packet.header.ts;
} else if (!vb->read_init) {
vb->highest_read_ts = node->packet.header.ts;
}
if (!vb->read_init) vb->read_init = 1;
} else {
switch_vb_reset(vb);
switch(status) {
case SWITCH_STATUS_RESTART:
vb_debug(vb, 2, "%s", "Error encountered ask for new keyframe\n");
switch_goto_status(SWITCH_STATUS_RESTART, end);
case SWITCH_STATUS_NOTFOUND:
default:
vb_debug(vb, 2, "%s", "No frames found wait for more\n");
switch_goto_status(SWITCH_STATUS_MORE_DATA, end);
}
}
if (node) {
status = SWITCH_STATUS_SUCCESS;
*packet = node->packet;
*len = node->len;
memcpy(packet->body, node->packet.body, node->len);
hide_node(node, SWITCH_TRUE);
vb_debug(vb, 1, "GET packet ts:%u seq:%u %s\n", ntohl(packet->header.ts), ntohs(packet->header.seq), packet->header.m ? " <MARK>" : "");
} else {
status = SWITCH_STATUS_MORE_DATA;
}
end:
switch_mutex_unlock(vb->mutex);
return status;
}
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -34,9 +34,6 @@
<ClCompile Include="..\..\libs\libnatpmp\natpmp.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\switch_stfu.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\switch_apr.c">
<Filter>Source Files</Filter>
</ClCompile>
@ -255,9 +252,6 @@
<ClInclude Include="..\..\src\include\switch_caller.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\include\switch_stfu.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\include\switch_channel.h">
<Filter>Header Files</Filter>
</ClInclude>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
@ -114,7 +114,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\sqlite-amalgamation-3080401;..\..\libs\pcre-8.34;..\..\libs\speex-1.2rc1\include;..\..\libs\curl-7.35.0\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\tiff-4.0.2\libtiff;..\..\libs\libzrtp\include;..\..\libs\libzrtp\third_party\bgaes;..\..\libs\libzrtp\third_party\bnlib;..\..\libs\libtpl-1.5\src;..\..\libs\libtpl-1.5\src\win;..\..\libs\openssl-$(OpenSSLVersion)\include;..\..\libs\sofia-sip\libsofia-sip-ua\sdp;..\..\libs\sofia-sip\libsofia-sip-ua\su;..\..\libs\sofia-sip\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;PCRE_STATIC;STATICLIB;ENABLE_ZRTP;TPL_NOLIB;STFU_EXPORTS;LIBSOFIA_SIP_UA_STATIC;HAVE_OPENSSL;HAVE_OPENSSL_DTLS_SRTP;HAVE_OPENSSL_DTLS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;PCRE_STATIC;STATICLIB;ENABLE_ZRTP;TPL_NOLIB;LIBSOFIA_SIP_UA_STATIC;HAVE_OPENSSL;HAVE_OPENSSL_DTLS_SRTP;HAVE_OPENSSL_DTLS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@ -177,7 +177,7 @@ if not exist "$(OutDir)htdocs" xcopy "$(SolutionDir)htdocs\*.*" "$(OutDir)htdocs
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\sqlite-amalgamation-3080401;..\..\libs\pcre-8.34;..\..\libs\speex-1.2rc1\include;..\..\libs\curl-7.35.0\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\tiff-4.0.2\libtiff;..\..\libs\libzrtp\include;..\..\libs\libzrtp\third_party\bgaes;..\..\libs\libzrtp\third_party\bnlib;..\..\libs\libtpl-1.5\src;..\..\libs\libtpl-1.5\src\win;..\..\libs\openssl-$(OpenSSLVersion)\include;..\..\libs\sofia-sip\libsofia-sip-ua\sdp;..\..\libs\sofia-sip\libsofia-sip-ua\su;..\..\libs\sofia-sip\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;PCRE_STATIC;STATICLIB;ENABLE_ZRTP;TPL_NOLIB;STFU_EXPORTS;LIBSOFIA_SIP_UA_STATIC;HAVE_OPENSSL;HAVE_OPENSSL_DTLS_SRTP;HAVE_OPENSSL_DTLS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;PCRE_STATIC;STATICLIB;ENABLE_ZRTP;TPL_NOLIB;LIBSOFIA_SIP_UA_STATIC;HAVE_OPENSSL;HAVE_OPENSSL_DTLS_SRTP;HAVE_OPENSSL_DTLS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@ -231,7 +231,7 @@ if not exist "$(OutDir)htdocs" xcopy "$(SolutionDir)htdocs\*.*" "$(OutDir)htdocs
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\sqlite-amalgamation-3080401;..\..\libs\pcre-8.34;..\..\libs\speex-1.2rc1\include;..\..\libs\curl-7.35.0\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\tiff-4.0.2\libtiff;..\..\libs\libzrtp\include;..\..\libs\libzrtp\third_party\bgaes;..\..\libs\libzrtp\third_party\bnlib;..\..\libs\libtpl-1.5\src;..\..\libs\libtpl-1.5\src\win;..\..\libs\openssl-$(OpenSSLVersion)\include;..\..\libs\sofia-sip\libsofia-sip-ua\sdp;..\..\libs\sofia-sip\libsofia-sip-ua\su;..\..\libs\sofia-sip\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;STATICLIB;CRASH_PROT;PCRE_STATIC;ENABLE_ZRTP;TPL_NOLIB;STFU_EXPORTS;LIBSOFIA_SIP_UA_STATIC;HAVE_OPENSSL;HAVE_OPENSSL_DTLS_SRTP;HAVE_OPENSSL_DTLS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;STATICLIB;CRASH_PROT;PCRE_STATIC;ENABLE_ZRTP;LIBSOFIA_SIP_UA_STATIC;HAVE_OPENSSL;HAVE_OPENSSL_DTLS_SRTP;HAVE_OPENSSL_DTLS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>Create</PrecompiledHeader>
<PrecompiledHeaderFile>switch.h</PrecompiledHeaderFile>
@ -282,7 +282,7 @@ if not exist "$(OutDir)htdocs" xcopy "$(SolutionDir)htdocs\*.*" "$(OutDir)htdocs
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\sqlite-amalgamation-3080401;..\..\libs\pcre-8.34;..\..\libs\speex-1.2rc1\include;..\..\libs\curl-7.35.0\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\tiff-4.0.2\libtiff;..\..\libs\libzrtp\include;..\..\libs\libzrtp\third_party\bgaes;..\..\libs\libzrtp\third_party\bnlib;..\..\libs\libtpl-1.5\src;..\..\libs\libtpl-1.5\src\win;..\..\libs\openssl-$(OpenSSLVersion)\include;..\..\libs\sofia-sip\libsofia-sip-ua\sdp;..\..\libs\sofia-sip\libsofia-sip-ua\su;..\..\libs\sofia-sip\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;STATICLIB;CRASH_PROT;PCRE_STATIC;ENABLE_ZRTP;TPL_NOLIB;STFU_EXPORTS;LIBSOFIA_SIP_UA_STATIC;HAVE_OPENSSL;HAVE_OPENSSL_DTLS_SRTP;HAVE_OPENSSL_DTLS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;STATICLIB;CRASH_PROT;PCRE_STATIC;ENABLE_ZRTP;TPL_NOLIB;LIBSOFIA_SIP_UA_STATIC;HAVE_OPENSSL;HAVE_OPENSSL_DTLS_SRTP;HAVE_OPENSSL_DTLS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>Create</PrecompiledHeader>
<PrecompiledHeaderFile>switch.h</PrecompiledHeaderFile>
@ -363,32 +363,6 @@ if not exist "$(OutDir)htdocs" xcopy "$(SolutionDir)htdocs\*.*" "$(OutDir)htdocs
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\src\switch_core_video.c" />
<ClCompile Include="..\..\src\switch_stfu.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeaderOutputFile>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeaderOutputFile>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeaderOutputFile>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeaderOutputFile>
</ClCompile>
<ClCompile Include="..\..\src\switch_apr.c" />
<ClCompile Include="..\..\src\switch_buffer.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
@ -482,7 +456,7 @@ if not exist "$(OutDir)htdocs" xcopy "$(SolutionDir)htdocs\*.*" "$(OutDir)htdocs
<ClCompile Include="..\..\src\switch_time.c" />
<ClCompile Include="..\..\src\switch_utils.c" />
<ClCompile Include="..\..\src\switch_version.c" />
<ClCompile Include="..\..\src\switch_vidderbuffer.c" />
<ClCompile Include="..\..\src\switch_jitterbuffer.c" />
<ClCompile Include="..\..\src\switch_xml.c" />
<ClCompile Include="..\..\src\switch_xml_config.c" />
<ClCompile Include="..\..\libs\miniupnpc\igd_desc_parse.c">
@ -769,7 +743,6 @@ if not exist "$(OutDir)htdocs" xcopy "$(SolutionDir)htdocs\*.*" "$(OutDir)htdocs
<ClInclude Include="..\..\libs\miniupnpc\declspec.h" />
<ClInclude Include="..\..\src\include\g711.h" />
<ClInclude Include="..\..\src\include\SimpleGlob.h" />
<ClInclude Include="..\..\src\include\switch_stfu.h" />
<ClInclude Include="..\..\src\include\switch.h" />
<ClInclude Include="..\..\src\include\switch_apr.h" />
<ClInclude Include="..\..\src\include\switch_bitpack.h" />
@ -916,4 +889,4 @@ if not exist "$(OutDir)htdocs" xcopy "$(SolutionDir)htdocs\*.*" "$(OutDir)htdocs
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>