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
2013-11-27 22:53:08 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
62a2384a35b96b3b5b78ecaff093520563f63324
62a2384a
1 parent
ec5cb39b
check publish streaming available
隐藏空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
27 行增加
和
0 行删除
trunk/src/core/srs_core_client.cpp
trunk/src/core/srs_core_error.hpp
trunk/src/core/srs_core_source.cpp
trunk/src/core/srs_core_source.hpp
trunk/src/core/srs_core_client.cpp
查看文件 @
62a2384
...
...
@@ -41,6 +41,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define SRS_PULSE_TIMEOUT_MS 100
#define SRS_SEND_TIMEOUT_MS 5000000L
#define SRS_RECV_TIMEOUT_MS SRS_SEND_TIMEOUT_MS
#define SRS_STREAM_BUSY_SLEEP_MS 2000
SrsClient
::
SrsClient
(
SrsServer
*
srs_server
,
st_netfd_t
client_stfd
)
:
SrsConnection
(
srs_server
,
client_stfd
)
...
...
@@ -152,6 +153,16 @@ int SrsClient::do_cycle()
SrsSource
*
source
=
SrsSource
::
find
(
req
->
get_stream_url
());
srs_assert
(
source
!=
NULL
);
// check publish available.
if
(
type
!=
SrsClientPlay
&&
!
source
->
can_publish
())
{
ret
=
ERROR_SYSTEM_STREAM_BUSY
;
srs_warn
(
"stream %s is already publishing. ret=%d"
,
req
->
get_stream_url
().
c_str
(),
ret
);
// to delay request
st_usleep
(
SRS_STREAM_BUSY_SLEEP_MS
*
1000
);
return
ret
;
}
bool
enabled_cache
=
true
;
conf
=
config
->
get_gop_cache
(
req
->
vhost
);
if
(
conf
&&
conf
->
arg0
()
==
"off"
)
{
...
...
trunk/src/core/srs_core_error.hpp
查看文件 @
62a2384
...
...
@@ -78,6 +78,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define ERROR_SYSTEM_CONFIG_BLOCK_START 407
#define ERROR_SYSTEM_CONFIG_BLOCK_END 408
#define ERROR_SYSTEM_CONFIG_EOF 409
#define ERROR_SYSTEM_STREAM_BUSY 410
// see librtmp.
// failed when open ssl create the dh
...
...
trunk/src/core/srs_core_source.cpp
查看文件 @
62a2384
...
...
@@ -268,6 +268,7 @@ SrsSource::SrsSource(std::string _stream_url)
enable_gop_cache
=
true
;
video_frame_rate
=
audio_sample_rate
=
0
;
_can_publish
=
true
;
}
SrsSource
::~
SrsSource
()
...
...
@@ -290,6 +291,11 @@ SrsSource::~SrsSource()
#endif
}
bool
SrsSource
::
can_publish
()
{
return
_can_publish
;
}
int
SrsSource
::
on_meta_data
(
SrsCommonMessage
*
msg
,
SrsOnMetaDataPacket
*
metadata
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -465,11 +471,13 @@ int SrsSource::on_video(SrsCommonMessage* video)
#ifdef SRS_HLS
int
SrsSource
::
on_publish
(
std
::
string
vhost
,
std
::
string
app
,
std
::
string
stream
)
{
_can_publish
=
false
;
return
hls
->
on_publish
(
vhost
,
app
,
stream
);
}
#else
int
SrsSource
::
on_publish
(
std
::
string
/*vhost*/
,
std
::
string
/*app*/
,
std
::
string
/*stream*/
)
{
_can_publish
=
false
;
return
ERROR_SUCCESS
;
}
#endif
...
...
@@ -489,6 +497,8 @@ void SrsSource::on_unpublish()
srs_freep
(
cache_sh_audio
);
srs_trace
(
"clear cache/metadata/sequence-headers when unpublish."
);
_can_publish
=
true
;
}
int
SrsSource
::
create_consumer
(
SrsConsumer
*&
consumer
)
...
...
trunk/src/core/srs_core_source.hpp
查看文件 @
62a2384
...
...
@@ -157,6 +157,10 @@ private:
* the video frame rate in metadata.
*/
int
video_frame_rate
;
/**
* can publish, true when is not streaming
*/
bool
_can_publish
;
private
:
SrsSharedPtrMessage
*
cache_metadata
;
// the cached video sequence header.
...
...
@@ -167,6 +171,7 @@ public:
SrsSource
(
std
::
string
_stream_url
);
virtual
~
SrsSource
();
public
:
virtual
bool
can_publish
();
virtual
int
on_meta_data
(
SrsCommonMessage
*
msg
,
SrsOnMetaDataPacket
*
metadata
);
virtual
int
on_audio
(
SrsCommonMessage
*
audio
);
virtual
int
on_video
(
SrsCommonMessage
*
video
);
...
...
请
注册
或
登录
后发表评论