Skip to content

Commit

Permalink
close #454, support obs restart publish. 2.0.184
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Aug 18, 2015
1 parent ccc4c05 commit 2cf526f
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 18 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ Remark:

## History

* v2.0, 2015-08-18, close [#454](https://github.com/simple-rtmp-server/srs/issues/454), support obs restart publish. 2.0.184
* v2.0, 2015-08-14, use reduce_sequence_header for stream control.
* v2.0, 2015-08-14, use send_min_interval for stream control. 2.0.183
* v2.0, 2015-08-12, enable the SRS_PERF_TCP_NODELAY and add config tcp_nodelay. 2.0.182
Expand Down
9 changes: 7 additions & 2 deletions trunk/configure
Original file line number Diff line number Diff line change
Expand Up @@ -508,10 +508,15 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
else
echo -e "${YELLOW}warning: without HLS support${BLACK}"
fi
if [ $SRS_STREAM_CASTER = YES ]; then
echo -e "${YELLOW}Experiment: StreamCaster is enabled${BLACK}"
else
echo -e "${GREEN}note: without StreamCaster support${BLACK}"
fi
if [ $SRS_HDS = YES ]; then
echo -e "${GREEN}HDS is enabled${BLACK}"
echo -e "${YELLOW}Experiment: HDS is enabled${BLACK}"
else
echo -e "${YELLOW}warning: without HDS support${BLACK}"
echo -e "${GREEN}warning: without HDS support${BLACK}"
fi
if [ $SRS_NGINX = YES ]; then
echo -e "${GREEN}Nginx http server is enabled${BLACK}"
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/app/srs_app_recv_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ int SrsRecvThread::cycle()
}

if (ret != ERROR_SUCCESS) {
if (!srs_is_client_gracefully_close(ret)) {
if (!srs_is_client_gracefully_close(ret) && !srs_is_system_control_error(ret)) {
srs_error("thread process message failed. ret=%d", ret);
}

Expand Down
22 changes: 12 additions & 10 deletions trunk/src/app/srs_app_rtmp_conn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,16 @@ int SrsRtmpConn::service_cycle()
}
}

// set chunk size to larger.
// set the chunk size before any larger response greater than 128,
// to make OBS happy, @see https://github.com/simple-rtmp-server/srs/issues/454
int chunk_size = _srs_config->get_chunk_size(req->vhost);
if ((ret = rtmp->set_chunk_size(chunk_size)) != ERROR_SUCCESS) {
srs_error("set chunk_size=%d failed. ret=%d", chunk_size, ret);
return ret;
}
srs_info("set chunk_size=%d success", chunk_size);

// response the client connect ok.
if ((ret = rtmp->response_connect_app(req, local_ip.c_str())) != ERROR_SUCCESS) {
srs_error("response connect app failed. ret=%d", ret);
Expand Down Expand Up @@ -424,14 +434,6 @@ int SrsRtmpConn::stream_service_cycle()
rtmp->set_recv_timeout(SRS_CONSTS_RTMP_RECV_TIMEOUT_US);
rtmp->set_send_timeout(SRS_CONSTS_RTMP_SEND_TIMEOUT_US);

// set chunk size to larger.
int chunk_size = _srs_config->get_chunk_size(req->vhost);
if ((ret = rtmp->set_chunk_size(chunk_size)) != ERROR_SUCCESS) {
srs_error("set chunk_size=%d failed. ret=%d", chunk_size, ret);
return ret;
}
srs_info("set chunk_size=%d success", chunk_size);

// find a source to serve.
SrsSource* source = SrsSource::fetch(req);
if (!source) {
Expand Down Expand Up @@ -637,7 +639,7 @@ int SrsRtmpConn::do_playing(SrsSource* source, SrsConsumer* consumer, SrsQueueRe

// quit when recv thread error.
if ((ret = trd->error_code()) != ERROR_SUCCESS) {
if (!srs_is_client_gracefully_close(ret)) {
if (!srs_is_client_gracefully_close(ret) && !srs_is_system_control_error(ret)) {
srs_error("recv thread failed. ret=%d", ret);
}
return ret;
Expand Down Expand Up @@ -824,7 +826,7 @@ int SrsRtmpConn::do_publishing(SrsSource* source, SrsPublishRecvThread* trd)

// check the thread error code.
if ((ret = trd->error_code()) != ERROR_SUCCESS) {
if (!srs_is_client_gracefully_close(ret)) {
if (!srs_is_system_control_error(ret) && !srs_is_client_gracefully_close(ret)) {
srs_error("recv thread failed. ret=%d", ret);
}
return ret;
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/app/srs_app_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ namespace internal {
srs_info("thread %s on before cycle success");

if ((ret = handler->cycle()) != ERROR_SUCCESS) {
if (!srs_is_client_gracefully_close(ret)) {
if (!srs_is_client_gracefully_close(ret) && !srs_is_system_control_error(ret)) {
srs_warn("thread %s cycle failed, ignored and retry, ret=%d", _name, ret);
}
goto failed;
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/core/srs_core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR 2
#define VERSION_MINOR 0
#define VERSION_REVISION 183
#define VERSION_REVISION 184

// server info.
#define RTMP_SIG_SRS_KEY "SRS"
Expand Down
12 changes: 9 additions & 3 deletions trunk/src/protocol/srs_rtmp_stack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2924,7 +2924,9 @@ int SrsRtmpServer::fmle_unpublish(int stream_id, double unpublish_tid)
pkt->data->set(StatusDescription, SrsAmf0Any::str("Stop publishing stream."));

if ((ret = protocol->send_and_free_packet(pkt, stream_id)) != ERROR_SUCCESS) {
srs_error("send onFCUnpublish(NetStream.unpublish.Success) message failed. ret=%d", ret);
if (!srs_is_system_control_error(ret) && !srs_is_client_gracefully_close(ret)) {
srs_error("send onFCUnpublish(NetStream.unpublish.Success) message failed. ret=%d", ret);
}
return ret;
}
srs_info("send onFCUnpublish(NetStream.unpublish.Success) message success.");
Expand All @@ -2933,7 +2935,9 @@ int SrsRtmpServer::fmle_unpublish(int stream_id, double unpublish_tid)
if (true) {
SrsFMLEStartResPacket* pkt = new SrsFMLEStartResPacket(unpublish_tid);
if ((ret = protocol->send_and_free_packet(pkt, stream_id)) != ERROR_SUCCESS) {
srs_error("send FCUnpublish response message failed. ret=%d", ret);
if (!srs_is_system_control_error(ret) && !srs_is_client_gracefully_close(ret)) {
srs_error("send FCUnpublish response message failed. ret=%d", ret);
}
return ret;
}
srs_info("send FCUnpublish response message success.");
Expand All @@ -2948,7 +2952,9 @@ int SrsRtmpServer::fmle_unpublish(int stream_id, double unpublish_tid)
pkt->data->set(StatusClientId, SrsAmf0Any::str(RTMP_SIG_CLIENT_ID));

if ((ret = protocol->send_and_free_packet(pkt, stream_id)) != ERROR_SUCCESS) {
srs_error("send onStatus(NetStream.Unpublish.Success) message failed. ret=%d", ret);
if (!srs_is_system_control_error(ret) && !srs_is_client_gracefully_close(ret)) {
srs_error("send onStatus(NetStream.Unpublish.Success) message failed. ret=%d", ret);
}
return ret;
}
srs_info("send onStatus(NetStream.Unpublish.Success) message success.");
Expand Down

0 comments on commit 2cf526f

Please sign in to comment.