• 大小: 52.56MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2022-09-16
  • 语言: C/C++
  • 标签: TeamTalk  

资源简介

TeamTalk是一套开源的企业办公即时通讯软件,作为整套系统的组成部分之一,TTServer为TeamTalk 客户端提供用户登录,消息转发及存储等基础服务。 TTServer主要包含了以下几种服务器: LoginServer (C++): 登录服务器,分配一个负载小的MsgServer给客户端使用 MsgServer (C++): 消息服务器,提供客户端大部分信令处理功能,包括私人聊天、群组

资源截图

代码片段和文件信息

#include 

#include 
#include 
//#include 
//#include 

/*start*/
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

// the header length of the RTP frame (must skip when en/decoding)
static const int rtp_header = 0;

int codec_status = 0;

const int CODEC_OPENED = 1;
const int CODEC_CLOSED = 0;

int aec_status = 0;

const int AEC_OPENED = 1;
const int AEC_CLOSED = 0;

SpeexEchoState *echoState;
SpeexPreprocessState *den;
int sampleRate = 16000;
/*end*/

static int codec_open = 0;

static int dec_frame_size;
static int enc_frame_size;

static SpeexBits ebits dbits;
void *enc_state;
void *dec_state;

static JavaVM *gJavaVM;

extern “C“ JNIEXPORT jint JNICALL Java_com_mogujie_tt_support_audio_Speex_open(
JNIEnv *env jobject obj jint compression) {
int tmp = 0;
if (codec_open++ != 0)
return (jint) 0;

speex_bits_init(&ebits);
speex_bits_init(&dbits);

enc_state = speex_encoder_init(&speex_nb_mode);
dec_state = speex_decoder_init(&speex_nb_mode);

tmp = compression;
speex_encoder_ctl(enc_state SPEEX_SET_QUALITY &tmp);
speex_encoder_ctl(enc_state SPEEX_GET_frame_SIZE &enc_frame_size);
speex_decoder_ctl(dec_state SPEEX_GET_frame_SIZE &dec_frame_size);

SpeexPreprocessState * m_st;
m_st = speex_preprocess_state_init(enc_frame_size 8000);
int denoise = 1;
int noiseSuppress = -25;
speex_preprocess_ctl(m_st SPEEX_PREPROCESS_SET_DENOISE &denoise);
speex_preprocess_ctl(m_st SPEEX_PREPROCESS_SET_NOISE_SUPPRESS
&noiseSuppress);

return (jint) 0;
}

extern “C“ JNIEXPORT jint JNICALL Java_com_mogujie_tt_support_audio_Speex_encode(
JNIEnv *env jobject obj jshortArray lin jint offset
jbyteArray encoded jint size) {

jshort buffer[enc_frame_size];
jbyte output_buffer[enc_frame_size];
int nsamples = (size - 1) / enc_frame_size + 1;
int i tot_bytes = 0;

if (!codec_open)
return 0;

speex_bits_reset(&ebits);

for (i = 0; i < nsamples; i++) {
env->GetShortArrayRegion(lin offset + i * enc_frame_size
enc_frame_size buffer);
speex_encode_int(enc_state buffer &ebits);
}
//env->GetShortArrayRegion(lin offset enc_frame_size buffer);
//speex_encode_int(enc_state buffer &ebits);

tot_bytes = speex_bits_write(&ebits (char *) output_buffer
enc_frame_size);
env->SetByteArrayRegion(encoded 0 tot_bytes output_buffer);

return (jint) tot_bytes;
}

