winlin

Merge branch '2.0release' of github.com:winlinvip/simple-rtmp-server into 2.0release

@@ -965,7 +965,7 @@ int SrsHttpServer::hls_update_m3u8(SrsRequest* r, string m3u8) @@ -965,7 +965,7 @@ int SrsHttpServer::hls_update_m3u8(SrsRequest* r, string m3u8)
965 { 965 {
966 int ret = ERROR_SUCCESS; 966 int ret = ERROR_SUCCESS;
967 967
968 - std::string mount = m3u8; 968 + std::string mount;
969 969
970 std::string sid = r->get_stream_url(); 970 std::string sid = r->get_stream_url();
971 SrsHlsEntry* entry = NULL; 971 SrsHlsEntry* entry = NULL;
@@ -980,8 +980,17 @@ int SrsHttpServer::hls_update_m3u8(SrsRequest* r, string m3u8) @@ -980,8 +980,17 @@ int SrsHttpServer::hls_update_m3u8(SrsRequest* r, string m3u8)
980 SrsHlsEntry* tmpl = thls[r->vhost]; 980 SrsHlsEntry* tmpl = thls[r->vhost];
981 981
982 entry = new SrsHlsEntry(); 982 entry = new SrsHlsEntry();
983 - entry->mount = tmpl->mount; 983 + mount = tmpl->mount;
984 984
  985 + // replace the vhost variable
  986 + mount = srs_string_replace(mount, "[vhost]", r->vhost);
  987 + mount = srs_string_replace(mount, "[app]", r->app);
  988 + mount = srs_string_replace(mount, "[stream]", r->stream);
  989 +
  990 + // remove the default vhost mount
  991 + mount = srs_string_replace(mount, SRS_CONSTS_RTMP_DEFAULT_VHOST"/", "/");
  992 +
  993 + entry->mount = mount;
985 shls[sid] = entry; 994 shls[sid] = entry;
986 995
987 if (entry->streams.find(mount) == entry->streams.end()) { 996 if (entry->streams.find(mount) == entry->streams.end()) {
@@ -997,6 +1006,8 @@ int SrsHttpServer::hls_update_m3u8(SrsRequest* r, string m3u8) @@ -997,6 +1006,8 @@ int SrsHttpServer::hls_update_m3u8(SrsRequest* r, string m3u8)
997 entry = shls[sid]; 1006 entry = shls[sid];
998 } 1007 }
999 1008
  1009 + mount = entry->mount;
  1010 +
1000 // update the m3u8 stream. 1011 // update the m3u8 stream.
1001 SrsHlsM3u8Stream* hms = dynamic_cast<SrsHlsM3u8Stream*>(entry->streams[mount]); 1012 SrsHlsM3u8Stream* hms = dynamic_cast<SrsHlsM3u8Stream*>(entry->streams[mount]);
1002 if (hms) { 1013 if (hms) {