我想发送一个flv到rtmp服务器,但有一个错误?

时间:2016-12-28 11:55:38

标签: rtmp

这是我的代码

long start = 0;
long perframetime = 0;
RTMP_LogLevel lvl = RTMP_LOGINFO;
FILE*fp = NULL;
if (!ZINIT()) {
    printf("Init Socket Err\n");
    return -1;
}
//  RTMP_debuglevel=RTMP_LOGINFO;
RTMP_LogSetLevel(lvl);

// RTMP_LogSetOutput(FILE * fp);

rtmp = RTMP_Alloc();
RTMP_Init(rtmp);
rtmp->Link.timeout = 5;
packet = (RTMPPacket*)malloc(sizeof(RTMPPacket));
memset(packet, 0, sizeof(RTMPPacket));
RTMPPacket_Alloc(packet, 1024 * 64);
RTMPPacket_Reset(packet);

RTMP_SetupURL(rtmp, rtmpurl);
RTMP_EnableWrite(rtmp);

printf("Connecting...\n");

if (!RTMP_Connect(rtmp, NULL)) {
    printf("Connect Err\n");
    ZCLEAR();
    return -1;
}
Sleep(10000000);
printf("ConnectStream...\n");
if (!RTMP_ConnectStream(rtmp, 0)) {
    printf("ConnectStream Err\n");
    ZCLEAR();
    return -1;
}
packet->m_hasAbsTimestamp = 0;
packet->m_nChannel = 0x04; 
packet->m_nInfoField2 = rtmp->m_stream_id;

printf("OpenFile:%s\n", flvfilename);

但是当我运行它时,有一个错误说RTMP_SwfHash connot cantact swf url 该怎么办?

我记得每个rtmp服务器都有一个rtmp url和一个代码,代码用于什么?谢谢

0 个答案:

没有答案