Skip to content

Commit

Permalink
handle setStoragePath a bit different
Browse files Browse the repository at this point in the history
  • Loading branch information
Avi Saranga committed Jul 24, 2018
1 parent e1b337c commit 428d5c9
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 428d5c9

Please sign in to comment.