mmserv/tms/tmscallserver/src/tmsipcalluplinkds.cpp
branchRCL_3
changeset 40 60e492b28869
parent 17 3570217d8c21
child 45 095bea5f582e
--- a/mmserv/tms/tmscallserver/src/tmsipcalluplinkds.cpp	Mon Jun 21 16:15:34 2010 +0300
+++ b/mmserv/tms/tmscallserver/src/tmsipcalluplinkds.cpp	Thu Jul 15 19:13:36 2010 +0300
@@ -31,7 +31,8 @@
 // Standard Constructor
 // -----------------------------------------------------------------------------
 //
-TMSIPUplink::TMSIPUplink()
+TMSIPUplink::TMSIPUplink(TMSIPDevSoundObserver& observer) :
+    TMSIPCallStreamBase(observer)
     {
     }
 
@@ -59,10 +60,10 @@
 // Symbian two-phase constructor
 // -----------------------------------------------------------------------------
 //
-TMSIPUplink* TMSIPUplink::NewL(const guint32 codecID,
-        const TMMFPrioritySettings priority)
+TMSIPUplink* TMSIPUplink::NewL(TMSIPDevSoundObserver& observer,
+        const guint32 codecID, const TMMFPrioritySettings priority)
     {
-    TMSIPUplink* self = new (ELeave) TMSIPUplink();
+    TMSIPUplink* self = new (ELeave) TMSIPUplink(observer);
     CleanupStack::PushL(self);
     self->ConstructL(codecID, priority);
     CleanupStack::Pop(self);
@@ -78,14 +79,12 @@
         const TMMFPrioritySettings priority)
     {
     TRACE_PRN_FN_ENT;
-
     iCodecID = codecID;
     iPriority = priority;
 
     // Client must set these before querying!
     iG711EncodeMode = TMS_G711_CODEC_MODE_ALAW;
     iILBCEncodeMode = TMS_ILBC_CODEC_MODE_20MS_FRAME;
-
     TRAPD(err, InitDevSoundL(EMMFStateRecording, priority));
     if (err != TMS_RESULT_SUCCESS)
         {
@@ -93,7 +92,6 @@
         }
 
     iMaxBufLen = ConfigureMedia(iCodecID);
-
     TRACE_PRN_FN_EXT;
     }
 
@@ -116,17 +114,10 @@
 
         if (err != TMS_RESULT_SUCCESS)
             {
-            //TODO: Notify main thread
             iStatus = EReady;
+            iObserver.UplinkStarted(err);
             }
-#ifdef _DEBUG
-        else
-            {
-            iSamplesRecCount = 0;
-            }
-#endif
         }
-
     TRACE_PRN_FN_EXT;
     }
 
@@ -144,10 +135,6 @@
         iDevSound->Stop();
         iStatus = EReady;
         }
-    else
-        {
-        //TODO: Notify main thread
-        }
     TRACE_PRN_FN_EXT;
     }
 
@@ -158,9 +145,8 @@
 //
 void TMSIPUplink::BufferToBeEmptied(CMMFBuffer* aBuffer)
     {
-    iDevSoundBufPtr = static_cast<CMMFDataBuffer*>(aBuffer);
+    iDevSoundBufPtr = static_cast<CMMFDataBuffer*> (aBuffer);
     TDes8& data = iDevSoundBufPtr->Data();
-
     iBufLen = iDevSoundBufPtr->BufferSize();
     TRACE_PRN_N1(_L("TMS->UPL: BTBE->LEN [%d]"), iBufLen);
 
@@ -353,7 +339,6 @@
             status = TMS_RESULT_ILLEGAL_OPERATION;
             }
         }
-
     return status;
     }
 
@@ -386,7 +371,6 @@
                 }
             }
         }
-
     TRACE_PRN_IF_ERR(err);
     return err;
     }
@@ -433,7 +417,6 @@
                 }
             }
         }
-
     TRACE_PRN_IF_ERR(err);
     return err;
     }
@@ -465,7 +448,6 @@
         {
         err = iSpeechEncoderConfig->GetSupportedBitrates(bitrates);
         }
-
     TRACE_PRN_IF_ERR(err);
     return err;
     }
@@ -484,7 +466,6 @@
         err = iSpeechEncoderConfig->SetBitrate(bitrate);
         TRACE_PRN_N1(_L("TMS->UPL: SetBitrate [%d]"), bitrate);
         }
-
     TRACE_PRN_IF_ERR(err);
     return err;
     }
@@ -503,7 +484,6 @@
         err = iSpeechEncoderConfig->GetBitrate(bitrate);
         TRACE_PRN_N1(_L("TMS->UPL: GetBitrate [%d]"), bitrate);
         }
-
     TRACE_PRN_IF_ERR(err);
     return err;
     }
@@ -634,36 +614,30 @@
     {
     TRACE_PRN_FN_ENT;
 
-    gint err = aError;
+    gint status = aError;
 
-    if (err == TMS_RESULT_SUCCESS && iDevSound)
+    if (status == TMS_RESULT_SUCCESS && iDevSound)
         {
         TMMFCapabilities conf;
         conf = iDevSound->Config();
         conf.iRate = EMMFSampleRate8000Hz;
         conf.iChannels = EMMFMono;
-        TRAP(err, iDevSound->SetConfigL(conf));
-        if (err == TMS_RESULT_SUCCESS)
+        TRAP(status, iDevSound->SetConfigL(conf));
+        if (status == TMS_RESULT_SUCCESS)
             {
             // We are ready to stream even in case of CI setting failure
             iStatus = EReady;
             iMaxGain = iDevSound->MaxGain();
             }
 
-        // Init Custom Interface API to the Encoder
-        err = SetCodecCi();
-        if (err != TMS_RESULT_SUCCESS)
-            {
-            // DEBUG only
-            // Can ignore error - although encoder is not fully configured but
-            // it can still run in the default mode.
-            TRACE_PRN_IF_ERR(err);
-            }
+        // Init Custom Interface API to the Encoder. Any return error can
+        // be ignored as codec can still run in the default mode even if not
+        // fully configured.
+        SetCodecCi();
         }
 
-    // TODO: Notify client
-
-    TRACE_PRN_IF_ERR(err);
+    iObserver.UplinkInitCompleted(status);
+    TRACE_PRN_IF_ERR(status);
     TRACE_PRN_FN_EXT;
     }
 
@@ -674,16 +648,11 @@
 // The state of recorder is rolled back to EReady.
 // -----------------------------------------------------------------------------
 //
-void TMSIPUplink::RecordError(TInt /*aError*/)
+void TMSIPUplink::RecordError(TInt aError)
     {
-    //TRACE_PRN_IF_ERR(aError);
-
-#ifdef _DEBUG
-    iSamplesRecCount = 0;
-#endif
     iStatus = EReady;
-
-    // TODO: Notify client
+    iObserver.UplinkStarted(aError);
+    TRACE_PRN_IF_ERR(aError);
     }
 
 // End of file