Progressive now works with continuously updated metadata
This commit is contained in:
parent
a69583fd49
commit
4dbca1e680
3 changed files with 12 additions and 3 deletions
12
lib/dtsc.cpp
12
lib/dtsc.cpp
|
@ -206,6 +206,10 @@ bool DTSC::Stream::hasAudio(){
|
|||
return metadata.isMember("audio");
|
||||
}
|
||||
|
||||
void DTSC::Stream::setBufferTime(unsigned int ms){
|
||||
buffertime = ms;
|
||||
}
|
||||
|
||||
/// Returns a packed DTSC packet, ready to sent over the network.
|
||||
std::string & DTSC::Stream::outPacket(unsigned int num){
|
||||
static std::string emptystring;
|
||||
|
@ -261,7 +265,7 @@ void DTSC::Stream::advanceRings(){
|
|||
//increase buffer size if no keyframes available or too little time available
|
||||
timeBuffered = buffers[keyframes[keyframes.size() - 1].b]["time"].asInt() - buffers[keyframes[0].b]["time"].asInt();
|
||||
}
|
||||
if (((buffercount > 1) && (keyframes.size() < 2)) || (timeBuffered < buffertime)){
|
||||
if (buffercount > 1 && (keyframes.size() < 2 || timeBuffered < buffertime)){
|
||||
buffercount++;
|
||||
}
|
||||
}
|
||||
|
@ -272,6 +276,8 @@ DTSC::Ring::Ring(unsigned int v){
|
|||
b = v;
|
||||
waiting = false;
|
||||
starved = false;
|
||||
updated = false;
|
||||
playCount = 0;
|
||||
}
|
||||
|
||||
/// Requests a new Ring, which will be created and added to the internal Ring list.
|
||||
|
@ -316,13 +322,13 @@ void DTSC::Stream::updateRingHeaders(){
|
|||
}
|
||||
}
|
||||
|
||||
unsigned int DSTSC::Stream::msSeek(unsigned int ms) {
|
||||
unsigned int DTSC::Stream::msSeek(unsigned int ms) {
|
||||
for( std::deque<DTSC::Ring>::iterator it = keyframes.begin(); it != keyframes.end(); it++ ) {
|
||||
if( buffers[it->b]["time"].asInt( ) < ms ) {
|
||||
return it->b;
|
||||
}
|
||||
}
|
||||
///\todo Send PauseMark
|
||||
return keyframes[keyframes.size()-1].b;
|
||||
}
|
||||
|
||||
/// Properly cleans up the object for erasing.
|
||||
|
|
|
@ -102,6 +102,7 @@ namespace DTSC {
|
|||
volatile bool waiting; ///< If true, this Ring is currently waiting for a buffer fill.
|
||||
volatile bool starved; ///< If true, this Ring can no longer receive valid data.
|
||||
volatile bool updated; ///< If true, this Ring should write a new header.
|
||||
volatile int playCount;
|
||||
};
|
||||
|
||||
/// Holds temporary data for a DTSC stream and provides functions to utilize it.
|
||||
|
@ -127,6 +128,7 @@ namespace DTSC {
|
|||
void dropRing(Ring * ptr);
|
||||
void updateHeaders();
|
||||
unsigned int msSeek(unsigned int ms);
|
||||
void setBufferTime(unsigned int ms);
|
||||
private:
|
||||
std::deque<JSON::Value> buffers;
|
||||
std::set<DTSC::Ring *> rings;
|
||||
|
|
|
@ -476,6 +476,7 @@ std::string & JSON::Value::toNetPacked(){
|
|||
//check if this is legal
|
||||
if (myType != OBJECT){
|
||||
fprintf(stderr, "Error: Only objects may be NetPacked!\n");
|
||||
abort();
|
||||
return emptystring;
|
||||
}
|
||||
//if sneaky storage doesn't contain correct data, re-calculate it
|
||||
|
|
Loading…
Add table
Reference in a new issue