Open bucky0970 opened 7 years ago
I found here can do setting.
in LFStreamRtmpSocket.m
at Top
static const AVal av_sockhost = AVC("127.0.0.1");
and modify this method,add Link.sockshost and Link.socksport.
- (NSInteger)RTMP264_Connect:(char *)push_url {
//由于摄像头的timestamp是一直在累加,需要每次得到相对时间戳
//分配与初始化
_rtmp = PILI_RTMP_Alloc();
PILI_RTMP_Init(_rtmp);
//设置URL
if (PILI_RTMP_SetupURL(_rtmp, push_url, &_error) == FALSE) {
//log(LOG_ERR, "RTMP_SetupURL() failed!");
goto Failed;
}
_rtmp->m_errorCallback = RTMPErrorCallback;
_rtmp->m_connCallback = ConnectionTimeCallback;
_rtmp->m_userData = (__bridge void *)self;
_rtmp->m_msgCounter = 1;
_rtmp->Link.timeout = RTMP_RECEIVE_TIMEOUT;
_rtmp->Link.sockshost = av_sockhost;
_rtmp->Link.socksport = 60111;
//设置可写,即发布流,这个函数必须在连接前使用,否则无效
PILI_RTMP_EnableWrite(_rtmp);
//连接服务器
if (PILI_RTMP_Connect(_rtmp, NULL, &_error) == FALSE) {
goto Failed;
}
//连接流
if (PILI_RTMP_ConnectStream(_rtmp, 0, &_error) == FALSE) {
goto Failed;
}
if (self.delegate && [self.delegate respondsToSelector:@selector(socketStatus:status:)]) {
[self.delegate socketStatus:self status:LFLiveStart];
}
[self sendMetaData];
_isConnected = YES;
_isConnecting = NO;
_isReconnecting = NO;
_isSending = NO;
return 0;
Failed:
PILI_RTMP_Close(_rtmp, &_error);
PILI_RTMP_Free(_rtmp);
_rtmp = NULL;
[self reconnect];
return -1;
}
After run the code, it seems to be setting make different. But it shows
ERROR: PILI_RTMP_Connect0, SOCKS negotiation failed.
liveStateDidChange: 1
ERROR: PILI_RTMP_Connect0, SOCKS negotiation failed.
liveStateDidChange: 5
ERROR: PILI_RTMP_Connect0, SOCKS negotiation failed.
liveStateDidChange: 5
I will keep trying,If anyone can help me with this,it would be great...
I saw rtmp.c has options for socks, but I do not know where to enable this option?