Those last two commit, but slightly better.
This commit is contained in:
parent
9cdf8d92a1
commit
588e171733
2 changed files with 33 additions and 27 deletions
|
@ -206,6 +206,8 @@ void DTSC::Stream::addPacket(JSON::Value & newPack){
|
||||||
newPos.seekTime = lastPos.seekTime+1;
|
newPos.seekTime = lastPos.seekTime+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
buffers.clear();
|
||||||
}
|
}
|
||||||
std::string newTrack = trackMapping[newPos.trackID];
|
std::string newTrack = trackMapping[newPos.trackID];
|
||||||
while (buffers.count(newPos) > 0){
|
while (buffers.count(newPos) > 0){
|
||||||
|
@ -237,10 +239,10 @@ void DTSC::Stream::addPacket(JSON::Value & newPack){
|
||||||
}
|
}
|
||||||
int keySize = metadata["tracks"][newTrack]["keys"].size();
|
int keySize = metadata["tracks"][newTrack]["keys"].size();
|
||||||
if (buffercount > 1){
|
if (buffercount > 1){
|
||||||
metadata["tracks"][newTrack]["lastms"] = newPack["time"];
|
|
||||||
#define prevKey metadata["tracks"][newTrack]["keys"][keySize - 1]
|
#define prevKey metadata["tracks"][newTrack]["keys"][keySize - 1]
|
||||||
if (newPack.isMember("keyframe") || !keySize || (datapointertype != VIDEO && newPack["time"].asInt() - 2000 > prevKey["time"].asInt())){
|
if (newPack.isMember("keyframe") || !keySize || (datapointertype != VIDEO && newPack["time"].asInt() - 2000 > prevKey["time"].asInt())){
|
||||||
updateMeta = true;
|
updateMeta = true;
|
||||||
|
metadata["tracks"][newTrack]["lastms"] = newPack["time"];
|
||||||
keyframes[newPos.trackID].insert(newPos);
|
keyframes[newPos.trackID].insert(newPos);
|
||||||
JSON::Value key;
|
JSON::Value key;
|
||||||
key["time"] = newPack["time"];
|
key["time"] = newPack["time"];
|
||||||
|
|
|
@ -91,40 +91,44 @@ void Util::Procs::childsig_handler(int signum){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int status;
|
int status;
|
||||||
pid_t ret = waitpid( -1, &status, 0);
|
pid_t ret = -1;
|
||||||
if (ret <= 0){
|
while (ret != 0){
|
||||||
childsig_handler(signum);
|
ret = waitpid( -1, &status, WNOHANG);
|
||||||
return;
|
if (ret <= 0){ //ignore, would block otherwise
|
||||||
}
|
if (ret == 0 || errno != EINTR){
|
||||||
int exitcode;
|
return;
|
||||||
if (WIFEXITED(status)){
|
}
|
||||||
exitcode = WEXITSTATUS(status);
|
}
|
||||||
}else if (WIFSIGNALED(status)){
|
int exitcode;
|
||||||
exitcode = -WTERMSIG(status);
|
if (WIFEXITED(status)){
|
||||||
}else{/* not possible */
|
exitcode = WEXITSTATUS(status);
|
||||||
return;
|
}else if (WIFSIGNALED(status)){
|
||||||
}
|
exitcode = -WTERMSIG(status);
|
||||||
|
}else{/* not possible */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#if DEBUG >= 1
|
#if DEBUG >= 1
|
||||||
std::string pname = plist[ret];
|
std::string pname = plist[ret];
|
||||||
#endif
|
#endif
|
||||||
plist.erase(ret);
|
plist.erase(ret);
|
||||||
#if DEBUG >= 1
|
#if DEBUG >= 1
|
||||||
if (isActive(pname)){
|
if (isActive(pname)){
|
||||||
Stop(pname);
|
Stop(pname);
|
||||||
} else{
|
} else{
|
||||||
//can this ever happen?
|
//can this ever happen?
|
||||||
std::cerr << "Process " << pname << " fully terminated." << std::endl;
|
std::cerr << "Process " << pname << " fully terminated." << std::endl;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (exitHandlers.count(ret) > 0){
|
if (exitHandlers.count(ret) > 0){
|
||||||
TerminationNotifier tn = exitHandlers[ret];
|
TerminationNotifier tn = exitHandlers[ret];
|
||||||
exitHandlers.erase(ret);
|
exitHandlers.erase(ret);
|
||||||
#if DEBUG >= 2
|
#if DEBUG >= 2
|
||||||
std::cerr << "Calling termination handler for " << pname << std::endl;
|
std::cerr << "Calling termination handler for " << pname << std::endl;
|
||||||
#endif
|
#endif
|
||||||
tn(ret, exitcode);
|
tn(ret, exitcode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue