void MediaSinkImpl::unlink (std::shared_ptr<MediaSourceImpl> mediaSrc, GstPad *sink) { RecMutex::Lock lock (mutex); std::shared_ptr<MediaSourceImpl> connectedSrcLocked; try { connectedSrcLocked = connectedSrc.lock(); } catch (const std::bad_weak_ptr &e) { } if (connectedSrcLocked != NULL && mediaSrc == connectedSrcLocked) { unlinkUnchecked (sink); connectedSrcLocked->removeSink (this); } }
void MediaSink::unlink (std::shared_ptr<MediaSrc> mediaSrc, GstPad *sink) { std::shared_ptr<MediaSrc> connectedSrcLocked; mutex.lock(); try { connectedSrcLocked = connectedSrc.lock(); } catch (const std::bad_weak_ptr &e) { } if (connectedSrcLocked != NULL && mediaSrc == connectedSrcLocked) { unlinkUnchecked (sink); connectedSrcLocked->removeSink (this); } mutex.unlock(); }