extern “C“ JNIEXPORT jint Java_com_mogujie_tt_support_audio_Speex_decode(
JNIEnv *env jobject obj jbyteArray encoded jshortArray lin
jint size) {

jbyte buffer[dec_frame_size];
jshort output_buffer[dec_frame_size];
jsize encoded_length = size;

if (!codec_open)
return 0;

env->GetByteArrayRegion(encoded 0 encoded_length buffer);
speex_bits_read_from(&dbits (char *) buffer encoded_length);

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-04-14 11:01  mogutt_2015年5月前原版未删减代码(52im.net)\
     文件        1286  2016-07-11 17:29  mogutt_2015年5月前原版未删减代码(52im.net)\52im_readme.txt
     目录           0  2017-04-14 10:59  mogutt_2015年5月前原版未删减代码(52im.net)\README\
     目录           0  2017-04-14 10:59  mogutt_2015年5月前原版未删减代码(52im.net)\README\.git\
     目录           0  2017-04-14 10:59  mogutt_2015年5月前原版未删减代码(52im.net)\README\.git\branches\
     文件         306  2014-10-28 21:48  mogutt_2015年5月前原版未删减代码(52im.net)\README\.git\config
     文件          73  2014-10-28 21:48  mogutt_2015年5月前原版未删减代码(52im.net)\README\.git\description
     文件          23  2014-10-28 21:48  mogutt_2015年5月前原版未删减代码(52im.net)\README\.git\HEAD
     目录           0  2017-04-14 10:59  mogutt_2015年5月前原版未删减代码(52im.net)\README\.git\hooks\
     文件         452  2014-10-28 21:48  mogutt_2015年5月前原版未删减代码(52im.net)\README\.git\hooks\applypatch-msg.sample
     文件         896  2014-10-28 21:48  mogutt_2015年5月前原版未删减代码(52im.net)\README\.git\hooks\commit-msg.sample
     文件         189  2014-10-28 21:48  mogutt_2015年5月前原版未删减代码(52im.net)\README\.git\hooks\post-update.sample
     文件         398  2014-10-28 21:48  mogutt_2015年5月前原版未删减代码(52im.net)\README\.git\hooks\pre-applypatch.sample
     文件        1642  2014-10-28 21:48  mogutt_2015年5月前原版未删减代码(52im.net)\README\.git\hooks\pre-commit.sample
     文件        1352  2014-10-28 21:48  mogutt_2015年5月前原版未删减代码(52im.net)\README\.git\hooks\pre-push.sample
     文件        4951  2014-10-28 21:48  mogutt_2015年5月前原版未删减代码(52im.net)\README\.git\hooks\pre-rebase.sample
     文件        1239  2014-10-28 21:48  mogutt_2015年5月前原版未删减代码(52im.net)\README\.git\hooks\prepare-commit-msg.sample
     文件        3611  2014-10-28 21:48  mogutt_2015年5月前原版未删减代码(52im.net)\README\.git\hooks\update.sample
     文件         104  2014-10-28 21:48  mogutt_2015年5月前原版未删减代码(52im.net)\README\.git\index
     目录           0  2017-04-14 10:59  mogutt_2015年5月前原版未删减代码(52im.net)\README\.git\info\
     文件         240  2014-10-28 21:48  mogutt_2015年5月前原版未删减代码(52im.net)\README\.git\info\exclude
     目录           0  2017-04-14 10:59  mogutt_2015年5月前原版未删减代码(52im.net)\README\.git\logs\
     文件         190  2014-10-28 21:48  mogutt_2015年5月前原版未删减代码(52im.net)\README\.git\logs\HEAD
     目录           0  2017-04-14 10:59  mogutt_2015年5月前原版未删减代码(52im.net)\README\.git\logs\refs\
     目录           0  2017-04-14 10:59  mogutt_2015年5月前原版未删减代码(52im.net)\README\.git\logs\refs\heads\
     文件         190  2014-10-28 21:48  mogutt_2015年5月前原版未删减代码(52im.net)\README\.git\logs\refs\heads\master
     目录           0  2017-04-14 10:59  mogutt_2015年5月前原版未删减代码(52im.net)\README\.git\logs\refs\remotes\
     目录           0  2017-04-14 10:59  mogutt_2015年5月前原版未删减代码(52im.net)\README\.git\logs\refs\remotes\origin\
     文件         190  2014-10-28 21:48  mogutt_2015年5月前原版未删减代码(52im.net)\README\.git\logs\refs\remotes\origin\HEAD
     目录           0  2017-04-14 10:59  mogutt_2015年5月前原版未删减代码(52im.net)\README\.git\objects\
     目录           0  2017-04-14 10:59  mogutt_2015年5月前原版未删减代码(52im.net)\README\.git\objects\06\
............此处省略7990个文件信息

评论

共有 条评论

相关资源