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

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Sun Jul 10 09:48:51 CDT 2011


branch "master" has been updated
       via  98f341019000a0985dc88bb8aee3ffa82eff40e1 (commit)
      from  0465d2e48f129e2f6b0e9f512189d94ad9b1304f (commit)

Summary of changes:
 src/MediaEchoThread.cpp |   29 +++++++++++++++++------------
 src/MediaEchoThread.h   |    4 ++--
 src/MediaSession.h      |   23 +++++++++++++++--------
 3 files changed, 34 insertions(+), 22 deletions(-)


- Log -----------------------------------------------------------------
commit 98f341019000a0985dc88bb8aee3ffa82eff40e1
Author: Joshua Colp <jcolp at digium.com>
Date:   Sun Jul 10 11:49:27 2011 -0300

    Merge revised media design implementation.

diff --git a/src/MediaEchoThread.cpp b/src/MediaEchoThread.cpp
index c9eccf1..e4f355c 100644
--- a/src/MediaEchoThread.cpp
+++ b/src/MediaEchoThread.cpp
@@ -30,17 +30,22 @@ void MediaEchoThread::run()
     {
         mMonitor.wait();
 
-        if(!mDone && mFrames.size() > 0 && mSink != 0)
+        if(!mDone && mFrames.size() > 0 && !mSinks.empty())
         {
-            try
-            {
-                mSink->write(mFrames);
-                mFrames.clear();
-            }
-            catch(const Ice::Exception&)
-            {
-                // TODO: log and continue
-            }
+	    for (AsteriskSCF::Media::V1::StreamSinkSeq::const_iterator sink = mSinks.begin();
+		 sink != mSinks.end();
+		 ++sink)
+	    {
+		try
+		{
+		    (*sink)->write(mFrames);
+		}
+		catch(const Ice::Exception&)
+		{
+		    // TODO: log and continue
+		}
+	    }
+	    mFrames.clear();
         }
     }
 }
@@ -62,10 +67,10 @@ void MediaEchoThread::destroy()
     mMonitor.notify();
 }
 
-void MediaEchoThread::setSink(const AsteriskSCF::Media::V1::StreamSinkPrx& prx)
+void MediaEchoThread::setSinks(const AsteriskSCF::Media::V1::StreamSinkSeq& sinks)
 {
     IceUtil::Monitor<IceUtil::Mutex>::Lock lock(mMonitor);
-    mSink = prx;
+    mSinks = sinks;
     if(!mPaused)
     {
         mMonitor.notify();
diff --git a/src/MediaEchoThread.h b/src/MediaEchoThread.h
index e6d0ea5..7badc8f 100644
--- a/src/MediaEchoThread.h
+++ b/src/MediaEchoThread.h
@@ -25,7 +25,7 @@ public:
     void run();
     void pushFrames(const AsteriskSCF::Media::V1::FrameSeq& newFrames);
     void destroy();
-    void setSink(const AsteriskSCF::Media::V1::StreamSinkPrx& prx);
+    void setSinks(const AsteriskSCF::Media::V1::StreamSinkSeq& sinks);
 
     //
     // Use when paused... causes the loop to run once.
@@ -35,7 +35,7 @@ public:
     void resume();
 
 private:
-    AsteriskSCF::Media::V1::StreamSinkPrx mSink;
+    AsteriskSCF::Media::V1::StreamSinkSeq mSinks;
     IceUtil::Monitor<IceUtil::Mutex> mMonitor;
     AsteriskSCF::Media::V1::FrameSeq mFrames;
     bool mDone;
diff --git a/src/MediaSession.h b/src/MediaSession.h
index 511cc22..3978944 100644
--- a/src/MediaSession.h
+++ b/src/MediaSession.h
@@ -69,9 +69,9 @@ public:
         // XXX
     }
 
-    void setRelaySink(const AsteriskSCF::Media::V1::StreamSinkPrx& sink)
+    void setRelaySinks(const AsteriskSCF::Media::V1::StreamSinkSeq& sinks)
     {
-        mThread->setSink(sink);
+        mThread->setSinks(sinks);
     }
 
     void echo()
@@ -110,15 +110,22 @@ public:
     {
     }
 
-    void setSink(const AsteriskSCF::Media::V1::StreamSinkPrx& sink, const Ice::Current&)
+    void addSink(const AsteriskSCF::Media::V1::StreamSinkPrx& sink, const Ice::Current&)
     {
-        mSink = sink;
-        mSinkServant->setRelaySink(mSink);
+	mSinks.push_back(sink);
+	mSinkServant->setRelaySinks(mSinks);
     }
 
-    AsteriskSCF::Media::V1::StreamSinkPrx getSink(const Ice::Current&)
+    void removeSink(const AsteriskSCF::Media::V1::StreamSinkPrx& sink, const Ice::Current&)
     {
-        return mSink;
+        mSinks.erase(std::remove(mSinks.begin(), mSinks.end(),
+                                     sink), mSinks.end());
+	mSinkServant->setRelaySinks(mSinks);
+    }
+
+    AsteriskSCF::Media::V1::StreamSinkSeq getSinks(const Ice::Current&)
+    {
+        return mSinks;
     }
 
     AsteriskSCF::Media::V1::FormatSeq getFormats(const Ice::Current&)
@@ -137,7 +144,7 @@ public:
     }
 
 private:
-    AsteriskSCF::Media::V1::StreamSinkPrx mSink;
+    AsteriskSCF::Media::V1::StreamSinkSeq mSinks;
     AsteriskSCF::Media::V1::FormatSeq mFormats;
     std::string mId;
     SinkIPtr mSinkServant;

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


-- 
asterisk-scf/release/test_channel.git



More information about the asterisk-scf-commits mailing list