mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
refine the ptr array free, 0.9.96
This commit is contained in:
parent
dc66c525fd
commit
3ebda13802
5 changed files with 58 additions and 49 deletions
|
@ -513,6 +513,7 @@ int SrsRtmpConn::playing(SrsSource* source)
|
|||
srs_verbose("no packets in queue.");
|
||||
continue;
|
||||
}
|
||||
SrsAutoFreeArray(SrsSharedPtrMessage, msgs, count);
|
||||
|
||||
// sendout messages
|
||||
// @remark, becareful, all msgs must be free explicitly,
|
||||
|
@ -526,13 +527,6 @@ int SrsRtmpConn::playing(SrsSource* source)
|
|||
|
||||
srs_assert(msg);
|
||||
|
||||
// never use free msgs array, for it will memory leak.
|
||||
// if error, directly free msgs.
|
||||
if (ret != ERROR_SUCCESS) {
|
||||
srs_freep(msg);
|
||||
continue;
|
||||
}
|
||||
|
||||
// foreach msg, collect the duration.
|
||||
// @remark: never use msg when sent it, for the protocol sdk will free it.
|
||||
if (starttime < 0 || starttime > msg->header.timestamp) {
|
||||
|
@ -543,14 +537,9 @@ int SrsRtmpConn::playing(SrsSource* source)
|
|||
|
||||
if ((ret = rtmp->send_and_free_message(msg)) != ERROR_SUCCESS) {
|
||||
srs_error("send message to client failed. ret=%d", ret);
|
||||
continue;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
// free the array itself.
|
||||
srs_freep(msgs);
|
||||
if (ret != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
// if duration specified, and exceed it, stop play live.
|
||||
// @see: https://github.com/winlinvip/simple-rtmp-server/issues/45
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue