我正在使用Callkit开发VOIP
它工作正常,除了音频输出源
它总是通过iPhone扬声器输出音频
一些这样的答案所述设置AvAudioSession Option
为AVAudioSessionCategoryOptionAllowBluetooth
将工作,但还是失败了
,我试图将其设置为首选,像蓝牙耳机此,失败
顺便问一下,如何通过耳机播放铃声?
下面是我的代码,按照本讨论中的建议,我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) 这是在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)