mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
fix #57, use lock(acquire/release publish) to avoid duplicated publishing. 0.9.188.
This commit is contained in:
parent
6dd065bcc3
commit
ade2376da0
6 changed files with 109 additions and 33 deletions
|
@ -1347,6 +1347,26 @@ int SrsSource::on_aggregate(SrsMessage* msg)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int SrsSource::acquire_publish()
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
if (!_can_publish) {
|
||||
ret = ERROR_SYSTEM_STREAM_BUSY;
|
||||
srs_warn("publish lock stream failed, ret=%d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
_can_publish = false;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void SrsSource::release_publish()
|
||||
{
|
||||
_can_publish = true;
|
||||
}
|
||||
|
||||
int SrsSource::on_publish()
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue