Various and and sundry fixes to random buffer stuff and things.
This commit is contained in:
parent
12e04b45af
commit
ae9e270821
2 changed files with 15 additions and 16 deletions
|
@ -393,23 +393,8 @@ namespace Mist {
|
|||
if (bufferLocations[tid].size() > 1){
|
||||
//Check if the first key starts on the second page or higher
|
||||
if (myMeta.tracks[tid].keys[0].getNumber() >= (++(bufferLocations[tid].begin()))->first || !config->is_active){
|
||||
//Find page in indexpage and null it
|
||||
for (int i = 0; i < 8192; i += 8){
|
||||
unsigned int thisKeyNum = ((((long long int *)(nProxy.metaPages[tid].mapped + i))[0]) >> 32) & 0xFFFFFFFF;
|
||||
if (thisKeyNum == htonl(bufferLocations[tid].begin()->first) && ((((long long int *)(nProxy.metaPages[tid].mapped + i))[0]) != 0)){
|
||||
(((long long int *)(nProxy.metaPages[tid].mapped + i))[0]) = 0;
|
||||
}
|
||||
}
|
||||
DEBUG_MSG(DLVL_DEVEL, "Erasing track %d, keys %lu-%lu from buffer", tid, bufferLocations[tid].begin()->first, bufferLocations[tid].begin()->first + bufferLocations[tid].begin()->second.keyNum - 1);
|
||||
bufferRemove(tid, bufferLocations[tid].begin()->first);
|
||||
for (int i = 0; i < 1024; i++){
|
||||
int * tmpOffset = (int *)(nProxy.metaPages[tid].mapped + (i * 8));
|
||||
int tmpNum = ntohl(tmpOffset[0]);
|
||||
if (tmpNum == bufferLocations[tid].begin()->first){
|
||||
tmpOffset[0] = 0;
|
||||
tmpOffset[1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
nProxy.curPageNum.erase(tid);
|
||||
char thisPageName[NAME_BUFFER_SIZE];
|
||||
|
@ -551,8 +536,9 @@ namespace Mist {
|
|||
}
|
||||
for (std::map<unsigned int, DTSC::Track>::iterator it = myMeta.tracks.begin(); it != myMeta.tracks.end(); it++){
|
||||
//non-video tracks need to have a second keyframe that is <= firstVideo
|
||||
//firstVideo = 1 happens when there are no tracks, in which case we don't care any more
|
||||
if (it->second.type != "video"){
|
||||
if (it->second.keys.size() < 2 || it->second.keys[1].getTime() > firstVideo){
|
||||
if (it->second.keys.size() < 2 || (it->second.keys[1].getTime() > firstVideo && firstVideo != 1)){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
13
src/io.cpp
13
src/io.cpp
|
@ -96,6 +96,19 @@ namespace Mist {
|
|||
//If the track is accepted, we will have a mapped tid
|
||||
unsigned long mapTid = trackMap[tid];
|
||||
|
||||
//Before we start a new page, make sure we can be heard by the buffer about this.
|
||||
//Otherwise, it might linger forever as a nasty data leak.
|
||||
//Nobody likes nasty data leaks.
|
||||
{
|
||||
char pageName[NAME_BUFFER_SIZE];
|
||||
snprintf(pageName, NAME_BUFFER_SIZE, SHM_TRACK_INDEX, streamName.c_str(), mapTid);
|
||||
IPC::sharedPage checkPage(pageName, 8 * 1024 * 1024, false, false);
|
||||
if (!checkPage.mapped){
|
||||
WARN_MSG("The buffer deleted our index. Aborting new page.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//If we are currently buffering a page, abandon it completely and print a message about this
|
||||
//This page will NEVER be deleted, unless we open it again later.
|
||||
if (curPage.count(tid)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue