Fixed some memory tracking issues for DTSC Streams.
This commit is contained in:
parent
082dd2e7c8
commit
ff43c98373
1 changed files with 4 additions and 1 deletions
|
@ -169,10 +169,11 @@ bool DTSC::Stream::parsePacket(Socket::Buffer & buffer){
|
||||||
|
|
||||||
/// Adds a keyframe packet to all tracks, so the stream can be fully played.
|
/// Adds a keyframe packet to all tracks, so the stream can be fully played.
|
||||||
void DTSC::Stream::endStream(){
|
void DTSC::Stream::endStream(){
|
||||||
|
if (!metadata.tracks.size()){return;}
|
||||||
for (std::map<int,Track>::iterator it = metadata.tracks.begin(); it != metadata.tracks.end(); it++){
|
for (std::map<int,Track>::iterator it = metadata.tracks.begin(); it != metadata.tracks.end(); it++){
|
||||||
JSON::Value newPack;
|
JSON::Value newPack;
|
||||||
newPack["time"] = it->second.lastms;
|
newPack["time"] = it->second.lastms;
|
||||||
newPack["trackid"] = it->second.trackID;
|
newPack["trackid"] = it->first;
|
||||||
newPack["keyframe"] = 1ll;
|
newPack["keyframe"] = 1ll;
|
||||||
newPack["data"] = "";
|
newPack["data"] = "";
|
||||||
addPacket(newPack);
|
addPacket(newPack);
|
||||||
|
@ -232,6 +233,7 @@ void DTSC::Stream::addPacket(JSON::Value & newPack){
|
||||||
livePos newPos;
|
livePos newPos;
|
||||||
newPos.trackID = newPack["trackid"].asInt();
|
newPos.trackID = newPack["trackid"].asInt();
|
||||||
newPos.seekTime = newPack["time"].asInt();
|
newPos.seekTime = newPack["time"].asInt();
|
||||||
|
if (!metadata.tracks.count(newPos.trackID)){return;}
|
||||||
if (buffercount > 1 && metadata.tracks[newPos.trackID].keys.size() > 1 && newPos.seekTime < (long long unsigned int)metadata.tracks[newPos.trackID].keys.rbegin()->getTime()){
|
if (buffercount > 1 && metadata.tracks[newPos.trackID].keys.size() > 1 && newPos.seekTime < (long long unsigned int)metadata.tracks[newPos.trackID].keys.rbegin()->getTime()){
|
||||||
resetStream();
|
resetStream();
|
||||||
}
|
}
|
||||||
|
@ -285,6 +287,7 @@ void DTSC::Stream::addPacket(JSON::Value & newPack){
|
||||||
/// Deletes a the first part of the buffer, updating the keyframes list and metadata as required.
|
/// Deletes a the first part of the buffer, updating the keyframes list and metadata as required.
|
||||||
/// Will print a warning if a track has less than 2 keyframes left because of this.
|
/// Will print a warning if a track has less than 2 keyframes left because of this.
|
||||||
void DTSC::Stream::cutOneBuffer(){
|
void DTSC::Stream::cutOneBuffer(){
|
||||||
|
if ( !buffers.size()){return;}
|
||||||
int trid = buffers.begin()->first.trackID;
|
int trid = buffers.begin()->first.trackID;
|
||||||
long long unsigned int delTime = buffers.begin()->first.seekTime;
|
long long unsigned int delTime = buffers.begin()->first.seekTime;
|
||||||
if (buffercount > 1){
|
if (buffercount > 1){
|
||||||
|
|
Loading…
Add table
Reference in a new issue