Fixed progressive connector.

This commit is contained in:
Thulinma 2013-07-04 16:28:15 +02:00
parent 04bc5842bd
commit 863cd6c8b6
2 changed files with 4 additions and 4 deletions

View file

@ -108,9 +108,10 @@ namespace Buffer {
//switch to next buffer //switch to next buffer
currsend = 0; currsend = 0;
if (Stream::get()->getStream()->isNewest(myRing->b)){ if (Stream::get()->getStream()->isNewest(myRing->b)){
//no next buffer? go in waiting mode.
myRing->waiting = true; myRing->waiting = true;
return false; return false;
} //no next buffer? go in waiting mode. }
myRing->b = Stream::get()->getStream()->getNext(myRing->b, allowedTracks); myRing->b = Stream::get()->getStream()->getNext(myRing->b, allowedTracks);
if (Stream::get()->getStream()->getPacket(myRing->b).isMember("keyframe") && myRing->playCount > 0){ if (Stream::get()->getStream()->getPacket(myRing->b).isMember("keyframe") && myRing->playCount > 0){
myRing->playCount--; myRing->playCount--;

View file

@ -126,7 +126,6 @@ namespace Connector_HTTP {
} }
int byterate = 0; int byterate = 0;
for (JSON::ObjIter objIt = Strm.metadata["tracks"].ObjBegin(); objIt != Strm.metadata["tracks"].ObjEnd(); objIt++){ for (JSON::ObjIter objIt = Strm.metadata["tracks"].ObjBegin(); objIt != Strm.metadata["tracks"].ObjEnd(); objIt++){
std::cerr << objIt->second["type"].asString() << " => " << objIt->second["trackid"].asInt() << std::endl;
if (videoID == -1 && objIt->second["type"].asString() == "video"){ if (videoID == -1 && objIt->second["type"].asString() == "video"){
videoID = objIt->second["trackid"].asInt(); videoID = objIt->second["trackid"].asInt();
} }
@ -140,6 +139,7 @@ namespace Connector_HTTP {
if (audioID != -1){ if (audioID != -1){
byterate += Strm.getTrackById(audioID)["bps"].asInt(); byterate += Strm.getTrackById(audioID)["bps"].asInt();
} }
if ( !byterate){byterate = 1;}
seek_sec = (seek_byte / byterate) * 1000; seek_sec = (seek_byte / byterate) * 1000;
std::stringstream cmd; std::stringstream cmd;
cmd << "t"; cmd << "t";
@ -150,7 +150,7 @@ namespace Connector_HTTP {
cmd << " " << audioID; cmd << " " << audioID;
} }
cmd << "\ns " << seek_sec << "\np\n"; cmd << "\ns " << seek_sec << "\np\n";
ss.SendNow(cmd.str().c_str()); ss.SendNow(cmd.str().c_str(), cmd.str().size());
inited = true; inited = true;
} }
unsigned int now = Util::epoch(); unsigned int now = Util::epoch();
@ -158,7 +158,6 @@ namespace Connector_HTTP {
lastStats = now; lastStats = now;
ss.SendNow(conn.getStats("HTTP_Progressive").c_str()); ss.SendNow(conn.getStats("HTTP_Progressive").c_str());
} }
///\todo UPDATE THIS TO DTSCv2 too
if (ss.spool()){ if (ss.spool()){
while (Strm.parsePacket(ss.Received())){ while (Strm.parsePacket(ss.Received())){
if ( !progressive_has_sent_header){ if ( !progressive_has_sent_header){