From cb2959ae7df7c5464c5984f8fc11eb2b76f143bc Mon Sep 17 00:00:00 2001 From: winlin Date: Tue, 29 Apr 2014 09:32:30 +0800 Subject: [PATCH] fix bug #53, never use msg when sent it --- trunk/src/app/srs_app_rtmp_conn.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/trunk/src/app/srs_app_rtmp_conn.cpp b/trunk/src/app/srs_app_rtmp_conn.cpp index 427a44ac0..f524e5daf 100644 --- a/trunk/src/app/srs_app_rtmp_conn.cpp +++ b/trunk/src/app/srs_app_rtmp_conn.cpp @@ -520,17 +520,20 @@ int SrsRtmpConn::playing(SrsSource* source) // so set the msgs[i] to NULL. msgs[i] = NULL; - if ((ret = rtmp->send_message(msg)) != ERROR_SUCCESS) { - srs_error("send message to client failed. ret=%d", ret); - return ret; - } + srs_assert(msg); // foreach msg, collect the duration. + // @remark: never use msg when sent it, for the protocol sdk will free it. if (starttime < 0 || starttime > msg->header.timestamp) { starttime = msg->header.timestamp; } duration += msg->header.timestamp - starttime; starttime = msg->header.timestamp; + + if ((ret = rtmp->send_message(msg)) != ERROR_SUCCESS) { + srs_error("send message to client failed. ret=%d", ret); + return ret; + } } // if duration specified, and exceed it, stop play live.