1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

srs-librtmp: implements handshake.

This commit is contained in:
winlin 2014-03-02 12:35:15 +08:00
parent f24f27deb9
commit 86267f854c
9 changed files with 83 additions and 39 deletions

View file

@ -81,20 +81,17 @@ void SimpleSocketStream::set_recv_timeout(int64_t timeout_us)
int64_t SimpleSocketStream::get_recv_timeout()
{
int ret = ERROR_SUCCESS;
return ret;
return -1;
}
int64_t SimpleSocketStream::get_recv_bytes()
{
int ret = ERROR_SUCCESS;
return ret;
return 0;
}
int SimpleSocketStream::get_recv_kbps()
{
int ret = ERROR_SUCCESS;
return ret;
return 0;
}
// ISrsProtocolWriter
@ -104,20 +101,17 @@ void SimpleSocketStream::set_send_timeout(int64_t timeout_us)
int64_t SimpleSocketStream::get_send_timeout()
{
int ret = ERROR_SUCCESS;
return ret;
return -1;
}
int64_t SimpleSocketStream::get_send_bytes()
{
int ret = ERROR_SUCCESS;
return ret;
return 0;
}
int SimpleSocketStream::get_send_kbps()
{
int ret = ERROR_SUCCESS;
return ret;
return 0;
}
int SimpleSocketStream::writev(const iovec *iov, int iov_size, ssize_t* nwrite)

View file

@ -170,6 +170,10 @@ int srs_simple_handshake(srs_rtmp_t rtmp)
srs_freep(context->rtmp);
context->rtmp = new SrsRtmpClient(context->skt);
if ((ret = context->rtmp->simple_handshake()) != ERROR_SUCCESS) {
return ret;
}
return ret;
}
@ -197,6 +201,14 @@ int srs_publish_stream(srs_rtmp_t rtmp)
return ERROR_SUCCESS;
}
int srs_ssl_enabled()
{
#ifndef SRS_SSL
return false;
#endif
return true;
}
int srs_version_major()
{
return ::atoi(VERSION_MAJOR);

View file

@ -66,7 +66,10 @@ void srs_rtmp_destroy(srs_rtmp_t rtmp);
int srs_simple_handshake(srs_rtmp_t rtmp);
/**
* complex handshake is specified by adobe Flash player,
* depends on ssl, user must link libssl.a and libcrypt.a
* depends on ssl, user must compile srs with ssl, then
* link user program libssl.a and libcrypt.a
* @remark user can use srs_ssl_enabled() to detect
* whether ssl is ok.
*/
int srs_complex_handshake(srs_rtmp_t rtmp);
@ -97,6 +100,14 @@ int srs_play_stream(srs_rtmp_t rtmp);
*/
int srs_publish_stream(srs_rtmp_t rtmp);
/**
* whether srs is compiled with ssl,
* that is, compile srs with ssl: ./configure --with-ssl,.
* if no ssl, complex handshake always error.
* @return 0 for false, otherwise, true.
*/
int srs_ssl_enabled();
/**
* get protocol stack version
*/