[asterisk-scf-commits] asterisk-scf/integration/bridging.git branch "mediamixer" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Mon Aug 22 17:55:53 CDT 2011
branch "mediamixer" has been updated
via e5cae4226e48ac5ba477e598292e0c185e3188bf (commit)
from 251a67ec3b6186a871ce282304e55f8b0d4a019c (commit)
Summary of changes:
src/MediaMixer.cpp | 30 ++++++++++++++++++++++++++++++
src/MediaSplicer.cpp | 31 +++++++++++++++++++++++++++++++
src/MediaSplicer.h | 1 +
src/SessionWrapper.cpp | 3 +++
4 files changed, 65 insertions(+), 0 deletions(-)
- Log -----------------------------------------------------------------
commit e5cae4226e48ac5ba477e598292e0c185e3188bf
Author: Joshua Colp <jcolp at digium.com>
Date: Mon Aug 22 19:57:42 2011 -0300
Add some code for replication. Mixers and sources/sinks will now be created when replication updates occur.
diff --git a/src/MediaMixer.cpp b/src/MediaMixer.cpp
index 6ff52c6..594d95d 100755
--- a/src/MediaMixer.cpp
+++ b/src/MediaMixer.cpp
@@ -97,6 +97,14 @@ public:
mProxy = proxy;
}
+ /**
+ * Internal function which gets our proxy.
+ */
+ StreamSourcePrx getProxy()
+ {
+ return mProxy;
+ }
+
private:
/**
* Lock which protects this source.
@@ -209,6 +217,14 @@ public:
mProxy = proxy;
}
+ /**
+ * Internal function which returns our proxy.
+ */
+ StreamSinkPrx getProxy()
+ {
+ return mProxy;
+ }
+
private:
/**
* Lock which protects this sink.
@@ -325,6 +341,20 @@ void MediaMixer::removeSink(const MediaMixerSinkPtr& sink, const StreamSinkPrx&
void MediaMixer::stop()
{
mImpl->mTimer->destroy();
+
+ for (std::vector<MediaMixerSinkPtr>::const_iterator sink = mImpl->mSinks.begin();
+ sink != mImpl->mSinks.end();
+ ++sink)
+ {
+ mImpl->mAdapter->remove((*sink)->getProxy()->ice_getIdentity());
+ }
+
+ for (std::vector<MediaMixerSourcePtr>::const_iterator source = mImpl->mSources.begin();
+ source != mImpl->mSources.end();
+ ++source)
+ {
+ mImpl->mAdapter->remove((*source)->getProxy()->ice_getIdentity());
+ }
}
}
diff --git a/src/MediaSplicer.cpp b/src/MediaSplicer.cpp
index 4c8f5ce..6b2ccab 100755
--- a/src/MediaSplicer.cpp
+++ b/src/MediaSplicer.cpp
@@ -502,6 +502,11 @@ public:
void disableMixing()
{
+ if (mMixer == false)
+ {
+ return;
+ }
+
MediaMixerPtr mixer;
while ((mixer = mMediaMixers.back()))
{
@@ -512,6 +517,27 @@ public:
mMixer = false;
}
+ void update(const AsteriskSCF::Replication::BridgeService::V1::SessionPairingPtr& pairing)
+ {
+ if (pairing->incomingMediaPairings.empty() || pairing->outgoingMediaPairings.empty())
+ {
+ return;
+ }
+
+ // If this is connected to a mixer we need to set things up
+ if (pairing->incomingMediaPairings.front()->sink->ice_getIdentity().name.rfind(".mixer") == std::string::npos)
+ {
+ return;
+ }
+
+ mMixer = true;
+
+ vector<OutgoingPairing> outgoing;
+ vector<IncomingPairing> incoming;
+
+ findCompatiblePairings(pairing->streams, outgoing, incoming);
+ }
+
void findCompatiblePairings(const StreamInformationDict& streams, vector<OutgoingPairing>& outgoing,
vector<IncomingPairing>& incoming)
{
@@ -1133,3 +1159,8 @@ void MediaSplicer::disableMixing()
{
mImpl->disableMixing();
}
+
+void MediaSplicer::update(const AsteriskSCF::Replication::BridgeService::V1::SessionPairingPtr& pairing)
+{
+ mImpl->update(pairing);
+}
diff --git a/src/MediaSplicer.h b/src/MediaSplicer.h
index 80aa187..18aa36f 100644
--- a/src/MediaSplicer.h
+++ b/src/MediaSplicer.h
@@ -91,6 +91,7 @@ public:
MediaConnectorPtr createReplica(const AsteriskSCF::Replication::BridgeService::V1::SessionPairingPtr& pairings);
void enableMixing();
void disableMixing();
+ void update(const AsteriskSCF::Replication::BridgeService::V1::SessionPairingPtr&);
private:
boost::shared_ptr<MediaSplicerI> mImpl;
diff --git a/src/SessionWrapper.cpp b/src/SessionWrapper.cpp
index 1178f5e..45aebf5 100644
--- a/src/SessionWrapper.cpp
+++ b/src/SessionWrapper.cpp
@@ -506,6 +506,9 @@ void SessionWrapper::updateMedia(const SessionPairingPtr& pairings)
{
mLogger(Debug) << FUNLOG << " for " << mId;
boost::unique_lock<boost::shared_mutex> lock(mLock);
+
+ mSplicer->update(pairings);
+
if (mConnector)
{
mConnector->update(pairings);
-----------------------------------------------------------------------
--
asterisk-scf/integration/bridging.git
More information about the asterisk-scf-commits
mailing list