[asterisk-scf-commits] asterisk-scf/release/media_rtp_pjmedia.git branch "master" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Fri Feb 4 05:52:33 CST 2011
branch "master" has been updated
via 5a66fe64bbaf6449dad3c5966275c4e3b58c2c1c (commit)
from 3ab1fdbe6e035a7fb16b4b53815b50d2a1f7238c (commit)
Summary of changes:
src/RtpStateReplicatorListener.cpp | 72 +++++++++++++++++++++---------------
1 files changed, 42 insertions(+), 30 deletions(-)
- Log -----------------------------------------------------------------
commit 5a66fe64bbaf6449dad3c5966275c4e3b58c2c1c
Author: Joshua Colp <jcolp at digium.com>
Date: Fri Feb 4 07:52:56 2011 -0400
Add missing visitor code in the listener.
diff --git a/src/RtpStateReplicatorListener.cpp b/src/RtpStateReplicatorListener.cpp
index d7b0f8d..35f490d 100644
--- a/src/RtpStateReplicatorListener.cpp
+++ b/src/RtpStateReplicatorListener.cpp
@@ -30,6 +30,7 @@
#include "RTPSink.h"
#include "RTPSource.h"
+using namespace std;
using namespace AsteriskSCF::Media::RTP::V1;
class RtpStateReplicatorItem
@@ -67,29 +68,34 @@ public:
}
void setStateNoticeImpl(const RtpStateItemSeq& items)
{
- for (RtpStateItemSeq::const_iterator item = items.begin(); item != items.end(); ++item)
- {
- std::map<std::string, boost::shared_ptr<RtpStateReplicatorItem> >::iterator i = mStateItems.find((*item)->mSessionId);
- RtpGeneralStateItemPtr general;
- RtpSessionStateItemPtr session;
- RtpStreamSinkStateItemPtr sink;
- RtpStreamSourceStateItemPtr source;
- boost::shared_ptr<RtpStateReplicatorItem> localitem;
-
- if ((general = RtpGeneralStateItemPtr::dynamicCast((*item))))
+ class visitor : public AsteriskSCF::Media::RTP::V1::RtpStateItemVisitor
+ {
+ public:
+ visitor(RtpStateReplicatorListenerImpl *impl) : impl(impl)
{
- mGeneralState->mServiceManagement = general->mServiceManagement;
}
- else if ((session = RtpSessionStateItemPtr::dynamicCast((*item))))
+
+ private:
+ RtpStateReplicatorListenerImpl *impl;
+
+ void visitGeneral(const RtpGeneralStateItemPtr &item, const Ice::Current &)
{
- if (i == mStateItems.end())
+ impl->mGeneralState->mServiceManagement = item->mServiceManagement;
+ }
+
+ void visitSession(const RtpSessionStateItemPtr &item, const Ice::Current &)
+ {
+ map<string, boost::shared_ptr<RtpStateReplicatorItem> >::iterator i = impl->mStateItems.find(item->mSessionId);
+ boost::shared_ptr<RtpStateReplicatorItem> localitem;
+
+ if (i == impl->mStateItems.end())
{
boost::shared_ptr<RtpStateReplicatorItem> newitem(new RtpStateReplicatorItem());
localitem = newitem;
- mStateItems.insert(std::make_pair((*item)->mSessionId, newitem));
+ impl->mStateItems.insert(make_pair<string, boost::shared_ptr<RtpStateReplicatorItem> >(item->mSessionId, newitem));
- RTPSessionImplPtr localSession = new RTPSessionImpl(mAdapter, mPoolFactory, session->mSessionIdentity, session->mSinkIdentity,
- session->mSourceIdentity, session->mPort, session->mFormats);
+ RTPSessionImplPtr localSession = new RTPSessionImpl(impl->mAdapter, impl->mPoolFactory, item->mSessionIdentity, item->mSinkIdentity,
+ item->mSourceIdentity, item->mPort, item->mFormats);
localitem->setSession(localSession);
}
else
@@ -97,31 +103,37 @@ public:
localitem = i->second;
}
- localitem->getSession()->associatePayloads(session->mPayloadstoFormats, Ice::Current());
+ localitem->getSession()->associatePayloads(item->mPayloadstoFormats, Ice::Current());
}
- else if ((sink = RtpStreamSinkStateItemPtr::dynamicCast((*item))))
+
+ void visitStreamSink(const RtpStreamSinkStateItemPtr &item, const Ice::Current &)
{
- if (i == mStateItems.end())
+ map<string, boost::shared_ptr<RtpStateReplicatorItem> >::iterator i = impl->mStateItems.find(item->mSessionId);
+ if (i != impl->mStateItems.end())
{
- continue;
+ i->second->getSession()->getSink()->setSource(item->mSource, Ice::Current());
+ i->second->getSession()->getSink()->setRemoteDetails(item->mRemoteAddress, item->mRemotePort, Ice::Current());
}
-
- i->second->getSession()->getSink()->setSource(sink->mSource, Ice::Current());
- i->second->getSession()->getSink()->setRemoteDetails(sink->mRemoteAddress, sink->mRemotePort, Ice::Current());
}
- else if ((source = RtpStreamSourceStateItemPtr::dynamicCast((*item))))
+
+ void visitStreamSource(const RtpStreamSourceStateItemPtr &item, const Ice::Current &)
{
- if (i == mStateItems.end())
+ map<string, boost::shared_ptr<RtpStateReplicatorItem> >::iterator i = impl->mStateItems.find(item->mSessionId);
+ if (i != impl->mStateItems.end())
{
- continue;
+ i->second->getSession()->getSource()->setSink(item->mSink, Ice::Current());
}
-
- i->second->getSession()->getSource()->setSink(source->mSink, Ice::Current());
}
+ } v(this);
+
+ for (RtpStateItemSeq::const_iterator item = items.begin(); item != items.end(); ++item)
+ {
+ (*item)->visit(&v);
}
}
- std::string mId;
- std::map<std::string, boost::shared_ptr<RtpStateReplicatorItem> > mStateItems;
+
+ string mId;
+ map<string, boost::shared_ptr<RtpStateReplicatorItem> > mStateItems;
Ice::ObjectAdapterPtr mAdapter;
pj_pool_factory *mPoolFactory;
RtpGeneralStateItemPtr mGeneralState;
-----------------------------------------------------------------------
--
asterisk-scf/release/media_rtp_pjmedia.git
More information about the asterisk-scf-commits
mailing list