winlin

fix the http flv mount bug.

@@ -805,7 +805,14 @@ int SrsHttpStreamServer::http_mount(SrsSource* s, SrsRequest* r) @@ -805,7 +805,14 @@ int SrsHttpStreamServer::http_mount(SrsSource* s, SrsRequest* r)
805 entry->cache = new SrsStreamCache(s, r); 805 entry->cache = new SrsStreamCache(s, r);
806 entry->stream = new SrsLiveStream(s, r, entry->cache); 806 entry->stream = new SrsLiveStream(s, r, entry->cache);
807 807
808 - srs_assert(!tmpl->req); 808 + // TODO: FIXME: maybe refine the logic of http remux service.
  809 + // if user push streams followed:
  810 + // rtmp://test.com/live/stream1
  811 + // rtmp://test.com/live/stream2
  812 + // and they will using the same template, such as: [vhost]/[app]/[stream].flv
  813 + // so, need to free last request object, otherwise, it will cause memory leak.
  814 + srs_freep(tmpl->req);
  815 +
809 tmpl->source = s; 816 tmpl->source = s;
810 tmpl->req = r->copy(); 817 tmpl->req = r->copy();
811 818
@@ -1170,8 +1177,8 @@ int SrsHttpStreamServer::hijack(ISrsHttpMessage* request, ISrsHttpHandler** ph) @@ -1170,8 +1177,8 @@ int SrsHttpStreamServer::hijack(ISrsHttpMessage* request, ISrsHttpHandler** ph)
1170 std::string sid = r->get_stream_url(); 1177 std::string sid = r->get_stream_url();
1171 // check if the stream is enabled. 1178 // check if the stream is enabled.
1172 if (sflvs.find(sid) != sflvs.end()) { 1179 if (sflvs.find(sid) != sflvs.end()) {
1173 - SrsLiveEntry* entry = sflvs[sid];  
1174 - if (!entry->stream->entry->enabled) { 1180 + SrsLiveEntry* s_entry = sflvs[sid];
  1181 + if (!s_entry->stream->entry->enabled) {
1175 srs_error("stream is disabled, hijack failed. ret=%d", ret); 1182 srs_error("stream is disabled, hijack failed. ret=%d", ret);
1176 return ret; 1183 return ret;
1177 } 1184 }