Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2014-07-20 13:11:53 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
736ec48c7114ac8126d062ec559a051ddb53e92d
736ec48c
1 parent
073d9006
move some consts to kernel consts
隐藏空白字符变更
内嵌
并排对比
正在显示
13 个修改的文件
包含
46 行增加
和
35 行删除
trunk/src/app/srs_app_config.cpp
trunk/src/app/srs_app_config.hpp
trunk/src/app/srs_app_edge.cpp
trunk/src/app/srs_app_encoder.cpp
trunk/src/app/srs_app_forward.cpp
trunk/src/app/srs_app_ingest.cpp
trunk/src/app/srs_app_rtmp_conn.cpp
trunk/src/app/srs_app_utility.cpp
trunk/src/kernel/srs_kernel_consts.hpp
trunk/src/rtmp/srs_protocol_rtmp.cpp
trunk/src/rtmp/srs_protocol_stack.cpp
trunk/src/rtmp/srs_protocol_utility.cpp
trunk/src/rtmp/srs_protocol_utility.hpp
trunk/src/app/srs_app_config.cpp
查看文件 @
736ec48
...
...
@@ -1405,8 +1405,8 @@ SrsConfDirective* SrsConfig::get_vhost(string vhost)
}
}
if
(
vhost
!=
RTMP_VHOST_DEFAULT
)
{
return
get_vhost
(
RTMP_VHOST_DEFAULT
);
if
(
vhost
!=
SRS_CONSTS_RTMP_DEFAULT_VHOST
)
{
return
get_vhost
(
SRS_CONSTS_RTMP_DEFAULT_VHOST
);
}
return
NULL
;
...
...
@@ -1575,7 +1575,7 @@ int SrsConfig::get_chunk_size(string vhost)
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
if
(
!
conf
)
{
return
SRS_CON
F_DEFAULT
_CHUNK_SIZE
;
return
SRS_CON
STS_RTMP_SRS
_CHUNK_SIZE
;
}
conf
=
conf
->
get
(
"chunk_size"
);
...
...
@@ -1584,7 +1584,7 @@ int SrsConfig::get_chunk_size(string vhost)
// use the global instead.
conf
=
root
->
get
(
"chunk_size"
);
if
(
!
conf
)
{
return
SRS_CON
F_DEFAULT
_CHUNK_SIZE
;
return
SRS_CON
STS_RTMP_SRS
_CHUNK_SIZE
;
}
return
::
atoi
(
conf
->
arg0
().
c_str
());
...
...
trunk/src/app/srs_app_config.hpp
查看文件 @
736ec48
...
...
@@ -35,12 +35,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_app_reload.hpp>
///////////////////////////////////////////////////////////
// the value consts
///////////////////////////////////////////////////////////
#define SRS_CONSTS_NULL_FILE "/dev/null"
#define SRS_CONSTS_LOCALHOST "127.0.0.1"
///////////////////////////////////////////////////////////
// default consts values
///////////////////////////////////////////////////////////
#define SRS_CONF_DEFAULT_PID_FILE "./objs/srs.pid"
...
...
trunk/src/app/srs_app_edge.cpp
查看文件 @
736ec48
...
...
@@ -285,8 +285,8 @@ int SrsEdgeIngester::connect_server()
std
::
string
server
=
conf
->
args
.
at
(
origin_index
%
conf
->
args
.
size
());
origin_index
=
(
origin_index
+
1
)
%
conf
->
args
.
size
();
std
::
string
s_port
=
RTMP_DEFAULT_PORT
;
int
port
=
::
atoi
(
RTMP_DEFAULT_PORT
);
std
::
string
s_port
=
SRS_CONSTS_RTMP_DEFAULT_PORT
;
int
port
=
::
atoi
(
SRS_CONSTS_RTMP_DEFAULT_PORT
);
size_t
pos
=
server
.
find
(
":"
);
if
(
pos
!=
std
::
string
::
npos
)
{
s_port
=
server
.
substr
(
pos
+
1
);
...
...
@@ -538,8 +538,8 @@ int SrsEdgeForwarder::connect_server()
std
::
string
server
=
conf
->
args
.
at
(
origin_index
%
conf
->
args
.
size
());
origin_index
=
(
origin_index
+
1
)
%
conf
->
args
.
size
();
std
::
string
s_port
=
RTMP_DEFAULT_PORT
;
int
port
=
::
atoi
(
RTMP_DEFAULT_PORT
);
std
::
string
s_port
=
SRS_CONSTS_RTMP_DEFAULT_PORT
;
int
port
=
::
atoi
(
SRS_CONSTS_RTMP_DEFAULT_PORT
);
size_t
pos
=
server
.
find
(
":"
);
if
(
pos
!=
std
::
string
::
npos
)
{
s_port
=
server
.
substr
(
pos
+
1
);
...
...
trunk/src/app/srs_app_encoder.cpp
查看文件 @
736ec48
...
...
@@ -34,6 +34,7 @@ using namespace std;
#include <srs_protocol_stack.hpp>
#include <srs_app_ffmpeg.hpp>
#include <srs_kernel_utility.hpp>
#include <srs_kernel_consts.hpp>
#ifdef SRS_AUTO_TRANSCODE
...
...
trunk/src/app/srs_app_forward.cpp
查看文件 @
736ec48
...
...
@@ -86,8 +86,8 @@ int SrsForwarder::on_publish(SrsRequest* req, std::string forward_server)
stream_name
=
req
->
stream
;
server
=
forward_server
;
std
::
string
s_port
=
RTMP_DEFAULT_PORT
;
port
=
::
atoi
(
RTMP_DEFAULT_PORT
);
std
::
string
s_port
=
SRS_CONSTS_RTMP_DEFAULT_PORT
;
port
=
::
atoi
(
SRS_CONSTS_RTMP_DEFAULT_PORT
);
// TODO: FIXME: parse complex params
size_t
pos
=
forward_server
.
find
(
":"
);
...
...
trunk/src/app/srs_app_ingest.cpp
查看文件 @
736ec48
...
...
@@ -33,6 +33,7 @@ using namespace std;
#include <srs_app_ffmpeg.hpp>
#include <srs_app_pithy_print.hpp>
#include <srs_kernel_utility.hpp>
#include <srs_kernel_consts.hpp>
// when error, ingester sleep for a while and retry.
// ingest never sleep a long time, for we must start the stream ASAP.
...
...
trunk/src/app/srs_app_rtmp_conn.cpp
查看文件 @
736ec48
...
...
@@ -933,8 +933,8 @@ int SrsRtmpConn::connect_server(int origin_index, st_netfd_t* pstsock)
std
::
string
server
=
conf
->
args
.
at
(
origin_index
%
conf
->
args
.
size
());
origin_index
=
(
origin_index
+
1
)
%
conf
->
args
.
size
();
std
::
string
s_port
=
RTMP_DEFAULT_PORT
;
int
port
=
::
atoi
(
RTMP_DEFAULT_PORT
);
std
::
string
s_port
=
SRS_CONSTS_RTMP_DEFAULT_PORT
;
int
port
=
::
atoi
(
SRS_CONSTS_RTMP_DEFAULT_PORT
);
size_t
pos
=
server
.
find
(
":"
);
if
(
pos
!=
std
::
string
::
npos
)
{
s_port
=
server
.
substr
(
pos
+
1
);
...
...
trunk/src/app/srs_app_utility.cpp
查看文件 @
736ec48
...
...
@@ -36,6 +36,7 @@ using namespace std;
#include <srs_kernel_error.hpp>
#include <srs_app_kbps.hpp>
#include <srs_app_json.hpp>
#include <srs_kernel_consts.hpp>
int
srs_socket_connect
(
std
::
string
server
,
int
port
,
int64_t
timeout
,
st_netfd_t
*
pstfd
)
{
...
...
trunk/src/kernel/srs_kernel_consts.hpp
查看文件 @
736ec48
...
...
@@ -30,4 +30,24 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_core.hpp>
///////////////////////////////////////////////////////////
// RTMP consts values
///////////////////////////////////////////////////////////
// default vhost of rtmp
#define SRS_CONSTS_RTMP_DEFAULT_VHOST "__defaultVhost__"
// default port of rtmp
#define SRS_CONSTS_RTMP_DEFAULT_PORT "1935"
// the default chunk size for system.
#define SRS_CONSTS_RTMP_SRS_CHUNK_SIZE 60000
// 6. Chunking, RTMP protocol default chunk size.
#define SRS_CONSTS_RTMP_PROTOCOL_CHUNK_SIZE 128
///////////////////////////////////////////////////////////
// SRS consts values
///////////////////////////////////////////////////////////
#define SRS_CONSTS_NULL_FILE "/dev/null"
#define SRS_CONSTS_LOCALHOST "127.0.0.1"
#endif
...
...
trunk/src/rtmp/srs_protocol_rtmp.cpp
查看文件 @
736ec48
...
...
@@ -605,11 +605,11 @@ int SrsRtmpClient::play(string stream, int stream_id)
// SetChunkSize
if
(
true
)
{
SrsSetChunkSizePacket
*
pkt
=
new
SrsSetChunkSizePacket
();
pkt
->
chunk_size
=
SRS_CON
F_DEFAULT
_CHUNK_SIZE
;
pkt
->
chunk_size
=
SRS_CON
STS_RTMP_SRS
_CHUNK_SIZE
;
if
((
ret
=
protocol
->
send_and_free_packet
(
pkt
,
0
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"send set chunk size failed. "
"stream=%s, chunk_size=%d, ret=%d"
,
stream
.
c_str
(),
SRS_CON
F_DEFAULT
_CHUNK_SIZE
,
ret
);
stream
.
c_str
(),
SRS_CON
STS_RTMP_SRS
_CHUNK_SIZE
,
ret
);
return
ret
;
}
}
...
...
@@ -624,11 +624,11 @@ int SrsRtmpClient::publish(string stream, int stream_id)
// SetChunkSize
if
(
true
)
{
SrsSetChunkSizePacket
*
pkt
=
new
SrsSetChunkSizePacket
();
pkt
->
chunk_size
=
SRS_CON
F_DEFAULT
_CHUNK_SIZE
;
pkt
->
chunk_size
=
SRS_CON
STS_RTMP_SRS
_CHUNK_SIZE
;
if
((
ret
=
protocol
->
send_and_free_packet
(
pkt
,
0
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"send set chunk size failed. "
"stream=%s, chunk_size=%d, ret=%d"
,
stream
.
c_str
(),
SRS_CON
F_DEFAULT
_CHUNK_SIZE
,
ret
);
stream
.
c_str
(),
SRS_CON
STS_RTMP_SRS
_CHUNK_SIZE
,
ret
);
return
ret
;
}
}
...
...
trunk/src/rtmp/srs_protocol_stack.cpp
查看文件 @
736ec48
...
...
@@ -31,6 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_kernel_stream.hpp>
#include <srs_core_autofree.hpp>
#include <srs_kernel_utility.hpp>
#include <srs_kernel_consts.hpp>
using
namespace
std
;
...
...
@@ -177,7 +178,6 @@ messages.
* good for high-bit rate streaming. Chunk size is maintained
* independently for each direction.
*/
#define RTMP_DEFAULT_CHUNK_SIZE 128
#define RTMP_MIN_CHUNK_SIZE 128
#define RTMP_MAX_CHUNK_SIZE 65536
...
...
@@ -299,7 +299,7 @@ SrsProtocol::SrsProtocol(ISrsProtocolReaderWriter* io)
in_buffer
=
new
SrsBuffer
();
skt
=
io
;
in_chunk_size
=
out_chunk_size
=
RTMP_DEFAULT
_CHUNK_SIZE
;
in_chunk_size
=
out_chunk_size
=
SRS_CONSTS_RTMP_PROTOCOL
_CHUNK_SIZE
;
}
SrsProtocol
::~
SrsProtocol
()
...
...
@@ -3704,7 +3704,7 @@ int SrsAcknowledgementPacket::encode_packet(SrsStream* stream)
SrsSetChunkSizePacket
::
SrsSetChunkSizePacket
()
{
chunk_size
=
RTMP_DEFAULT
_CHUNK_SIZE
;
chunk_size
=
SRS_CONSTS_RTMP_PROTOCOL
_CHUNK_SIZE
;
}
SrsSetChunkSizePacket
::~
SrsSetChunkSizePacket
()
...
...
trunk/src/rtmp/srs_protocol_utility.cpp
查看文件 @
736ec48
...
...
@@ -49,7 +49,7 @@ void srs_discovery_tc_url(
srs_info
(
"discovery host=%s"
,
host
.
c_str
());
}
port
=
RTMP_DEFAULT_PORT
;
port
=
SRS_CONSTS_
RTMP_DEFAULT_PORT
;
if
((
pos
=
host
.
find
(
":"
))
!=
std
::
string
::
npos
)
{
port
=
host
.
substr
(
pos
+
1
);
host
=
host
.
substr
(
0
,
pos
);
...
...
@@ -117,13 +117,13 @@ string srs_generate_tc_url(string ip, string vhost, string app, string port, str
{
string
tcUrl
=
"rtmp://"
;
if
(
vhost
==
RTMP_VHOST_DEFAUL
T
)
{
if
(
vhost
==
SRS_CONSTS_RTMP_DEFAULT_VHOS
T
)
{
tcUrl
+=
ip
;
}
else
{
tcUrl
+=
vhost
;
}
if
(
port
!=
RTMP_DEFAULT_PORT
)
{
if
(
port
!=
SRS_CONSTS_
RTMP_DEFAULT_PORT
)
{
tcUrl
+=
":"
;
tcUrl
+=
port
;
}
...
...
trunk/src/rtmp/srs_protocol_utility.hpp
查看文件 @
736ec48
...
...
@@ -31,13 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <string>
// default vhost of rtmp
#define RTMP_VHOST_DEFAULT "__defaultVhost__"
// default port of rtmp
#define RTMP_DEFAULT_PORT "1935"
// the default chunk size for system.
#define SRS_CONF_DEFAULT_CHUNK_SIZE 60000
#include <srs_kernel_consts.hpp>
/**
* parse the tcUrl, output the schema, host, vhost, app and port.
...
...
请
注册
或
登录
后发表评论