Fixed audio-only HLS output

This commit is contained in:
Thulinma 2015-03-14 14:02:46 +01:00
parent cf52b6bbcc
commit 92d5d9be51

View file

@ -17,8 +17,10 @@ namespace Mist {
break; break;
} }
} }
unsigned int vidTracks = 0;
for (std::map<unsigned int,DTSC::Track>::iterator it = myMeta.tracks.begin(); it != myMeta.tracks.end(); it++){ for (std::map<unsigned int,DTSC::Track>::iterator it = myMeta.tracks.begin(); it != myMeta.tracks.end(); it++){
if (it->second.codec == "H264"){ if (it->second.codec == "H264"){
vidTracks++;
int bWidth = it->second.bps * 2; int bWidth = it->second.bps * 2;
if (bWidth < 5){ if (bWidth < 5){
bWidth = 5; bWidth = 5;
@ -34,6 +36,10 @@ namespace Mist {
result << "/index.m3u8\r\n"; result << "/index.m3u8\r\n";
} }
} }
if (!vidTracks && audioId){
result << "#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=" << myMeta.tracks[audioId].bps * 20 << "\r\n";
result << audioId << "/index.m3u8\r\n";
}
DEBUG_MSG(DLVL_HIGH, "Sending this index: %s", result.str().c_str()); DEBUG_MSG(DLVL_HIGH, "Sending this index: %s", result.str().c_str());
return result.str(); return result.str();
} }