Skip to content

Commit

Permalink
Merge pull request #14 from Telmate/PS-2221-FIX
Browse files Browse the repository at this point in the history
handle setStoragePath a bit different
  • Loading branch information
avis authored Jul 24, 2018
2 parents 3c0dd90 + 428d5c9 commit fbbb6d2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ std::string TelmateFrameGrabberImpl::getStoragePath ()

void TelmateFrameGrabberImpl::setStoragePath (const std::string &path)
{
pTelmateFrameGrabberOpenCVImpl->storagePath = path;
pTelmateFrameGrabberOpenCVImpl->setStoragePath(path);
}

void TelmateFrameGrabberImpl::setWebRtcEpName (const std::string &epName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,6 @@ void TelmateFrameGrabberOpenCVImpl::queueHandler() {

while (this->thrLoop) {

if(this->storagePath.empty()) {
boost::this_thread::sleep_for(boost::chrono::milliseconds(50));
continue;
}
this->frameQueue->pop(ptrVf); // blocks
params.clear(); // clear the vector since the last iteration.
this->lastQueueTimeStamp = this->getCurrentTimestampLong();
Expand Down Expand Up @@ -168,6 +164,23 @@ void TelmateFrameGrabberOpenCVImpl::queueHandler() {
}


/* This function provides the ability to update the storage path for
* snapshot storage per endpoint
*/
void TelmateFrameGrabberOpenCVImpl::setStoragePath(std::string storagePath) {

this->storagePath = storagePath;

this->storagePathSubdir = this->storagePath + "/frames_" + this->getCurrentTimestampString();
boost::filesystem::path dir(this->storagePathSubdir.c_str());
if (!boost::filesystem::create_directories(dir)) {
GST_ERROR("%s create_directories() failed for: %s", this->epName.c_str(),
this->storagePathSubdir.c_str());
}

GST_INFO("Storage path has been updated to %s for %s", this->storagePath.c_str(), this->epName.c_str());
}

std::string TelmateFrameGrabberOpenCVImpl::getCurrentTimestampString() {
struct timeval tp;
long int ms;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class TelmateFrameGrabberOpenCVImpl : public virtual OpenCVProcess {
std::string storagePath;
std::string epName;
int outputFormat; // 0x0=JPEG 0x1=PNG

void setStoragePath(std::string storagePath);


protected:
Expand Down

0 comments on commit fbbb6d2

Please sign in to comment.