[asterisk-scf-commits] asterisk-scf/release/bridging.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Fri May 20 15:17:32 CDT 2011


branch "master" has been updated
       via  bf3094a3314b4cc4bedeb59df947080b744df9ed (commit)
      from  8cd95c68bbaf4a0fe63b1b4d91587ae4aec1aa36 (commit)

Summary of changes:
 src/MediaSplicer.cpp  |   44 ++++++++++++++++++++++++++++----------------
 test/TestBridging.cpp |   16 ++++++++--------
 2 files changed, 36 insertions(+), 24 deletions(-)


- Log -----------------------------------------------------------------
commit bf3094a3314b4cc4bedeb59df947080b744df9ed
Author: Brent Eagles <beagles at digium.com>
Date:   Fri May 20 17:27:11 2011 -0230

    Modified test suite so it should allow connect indications to process properly.
    Previously it had been forcing both sessions to send a Connected indication
    into the bridge, rendering them both "fully connected" in the bridge's view and
    frequently preventing the corresponding "indicate(Connected)" from being called
    on the peer.
    
    Also added some missing locking in the splicer class.

diff --git a/src/MediaSplicer.cpp b/src/MediaSplicer.cpp
index deac0b7..4bdcdae 100755
--- a/src/MediaSplicer.cpp
+++ b/src/MediaSplicer.cpp
@@ -457,6 +457,7 @@ public:
             data->peer->update(connector, data->outgoingPairings, data->incomingPairings);
         }
         connector->initialUpdate();
+        boost::unique_lock<boost::shared_mutex> lock(mLock);
         mSessions.push_back(MediaSessionStruct(data->mediaSession, connector));
         return connector;
     }
@@ -536,13 +537,16 @@ public:
     {
         vector<StreamSourceSeq> allSources;
 
-        //
-        // TODO: This is not really correct at all. When the bridge implements conferencing chances, everything
-        // will come into a mix and go out.
-        //
-        for (MediaSessions::iterator i = mSessions.begin(); i != mSessions.end(); ++i)
         {
-            allSources.push_back(i->mediaSession->getSources());
+            boost::shared_lock<boost::shared_mutex> lock(mLock);
+            //
+            // TODO: This is not really correct at all. When the bridge implements conferencing chances, everything
+            // will come into a mix and go out.
+            //
+            for (MediaSessions::iterator i = mSessions.begin(); i != mSessions.end(); ++i)
+            {
+                allSources.push_back(i->mediaSession->getSources());
+            }
         }
 
         vector<OutgoingPairing> result;
@@ -577,13 +581,16 @@ public:
     vector<IncomingPairing> findCompatiblePairings(const StreamSourceSeq& sources)
     {
         vector<StreamSinkSeq> allSinks;
-        //
-        // TODO: This is not really correct at all. When the bridge implements conferencing chances, everything
-        // will come into a mix and go out.
-        //
-        for (MediaSessions::iterator i = mSessions.begin(); i != mSessions.end(); ++i)
         {
-            allSinks.push_back(i->mediaSession->getSinks());
+            boost::shared_lock<boost::shared_mutex> lock(mLock);
+            //
+            // TODO: This is not really correct at all. When the bridge implements conferencing chances, everything
+            // will come into a mix and go out.
+            //
+            for (MediaSessions::iterator i = mSessions.begin(); i != mSessions.end(); ++i)
+            {
+                allSinks.push_back(i->mediaSession->getSinks());
+            }
         }
 
         vector<IncomingPairing> result;
@@ -805,9 +812,7 @@ public:
     MakeConnections(const MediaConnectorBuilderPtr& materials) :
         QueuedTask("MakeConnections"),
         mMaterials(materials),
-        mIncomingPairings(mMaterials->incomingPairings.size(), 0),
-        mOutgoingPairings(mMaterials->outgoingPairings.size(), 0),
-        mTotalCount(mIncomingPairings.size() + mOutgoingPairings.size())
+        mCurrentCount(0)
     {
     }
 
@@ -889,6 +894,9 @@ protected:
             //
             return true;
         }
+        mIncomingPairings.resize(mMaterials->incomingPairings.size());
+        mOutgoingPairings.resize(mMaterials->outgoingPairings.size());
+        mTotalCount = (mIncomingPairings.size() + mOutgoingPairings.size());
 
         //
         // If there are lots of pairings, this could result in a "flurry" of AMI requests. I'm not sure that it is
@@ -951,6 +959,10 @@ protected:
         }
         if (done)
         {
+            if (mMaterials->connector)
+            {
+                mMaterials->connector->update(mMaterials->peer, mMaterials->outgoingPairings, mMaterials->incomingPairings);
+            }
             mListener->succeeded();
         }
     }
@@ -976,7 +988,7 @@ private:
     Ice::IntSeq mIncomingPairings;
     Ice::IntSeq mOutgoingPairings;
     size_t mCurrentCount;
-    const size_t mTotalCount;
+    size_t mTotalCount;
 };
 
 //
diff --git a/test/TestBridging.cpp b/test/TestBridging.cpp
index b5546db..a2ad429 100644
--- a/test/TestBridging.cpp
+++ b/test/TestBridging.cpp
@@ -402,12 +402,14 @@ public:
                 BOOST_CHECK(!find(log, "start"));
 
                 a->start();
-                b->start();
 
                 channel.commands()->getlog(idA, log);
                 BOOST_CHECK(find(log, "start"));
+
+                IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(2));
                 channel.commands()->getlog(idB, log);
-                BOOST_CHECK(find(log, "start"));
+                dumplog(log);
+                BOOST_CHECK(find(log, "Connect"));
 
                 //
                 // Should result in a media hookup!
@@ -498,11 +500,10 @@ public:
                 channel.commands()->getlog(idB, log);
                 BOOST_CHECK(!find(log, "start"));
 
-                a->start();
                 b->start();
-
+                IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(2));
                 channel.commands()->getlog(idA, log);
-                BOOST_CHECK(find(log, "start"));
+                BOOST_CHECK(find(log, "Connect"));
                 channel.commands()->getlog(idB, log);
                 BOOST_CHECK(find(log, "start"));
 
@@ -597,11 +598,10 @@ public:
                 channel.commands()->getlog(idB, log);
                 BOOST_CHECK(!find(log, "start"));
 
-                a->start();
                 b->start();
-
+                IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(2));
                 channel.commands()->getlog(idA, log);
-                BOOST_CHECK(find(log, "start"));
+                BOOST_CHECK(find(log, "Connect"));
                 channel.commands()->getlog(idB, log);
                 BOOST_CHECK(find(log, "start"));
 

-----------------------------------------------------------------------


-- 
asterisk-scf/release/bridging.git



More information about the asterisk-scf-commits mailing list