PJSIP添加G729编码

1.第一步

config_site中添加支持G729

#define PJMEDIA_HAS_BCG729 1

2.第二步

下载BCG729源代码到本地(git clone git://git.linphone.org/bcg729.git)

3.第三步

运行PJSIP的configure命令时设置bcg729的源代码位置,参考:https://trac.pjsip.org/repos/ticket/2029

./configure --with-bcg729

4.第四步

编译g729,参考:https://github.com/BelledonneCommunications/bcg729

cmake . -DCMAKE_INSTALL_PREFIX=/Users/xx/Documents/ThirdParty/bcg729/Output/lib

make

make install

5.第五步

复制编译好的libbcg729.a和BCG729源代码中的include中的decoder.h   encoder.h到项目中就可以了

6.检查是否支持

const unsigned kCodecInfoSize = 64;
    pjsua_codec_info codecInfo[kCodecInfoSize];
    unsigned codecCount = kCodecInfoSize;
    pj_status_t status = pjsua_enum_codecs(codecInfo, &codecCount);
    if (status != PJ_SUCCESS) {
        NSLog(@"Error getting list of codecs");
    } else {
        for (NSUInteger i = 0; i < codecCount; i++) {
            NSString *codecIdentifier = [NSString stringWithPJString:codecInfo[i].codec_id];
            NSLog(@"codec = %@",codecIdentifier);
        
        }

    }

+ (NSString *)stringWithPJString:(pj_str_t)pjString {
    NSString *result = [[NSString alloc] initWithBytes:pjString.ptr length:(NSUInteger)pjString.slen encoding:NSUTF8StringEncoding];
    return result ?: @"";

}

7.第七步 PJSIP priorityForCodec方法中添加@"G729/8000/1": @(133)




  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值