小编xxi*_*xxi的帖子

Callkit使用蓝牙耳机作为音频输出

我正在使用Callkit开发VOIP
它工作正常,除了音频输出源
它总是通过iPhone扬声器输出音频

一些这样的答案所述设置AvAudioSession OptionAVAudioSessionCategoryOptionAllowBluetooth将工作,但还是失败了
,我试图将其设置为首选,像蓝牙耳机,失败

顺便问一下,如何通过耳机播放铃声?
下面是我的代码,按照本讨论中的建议,我AVAudioSession在拨号后立即配置并接听电话

- (void)getCall:(NSDictionary *)infoDic {

    CXCallUpdate *update = [[CXCallUpdate alloc]init];
    // config update

    NSUUID *uuid = [NSUUID UUID];
    [self.provider reportNewIncomingCallWithUUID:uuid update:update completion:^(NSError * _Nullable error) {
        if (error)
            NSLog(@"%@", error.localizedDescription);
    }];

    NSArray *video = @[@(ReceiveVideoReq), @(VideoCalling)];
    if ([video containsObject:@(self.client.callStage)])
        [ProviderManager configureAudio:true];
    else
        [ProviderManager configureAudio:false];
}

- (void)dialPhone:(BOOL)isVideo {

    CXHandle *handle = [[CXHandle alloc]initWithType:CXHandleTypePhoneNumber value:@"AAAA"];
    CXStartCallAction *start = [[CXStartCallAction alloc]initWithCallUUID:uuid handle:handle];
    start.video = isVideo; …
Run Code Online (Sandbox Code Playgroud)

audio voip bluetooth ios callkit

6
推荐指数
1
解决办法
637
查看次数

梯度如何通过tf.py_func传递

这是在tensorflow中更快的R-CNN实现.
proposal_layer实现由蟒蛇

我很好奇梯度是否可以通过tf.py_func
权重和偏差不断变化,
所以我认为梯度会成功

然后我做了一个小测试

import tensorflow as tf
import numpy as np

def addone(x):
    # print type(x)
    return x + 1

def pyfunc_test():
    # create data
    x_data = tf.placeholder(dtype=tf.float32, shape=[None])
    y_data = tf.placeholder(dtype=tf.float32, shape=[None])

    w = tf.Variable(tf.constant([0.5]))
    b = tf.Variable(tf.zeros([1]))

    y1 = tf.mul(w, x_data, name='y1')
    y2 = tf.py_func(addone, [y1], tf.float32)
    y = tf.add(y2, b)

    loss = tf.reduce_mean(tf.square(y - y_data))
    optimizer = tf.train.GradientDescentOptimizer(0.5)
    train = optimizer.minimize(loss)

    with tf.Session() as sess:
        sess.run(tf.global_variables_initializer())

        for step in …
Run Code Online (Sandbox Code Playgroud)

python machine-learning neural-network tensorflow

2
推荐指数
1
解决办法
2672
查看次数