Skip to content

Commit

Permalink
Merge pull request #12 from Telmate/PS-2221-FIX
Browse files Browse the repository at this point in the history
Remove static constructor and instanciate from main module
  • Loading branch information
avis authored Jul 23, 2018
2 parents 0f30626 + 04d973d commit 84c493e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,17 @@ TelmateFrameGrabberImpl::TelmateFrameGrabberImpl (const boost::property_tree::pt

{

g_object_set (element, "filter-factory", "telmateframegrabberopencvimpl", NULL);
g_object_get (G_OBJECT (element), "filter", &telmateframegrabberopencvimpl, NULL);
GST_DEBUG("TelmateFrameGrabberImpl::TelmateFrameGrabberImpl() called");

if (telmateframegrabberopencvimpl == nullptr) {
throw KurentoException (MEDIA_OBJECT_NOT_AVAILABLE,
"Media Object not available");
}

g_object_set (telmateframegrabberopencvimpl, "target-object",
static_cast<kurento::TelmateFrameGrabberOpenCVImpl *> (this), NULL);

g_object_unref (telmateframegrabberopencvimpl);

pTelmateFrameGrabberOpenCVImpl = (TelmateFrameGrabberOpenCVImpl*) telmateframegrabberopencvimpl;
pTelmateFrameGrabberOpenCVImpl = new TelmateFrameGrabberOpenCVImpl();

}


int TelmateFrameGrabberImpl::cleanup()
{
pTelmateFrameGrabberOpenCVImpl->cleanup();
delete pTelmateFrameGrabberOpenCVImpl;
pTelmateFrameGrabberOpenCVImpl = NULL;
return 1;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class TelmateFrameGrabberImpl : public OpenCVFilterImpl, public virtual TelmateF

private:

GstElement *telmateframegrabberopencvimpl{};
/*GstElement *telmateframegrabberopencvimpl{};*/
TelmateFrameGrabberOpenCVImpl *pTelmateFrameGrabberOpenCVImpl;

class StaticConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ namespace kurento {

TelmateFrameGrabberOpenCVImpl::TelmateFrameGrabberOpenCVImpl() {

GST_DEBUG_CATEGORY_INIT(GST_CAT_DEFAULT, GST_DEFAULT_NAME, 0,
GST_DEFAULT_NAME);


this->thrLoop = true;
this->snapInterval = 1000;
this->epName = "EP_NAME_UNINITIALIZED";
Expand Down Expand Up @@ -178,13 +182,4 @@ long TelmateFrameGrabberOpenCVImpl::getCurrentTimestampLong() {
return (tp.tv_sec * 1000 + tp.tv_usec / 1000);
}

TelmateFrameGrabberOpenCVImpl::StaticConstructor
TelmateFrameGrabberOpenCVImpl::staticConstructor;

TelmateFrameGrabberOpenCVImpl::StaticConstructor::StaticConstructor() {
GST_DEBUG_CATEGORY_INIT(GST_CAT_DEFAULT, GST_DEFAULT_NAME, 0,
GST_DEFAULT_NAME);
}


} // namespace kurento
Original file line number Diff line number Diff line change
Expand Up @@ -66,25 +66,12 @@ class TelmateFrameGrabberOpenCVImpl : public virtual OpenCVProcess {


protected:
std::shared_ptr<MediaObject> getSharedPtr() {
try {
return dynamic_cast <MediaObject *> (this)->shared_from_this();
} catch (...) {
return std::shared_ptr<MediaObject> ();
}
}

TelmateFrameGrabberOpenCVImpl* getFrameGrabberPtr() {
return this;
}

private:
class StaticConstructor {
public:
StaticConstructor();
};

static StaticConstructor staticConstructor;

boost::asio::io_service ioService;
boost::thread_group tp;
Expand All @@ -103,9 +90,6 @@ class TelmateFrameGrabberOpenCVImpl : public virtual OpenCVProcess {

boost::mutex workerThreadMutex;




};

} // namespace kurento
Expand Down

0 comments on commit 84c493e

Please sign in to comment.