From a6eebacc994c26b7366b6709f65ca8fe16b211e3 Mon Sep 17 00:00:00 2001 From: Chengdong Zhang Date: Sat, 11 Mar 2017 16:21:33 +0800 Subject: [PATCH] Streams API is not correct. (#800) HTTP API for streams is not correct. When stream stopped, API does not remove it. --- trunk/src/app/srs_app_statistic.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/trunk/src/app/srs_app_statistic.cpp b/trunk/src/app/srs_app_statistic.cpp index 3d708a084..d9bf77143 100644 --- a/trunk/src/app/srs_app_statistic.cpp +++ b/trunk/src/app/srs_app_statistic.cpp @@ -358,8 +358,19 @@ void SrsStatistic::on_stream_close(SrsRequest* req) { SrsStatisticVhost* vhost = create_vhost(req); SrsStatisticStream* stream = create_stream(vhost, req); - stream->close(); + + //TODO Is this correct? Something is not released? + std::map::iterator it; + if ((it=streams.find(stream->id)) != streams.end()) { + streams.erase(it); + } + + std::map::iterator sit; + if ((sit=rstreams.find(stream->url)) != rstreams.end()) { + rstreams.erase(sit); + } + } int SrsStatistic::on_client(int id, SrsRequest* req, SrsConnection* conn, SrsRtmpConnType type)