mmserv/tms/tmsimpl/src/tmsstreambodyimpl.cpp
changeset 53 eabc8c503852
parent 38 9e9fc5ab059f
--- a/mmserv/tms/tmsimpl/src/tmsstreambodyimpl.cpp	Fri Sep 03 19:34:12 2010 -0500
+++ b/mmserv/tms/tmsimpl/src/tmsstreambodyimpl.cpp	Tue Sep 21 11:38:43 2010 -0500
@@ -29,6 +29,10 @@
 #include "tmsmembuffer.h"
 #include "tmsclientsourceimpl.h"
 #include "tmsclientsinkimpl.h"
+#include "tmsmodemsourceimpl.h"
+#include "tmsmodemsinkimpl.h"
+#include "tmsmicsourceimpl.h"
+#include "tmsspeakersinkimpl.h"
 #include "tmsvolumeeffectimpl.h"
 #include "tmsgaineffectimpl.h"
 #include "tmsg711formatimpl.h"
@@ -60,6 +64,7 @@
         {
         iMsgQHandler->Cancel();
         }
+    iMsgQHandler->RemoveObserver(*this);
     delete iMsgQHandler;
     if (iMsgQueue.Handle() > 0)
         {
@@ -424,57 +429,6 @@
             }
         }
 
-    if (iContext.StreamType == TMS_STREAM_UPLINK)
-        {
-        if (iSink)
-            {
-            TMSSinkType sinkType;
-            iSink->GetType(sinkType);
-            switch (sinkType)
-                {
-                case TMS_SINK_CLIENT:
-                    static_cast<TMSClientSinkImpl*> (iSink)->SetProxy(&iContext,
-                            iMsgQHandler);
-                    break;
-                case TMS_SINK_MODEM:
-                case TMS_SINK_SPEAKER:
-                    break;
-                default:
-                    ret = TMS_RESULT_INVALID_ARGUMENT;
-                    break;
-                }
-            }
-        else
-            {
-            ret = TMS_RESULT_UNINITIALIZED_OBJECT;
-            }
-        }
-    else if (iContext.StreamType == TMS_STREAM_DOWNLINK)
-        {
-        if (iSource)
-            {
-            TMSSourceType sourceType;
-            iSource->GetType(sourceType);
-            switch (sourceType)
-                {
-                case TMS_SOURCE_CLIENT:
-                    static_cast<TMSClientSourceImpl*> (iSource)->SetProxy(
-                            &iContext, iMsgQHandler);
-                    break;
-                case TMS_SOURCE_MODEM:
-                case TMS_SOURCE_MIC:
-                    break;
-                default:
-                    ret = TMS_RESULT_INVALID_ARGUMENT;
-                    break;
-                }
-            }
-        else
-            {
-            ret = TMS_RESULT_UNINITIALIZED_OBJECT;
-            }
-        }
-
     return ret;
     }
 
@@ -549,6 +503,8 @@
                         iContext.StreamType == TMS_STREAM_DOWNLINK)
                     {
                     iSource = source;
+                    static_cast<TMSClientSourceImpl*> (iSource)->SetProxy(
+                             &iContext, iMsgQHandler);
                     ret = TMS_RESULT_SUCCESS;
                     }
                 }
@@ -558,6 +514,8 @@
                 if (iContext.StreamType == TMS_STREAM_UPLINK)
                     {
                     iSource = source;
+                    static_cast<TMSMicSourceImpl*> (iSource)->SetProxy(
+                             iContext.CallProxy, iMsgQHandler);
                     ret = TMS_RESULT_SUCCESS;
                     }
                 }
@@ -568,6 +526,8 @@
                         iContext.StreamType == TMS_STREAM_DOWNLINK)
                     {
                     iSource = source;
+                    static_cast<TMSModemSourceImpl*> (iSource)->SetProxy(
+                              iContext.CallProxy, iMsgQHandler);
                     ret = TMS_RESULT_SUCCESS;
                     }
                 break;
@@ -597,6 +557,8 @@
                         iContext.StreamType == TMS_STREAM_UPLINK)
                     {
                     iSink = sink;
+                    static_cast<TMSClientSinkImpl*> (iSink)->SetProxy(&iContext,
+                            iMsgQHandler);
                     ret = TMS_RESULT_SUCCESS;
                     }
                 }
@@ -606,6 +568,8 @@
                 if (iContext.StreamType == TMS_STREAM_DOWNLINK)
                     {
                     iSink = sink;
+                    static_cast<TMSSpeakerSinkImpl*> (iSink)->SetProxy(iContext.CallProxy,
+                             iMsgQHandler);
                     ret = TMS_RESULT_SUCCESS;
                     }
                 }
@@ -616,10 +580,12 @@
                         iContext.StreamType == TMS_STREAM_UPLINK)
                     {
                     iSink = sink;
+                    static_cast<TMSModemSinkImpl*> (iSink)->SetProxy(iContext.CallProxy,
+                             iMsgQHandler);
                     ret = TMS_RESULT_SUCCESS;
                     }
+                }
                 break;
-                }
             default:
                 break;
             }