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

for bug #257, support NULL msg in msgs to send.

This commit is contained in:
winlin 2014-12-13 11:22:40 +08:00
parent 66fd4bbf31
commit 5529813fcb
4 changed files with 15 additions and 10 deletions

View file

@ -2201,11 +2201,11 @@ bool SrsConfig::get_realtime_enabled(string vhost)
} }
conf = conf->get("min_latency"); conf = conf->get("min_latency");
if (!conf || conf->arg0() != "off") { if (!conf || conf->arg0().empty()) {
return SRS_PERF_MIN_LATENCY_ENABLED; return SRS_PERF_MIN_LATENCY_ENABLED;
} }
return false; return conf->arg0() == "on";
} }
int SrsConfig::get_global_chunk_size() int SrsConfig::get_global_chunk_size()

View file

@ -688,14 +688,12 @@ int SrsRtmpConn::do_playing(SrsSource* source, SrsQueueRecvThread* trd)
} }
// sendout messages, all messages are freed by send_and_free_messages(). // 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.
// no need to assert msg, for the rtmp will assert it. if (count > 0 && (ret = rtmp->send_and_free_messages(msgs.msgs, count, res->stream_id)) != ERROR_SUCCESS) {
if ((ret = rtmp->send_and_free_messages(msgs.msgs, count, res->stream_id)) != ERROR_SUCCESS) { if (!srs_is_client_gracefully_close(ret)) {
if (!srs_is_client_gracefully_close(ret)) { srs_error("send messages to client failed. ret=%d", ret);
srs_error("send messages to client failed. ret=%d", ret);
}
return ret;
} }
return ret;
} }
// if duration specified, and exceed it, stop play live. // if duration specified, and exceed it, stop play live.

View file

@ -237,7 +237,6 @@ public:
* get packets in consumer queue. * get packets in consumer queue.
* @param msgs the msgs array to dump packets to send. * @param msgs the msgs array to dump packets to send.
* @param count the count in array, output param. * @param count the count in array, output param.
* @max_count the max count to dequeue, must be positive.
*/ */
virtual int dump_packets(SrsMessageArray* msgs, int& count); virtual int dump_packets(SrsMessageArray* msgs, int& count);
#ifdef SRS_PERF_QUEUE_COND_WAIT #ifdef SRS_PERF_QUEUE_COND_WAIT

View file

@ -768,6 +768,10 @@ int SrsProtocol::do_send_messages(SrsSharedPtrMessage** msgs, int nb_msgs)
// if cache is consumed, try another loop. // if cache is consumed, try another loop.
for (int i = 0; i < nb_msgs; i++) { for (int i = 0; i < nb_msgs; i++) {
SrsSharedPtrMessage* msg = msgs[i]; SrsSharedPtrMessage* msg = msgs[i];
if (!msg) {
continue;
}
// ignore empty message. // ignore empty message.
if (!msg->payload || msg->size <= 0) { if (!msg->payload || msg->size <= 0) {
@ -1155,6 +1159,10 @@ int SrsProtocol::send_and_free_messages(SrsSharedPtrMessage** msgs, int nb_msgs,
for (int i = 0; i < nb_msgs; i++) { for (int i = 0; i < nb_msgs; i++) {
SrsSharedPtrMessage* msg = msgs[i]; SrsSharedPtrMessage* msg = msgs[i];
if (!msg) {
continue;
}
// check perfer cid and stream, // check perfer cid and stream,
// when one msg stream id is ok, ignore left. // when one msg stream id is ok, ignore left.
if (msg->check(stream_id)) { if (msg->check(stream_id)) {