1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

refine code for bug #194, use send messages for all msg array.

This commit is contained in:
winlin 2014-11-14 11:24:49 +08:00
parent f11272e3ce
commit 47ed9e33dd
8 changed files with 38 additions and 52 deletions

View file

@ -559,7 +559,7 @@ int SrsRtmpConn::playing(SrsSource* source)
// get messages from consumer.
int count = 0;
if ((ret = consumer->dump_packets(msgs.size, msgs.msgs, count)) != ERROR_SUCCESS) {
if ((ret = consumer->dump_packets(msgs.max, msgs.msgs, count)) != ERROR_SUCCESS) {
srs_error("get messages from consumer failed. ret=%d", ret);
return ret;
}
@ -596,16 +596,10 @@ int SrsRtmpConn::playing(SrsSource* source)
// free by send_and_free_message or srs_freep.
if (count > 0) {
// no need to assert msg, for the rtmp will assert it.
ret = rtmp->send_and_free_messages(msgs.msgs, count, res->stream_id);
}
for (int i = 0; i < count; i++) {
// the send_message will free the msg,
// so set the msgs[i] to NULL.
msgs.msgs[i] = NULL;
}
if (ret != ERROR_SUCCESS) {
srs_error("send messages to client failed. ret=%d", ret);
return ret;
if ((ret = rtmp->send_and_free_messages(msgs.msgs, count, res->stream_id)) != ERROR_SUCCESS) {
srs_error("send messages to client failed. ret=%d", ret);
return ret;
}
}
// if duration specified, and exceed it, stop play live.