本文主要是基于srs开放实现的rtmp协议源码进行推送H264裸码流。
1、建立rtmp连接(初始化阶段)
const char* rtmp_url = "rtmp://172.19.33.115:1935/live/livestream";
srs_rtmp_t rtmp;
{
//目前一路 进行url创建和握手
rtmp = srs_rtmp_create(rtmp_url);
if (srs_rtmp_handshake(rtmp) != 0) {
MessageBox("simple handshake failed.");
//goto rtmp_destroy;
}
srs_human_trace("simple handshake success");
if (srs_rtmp_connect_app(rtmp) != 0) {
MessageBox("connect vhost/app failed.");
//goto rtmp_destroy;
}
srs_human_trace("connect vhost/app success");
if (srs_rtmp_publish_stream(rtmp) != 0) {
MessageBox("publish stream failed.");
//goto rtmp_destroy;
}
srs_human_trace("publish stream success");
}
2、发送裸流码
{
static int pts = 0;
static int dts = 0;
if (pRawFrameInfo->uiFr