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:
parent
66fd4bbf31
commit
5529813fcb
4 changed files with 15 additions and 10 deletions
|
@ -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
|
||||
|
|
|
@ -769,6 +769,10 @@ int SrsProtocol::do_send_messages(SrsSharedPtrMessage** msgs, int nb_msgs)
|
|||
for (int i = 0; i < nb_msgs; i++) {
|
||||
SrsSharedPtrMessage* msg = msgs[i];
|
||||
|
||||
if (!msg) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// ignore empty message.
|
||||
if (!msg->payload || msg->size <= 0) {
|
||||
srs_info("ignore empty message.");
|
||||
|
@ -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)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue