From 5f48d4f566a9696fd303764da330aedb9784c55b Mon Sep 17 00:00:00 2001 From: winlin Date: Wed, 19 Nov 2014 10:44:50 +0800 Subject: [PATCH] refine comments for SrsMessageArray. 2.0.25 --- trunk/src/app/srs_app_edge.cpp | 3 ++- trunk/src/app/srs_app_forward.cpp | 3 ++- trunk/src/app/srs_app_rtmp_conn.cpp | 5 ++--- trunk/src/core/srs_core.hpp | 2 +- trunk/src/rtmp/srs_protocol_msg_array.cpp | 3 +++ 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/trunk/src/app/srs_app_edge.cpp b/trunk/src/app/srs_app_edge.cpp index 52f020ecb..426bbbe4e 100644 --- a/trunk/src/app/srs_app_edge.cpp +++ b/trunk/src/app/srs_app_edge.cpp @@ -498,6 +498,7 @@ int SrsEdgeForwarder::cycle() } // forward all messages. + // each msg in msgs.msgs must be free, for the SrsMessageArray never free them. int count = 0; if ((ret = queue->dump_packets(msgs.max, msgs.msgs, count)) != ERROR_SUCCESS) { srs_error("get message to push to origin failed. ret=%d", ret); @@ -522,7 +523,7 @@ int SrsEdgeForwarder::cycle() continue; } - // all msgs to forward to origin. + // sendout messages, all messages are freed by send_and_free_messages(). if ((ret = client->send_and_free_messages(msgs.msgs, count, stream_id)) != ERROR_SUCCESS) { srs_error("edge publish push message to server failed. ret=%d", ret); return ret; diff --git a/trunk/src/app/srs_app_forward.cpp b/trunk/src/app/srs_app_forward.cpp index 9c32600cb..6afd57a64 100644 --- a/trunk/src/app/srs_app_forward.cpp +++ b/trunk/src/app/srs_app_forward.cpp @@ -416,6 +416,7 @@ int SrsForwarder::forward() } // forward all messages. + // each msg in msgs.msgs must be free, for the SrsMessageArray never free them. int count = 0; if ((ret = queue->dump_packets(msgs.max, msgs.msgs, count)) != ERROR_SUCCESS) { srs_error("get message to forward failed. ret=%d", ret); @@ -438,7 +439,7 @@ int SrsForwarder::forward() continue; } - // all msgs to forward. + // sendout messages, all messages are freed by send_and_free_messages(). if ((ret = client->send_and_free_messages(msgs.msgs, count, stream_id)) != ERROR_SUCCESS) { srs_error("forwarder messages to server failed. ret=%d", ret); return ret; diff --git a/trunk/src/app/srs_app_rtmp_conn.cpp b/trunk/src/app/srs_app_rtmp_conn.cpp index 8b6304fa7..f2986c52e 100644 --- a/trunk/src/app/srs_app_rtmp_conn.cpp +++ b/trunk/src/app/srs_app_rtmp_conn.cpp @@ -558,6 +558,7 @@ int SrsRtmpConn::playing(SrsSource* source) pithy_print.elapse(); // get messages from consumer. + // each msg in msgs.msgs must be free, for the SrsMessageArray never free them. int count = 0; if ((ret = consumer->dump_packets(msgs.max, msgs.msgs, count)) != ERROR_SUCCESS) { srs_error("get messages from consumer failed. ret=%d", ret); @@ -591,9 +592,7 @@ int SrsRtmpConn::playing(SrsSource* source) } } - // sendout messages - // @remark, becareful, all msgs must be free explicitly, - // free by send_and_free_message or srs_freep. + // sendout messages, all messages are freed by send_and_free_messages(). if (count > 0) { // no need to assert msg, for the rtmp will assert it. if ((ret = rtmp->send_and_free_messages(msgs.msgs, count, res->stream_id)) != ERROR_SUCCESS) { diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index 7f454aaa7..506c6f025 100644 --- a/trunk/src/core/srs_core.hpp +++ b/trunk/src/core/srs_core.hpp @@ -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 24 +#define VERSION_REVISION 25 // server info. #define RTMP_SIG_SRS_KEY "SRS" #define RTMP_SIG_SRS_ROLE "origin/edge server" diff --git a/trunk/src/rtmp/srs_protocol_msg_array.cpp b/trunk/src/rtmp/srs_protocol_msg_array.cpp index c38569777..4c002bcf8 100644 --- a/trunk/src/rtmp/srs_protocol_msg_array.cpp +++ b/trunk/src/rtmp/srs_protocol_msg_array.cpp @@ -40,6 +40,9 @@ SrsMessageArray::SrsMessageArray(int max_msgs) SrsMessageArray::~SrsMessageArray() { + // we just free the msgs itself, + // both delete and delete[] is ok, + // for each msg in msgs is already freed by send_and_free_messages. srs_freep(msgs); }