From a6dd8fb3a10092fa0361fccefba004b23330a8b4 Mon Sep 17 00:00:00 2001 From: winlin Date: Sat, 6 Jun 2015 21:31:39 +0800 Subject: [PATCH 1/2] fix #421, when mix correct on, must check the type of dequeue msg. --- trunk/src/app/srs_app_source.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/trunk/src/app/srs_app_source.cpp b/trunk/src/app/srs_app_source.cpp index 042913b51..f7f7944a3 100755 --- a/trunk/src/app/srs_app_source.cpp +++ b/trunk/src/app/srs_app_source.cpp @@ -1479,7 +1479,11 @@ int SrsSource::on_audio(SrsCommonMessage* shared_audio) } // consume the monotonically increase message. - ret = on_audio_imp(m); + if (m->is_audio()) { + ret = on_audio_imp(m); + } else { + ret = on_video_imp(m); + } srs_freep(m); return ret; @@ -1670,7 +1674,11 @@ int SrsSource::on_video(SrsCommonMessage* shared_video) SrsAutoFree(SrsSharedPtrMessage, m); // consume the monotonically increase message. - ret = on_video_imp(m); + if (m->is_audio()) { + ret = on_audio_imp(m); + } else { + ret = on_video_imp(m); + } srs_freep(m); return ret; From ec245339559045d9b796310a8c8d40bc8e18ed17 Mon Sep 17 00:00:00 2001 From: winlin Date: Sat, 6 Jun 2015 21:42:01 +0800 Subject: [PATCH 2/2] use smaller value for publish timeout. --- trunk/src/app/srs_app_rtmp_conn.cpp | 2 +- trunk/src/kernel/srs_kernel_consts.hpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/trunk/src/app/srs_app_rtmp_conn.cpp b/trunk/src/app/srs_app_rtmp_conn.cpp index b08f01d81..a1e9815db 100644 --- a/trunk/src/app/srs_app_rtmp_conn.cpp +++ b/trunk/src/app/srs_app_rtmp_conn.cpp @@ -869,7 +869,7 @@ int SrsRtmpConn::do_publishing(SrsSource* source, SrsPublishRecvThread* trd) pprint->elapse(); // cond wait for error. - trd->wait(SRS_CONSTS_RTMP_RECV_TIMEOUT_US / 1000); + trd->wait(SRS_CONSTS_RTMP_PUBLISHER_RECV_TIMEOUT_US / 1000); // check the thread error code. if ((ret = trd->error_code()) != ERROR_SUCCESS) { diff --git a/trunk/src/kernel/srs_kernel_consts.hpp b/trunk/src/kernel/srs_kernel_consts.hpp index ee1142dc6..4c2428352 100644 --- a/trunk/src/kernel/srs_kernel_consts.hpp +++ b/trunk/src/kernel/srs_kernel_consts.hpp @@ -74,6 +74,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // the timeout to wait client data, // if timeout, close the connection. #define SRS_CONSTS_RTMP_RECV_TIMEOUT_US (int64_t)(30*1000*1000LL) +// the timeout for publish recv. +// we must use more smaller timeout, for the recv never know the status +// of underlayer socket. +#define SRS_CONSTS_RTMP_PUBLISHER_RECV_TIMEOUT_US (int64_t)(3*1000*1000LL) // the timeout to wait for client control message, // if timeout, we generally ignore and send the data to client,