[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
Thu Oct 6 14:51:17 CDT 2011


branch "mediamixer" has been updated
       via  0dd0d763913216b085c846c8e6a7e12eea7a4132 (commit)
      from  eea7583e664c35e6d36e8594e8825790d9880261 (commit)

Summary of changes:
 src/MediaMixer.cpp |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)


- Log -----------------------------------------------------------------
commit 0dd0d763913216b085c846c8e6a7e12eea7a4132
Author: Joshua Colp <jcolp at digium.com>
Date:   Thu Oct 6 16:49:43 2011 -0300

    Determine the time spent mixing and adjust accordingly to try to get the TimerTask to time us right.

diff --git a/src/MediaMixer.cpp b/src/MediaMixer.cpp
index e33c2df..a9be6c9 100755
--- a/src/MediaMixer.cpp
+++ b/src/MediaMixer.cpp
@@ -386,7 +386,7 @@ static short saturatedSignedLinearSubtract(short input, short value)
 
 MediaMixer::MediaMixer(const Ice::ObjectAdapterPtr& adapter, const FormatPtr& format) : mImpl(new MediaMixerI(adapter, format))
 {
-    mImpl->mTimer->scheduleRepeated(this, IceUtil::Time::milliSeconds(MIXING_INTERVAL));
+    mImpl->mTimer->schedule(this, IceUtil::Time::milliSeconds(MIXING_INTERVAL));
 }
 
 void MediaMixer::createMixing(const Ice::Identity& sinkId, AsteriskSCF::Media::V1::StreamSinkPrx& mixerSink,
@@ -430,6 +430,8 @@ void MediaMixer::createMixing(const Ice::Identity& sinkId, AsteriskSCF::Media::V
 
 void MediaMixer::runTimerTask()
 {
+    IceUtil::Time start = IceUtil::Time::now();
+
     std::vector<MediaMixerSinkPtr> sinks;
 
     {
@@ -514,6 +516,9 @@ void MediaMixer::runTimerTask()
                                                                             &WriteCallback::failureCB));
         }
     }
+
+    IceUtil::Time elapsed = IceUtil::Time::now() - start;
+    mImpl->mTimer->schedule(this, IceUtil::Time::milliSeconds(MIXING_INTERVAL - elapsed.toMilliSeconds()));
 }
 
 void MediaMixer::removeSource(const MediaMixerSourcePtr& source, const StreamSourcePrx& proxy)

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


-- 
asterisk-scf/integration/bridging.git



More information about the asterisk-scf-commits mailing list