winlin

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

... ... @@ -2201,11 +2201,11 @@ bool SrsConfig::get_realtime_enabled(string vhost)
}
conf = conf->get("min_latency");
if (!conf || conf->arg0() != "off") {
if (!conf || conf->arg0().empty()) {
return SRS_PERF_MIN_LATENCY_ENABLED;
}
return false;
return conf->arg0() == "on";
}
int SrsConfig::get_global_chunk_size()
... ...
... ... @@ -688,14 +688,12 @@ int SrsRtmpConn::do_playing(SrsSource* source, SrsQueueRecvThread* trd)
}
// 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) {
if (!srs_is_client_gracefully_close(ret)) {
srs_error("send messages to client failed. ret=%d", ret);
}
return ret;
// 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 (!srs_is_client_gracefully_close(ret)) {
srs_error("send messages to client failed. ret=%d", ret);
}
return ret;
}
// if duration specified, and exceed it, stop play live.
... ...
... ... @@ -237,7 +237,6 @@ public:
* get packets in consumer queue.
* @param msgs the msgs array to dump packets to send.
* @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);
#ifdef SRS_PERF_QUEUE_COND_WAIT
... ...
... ... @@ -768,6 +768,10 @@ int SrsProtocol::do_send_messages(SrsSharedPtrMessage** msgs, int nb_msgs)
// if cache is consumed, try another loop.
for (int i = 0; i < nb_msgs; i++) {
SrsSharedPtrMessage* msg = msgs[i];
if (!msg) {
continue;
}
// ignore empty message.
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++) {
SrsSharedPtrMessage* msg = msgs[i];
if (!msg) {
continue;
}
// check perfer cid and stream,
// when one msg stream id is ok, ignore left.
if (msg->check(stream_id)) {
... ...