Browse Source

Add minimal refactoring to `MediaServer`

master
Krisjanis Rijnieks 9 years ago
parent
commit
a9e1ab7ecb
  1. 10
      src/MediaServer/MediaServer.cpp

10
src/MediaServer/MediaServer.cpp

@ -204,17 +204,23 @@ void MediaServer::unloadVideo(string & path){
}
// Reference count 0 or less, let's unload the video
ofLogNotice("MediaServer") << "Removing video " << path;
// Distroy video source
if(loadedSources.count(path)){
ofLogNotice("MediaServer") << "Source count before video removal: " << loadedSources.size() << endl;
ofLogNotice("MediaServer")
<< "Source count before video removal: "
<< loadedSources.size() << endl;
videoSource->clear();
map <string, BaseSource *>::iterator it = loadedSources.find(path);
delete it->second;
loadedSources.erase(it);
ofLogNotice("MediaServer") << "Source count after video removal: " << loadedSources.size() << endl;
ofLogNotice("MediaServer")
<< "Source count after video removal: "
<< loadedSources.size() << endl;
ofNotifyEvent(onVideoUnloaded, path, this);
return;
}
// Something wrong here, we should be out of the routine by now
stringstream failss;
failss << "Failed to remove video source: " << path;

Loading…
Cancel
Save