winlin

refine comments for SrsMessageArray. 2.0.25

... ... @@ -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;
... ...
... ... @@ -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;
... ...
... ... @@ -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) {
... ...
... ... @@ -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"
... ...
... ... @@ -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);
}
... ...