Ios 如何将RTCI420Frame对象转换为纹理?
我有一个应用程序,但我想更多地控制视频视图。所以我正忙于实现自己的渲染器。我通过这个回调开始接收帧:Ios 如何将RTCI420Frame对象转换为纹理?,ios,objective-c,ios8,webrtc,Ios,Objective C,Ios8,Webrtc,我有一个应用程序,但我想更多地控制视频视图。所以我正忙于实现自己的渲染器。我通过这个回调开始接收帧: renderer:(RTCVideoRenderer *)renderer didReceiveFrame:(RTCI420Frame *)frame 它将RTCI420Frame作为参数传递。我需要以某种方式将帧中的图像数据转换为纹理。我不知道怎么做。我认为使用GLKTextureLoader是不可能的(到目前为止,我一直在使用它从磁盘加载纹理) 如何从帧中获取图像数据并从中创建纹理?来处理
renderer:(RTCVideoRenderer *)renderer didReceiveFrame:(RTCI420Frame *)frame
它将RTCI420Frame
作为参数传递。我需要以某种方式将帧中的图像数据转换为纹理。我不知道怎么做。我认为使用GLKTextureLoader
是不可能的(到目前为止,我一直在使用它从磁盘加载纹理)
如何从帧中获取图像数据并从中创建纹理?来处理应用程序中与WebRTC相关的所有内容
这些类是iOS上本机WebRTC的起点。只需在BWRTCViewController上扩展视图控制器并设置委托。现在,您可以立即开始测试,而不必担心自己实现整个调用序列。你只需要担心信号
// your call view controller .h
#import <BWRTCViewController.h>
@interface CallViewController : BWRTCViewController <BWRTCViewControllerDelegate>
@end
// your call view controller .m
- (void)viewDidLoad {
[super viewDidLoad];
if (/*this is the caller*/) {
[super callerSequence];
// wait until callee is ready to receive your offer, then call:
[super startNegotiating];
} else {
/*callee side doesn't have to do a thing*/
}
}
// received a remote sdp
- (void)receivedSdp {
[super receivedSessionDescription:/*your sdp description*/
withType:/*your sdp type*/];
}
// received a remote ice candidate
- (void)receivedIce {
[super receivedIceCandidate:/*your ice candidate*/
sdpMid:/*your ice sdpMid*/
sdpMLineIndex:/*your ice sdpMLineIndex*/];
}
// got a local sdp
- (void) sendSessionDescription:(NSString *)sessionDescription_
withType:(NSString *)type_ {
// use your signaling interface to send the sdp to the remote peer
}
// got a local ice candidate
- (void) sendICECandidate:(NSString *)candidate_
sdpMid:(NSString *)sdpMid_
sdpMLineIndex:(NSInteger)sdpMLineIndex_ {
// use your signaling interface to send the ice to the remote peer
}
//您的调用视图控制器.h
#进口
@接口调用ViewController:BWRTCViewController
@结束
//您的呼叫视图控制器.m
-(无效)viewDidLoad{
[超级视图下载];
如果(/*这是调用方*/){
[超级调用序列];
//等待被呼叫方准备好接收您的报价,然后致电:
[超级明星谈判];
}否则{
/*被叫方不必做任何事*/
}
}
//收到远程sdp
-(无效)收到的数据表{
[超级接收会话描述:/*您的sdp描述*/
withType:/*您的sdp类型*/];
}
//收到一个远程ice候选人
-(无效)接受骰子{
[超级候选人:/*你的ice候选人*/
sdpMid:/*您的ice sdpMid*/
sdpMLineIndex:/*您的ice sdpMLineIndex*/];
}
//有本地sdp吗
-(void)sendSessionDescription:(NSString*)sessionDescription_
withType:(NSString*)类型{
//使用信令接口将sdp发送到远程对等方
}
//有一个当地的ice候选人
-(void)sendICECandidate:(NSString*)候选者_
sdpMid:(NSString*)sdpMid_
sdpMLineIndex:(NSInteger)sdpMLineIndex\u{
//使用您的信令接口将ice发送到远程对等方
}
您找到解决方案了吗?Thanks@pablogeek是的!虽然很难看,但我明天上班的时候会把它上传到某个地方,这样我就可以把它链接到你那里了。谢谢!我很期待!我们明天再说@pablogeek我发布了我的解决方案作为答案,我希望它能帮助你。