author | vnuitven <> |
Mon, 06 Sep 2010 18:50:40 +0530 | |
branch | rcs |
changeset 50 | 1d8943dd8be6 |
parent 49 | 64c62431ac08 |
permissions | -rw-r--r-- |
49 | 1 |
/* |
50
1d8943dd8be6
changed copy right year to 2010 for all newly added files
vnuitven <>
parents:
49
diff
changeset
|
2 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
49 | 3 |
* All rights reserved. |
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: Provides a comfort noise generator class |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
// INCLUDE FILES |
|
20 |
#include "mccmsrpdatasender.h" |
|
21 |
#include "mccmsrpsourcesinklogs.h" |
|
22 |
||
23 |
||
24 |
// ============================ MEMBER FUNCTIONS =============================== |
|
25 |
||
26 |
// ----------------------------------------------------------------------------- |
|
27 |
// CMccMsrpDataSender::CMccMsrpDataSender |
|
28 |
// ----------------------------------------------------------------------------- |
|
29 |
// |
|
30 |
CMccMsrpDataSender::CMccMsrpDataSender( ) |
|
31 |
: CActive( EPriorityStandard ) |
|
32 |
{ |
|
33 |
CActiveScheduler::Add(this); |
|
34 |
} |
|
35 |
||
36 |
// ----------------------------------------------------------------------------- |
|
37 |
// CMccMsrpDataSender::ConstructL |
|
38 |
// ----------------------------------------------------------------------------- |
|
39 |
// |
|
40 |
void CMccMsrpDataSender::ConstructL() |
|
41 |
{ |
|
42 |
iTimeoutTimer = CMccTimerManager::NewL(); |
|
43 |
} |
|
44 |
||
45 |
// ----------------------------------------------------------------------------- |
|
46 |
// CMccMsrpDataSender::NewL |
|
47 |
// ----------------------------------------------------------------------------- |
|
48 |
// |
|
49 |
CMccMsrpDataSender* CMccMsrpDataSender::NewL( ) |
|
50 |
{ |
|
51 |
CMccMsrpDataSender* self = |
|
52 |
new ( ELeave ) CMccMsrpDataSender(); |
|
53 |
CleanupStack::PushL( self ); |
|
54 |
self->ConstructL(); |
|
55 |
CleanupStack::Pop( self ); |
|
56 |
return self; |
|
57 |
} |
|
58 |
||
59 |
// ----------------------------------------------------------------------------- |
|
60 |
// CMccMsrpDataSender::Send |
|
61 |
// ----------------------------------------------------------------------------- |
|
62 |
// |
|
63 |
void CMccMsrpDataSender::SendL( const TDesC8& aData, CMSRPSession* aMsrpSession ) |
|
64 |
{ |
|
65 |
__MSRPSOURCESINK_CONTROLL( "CMccMsrpDataSender::Send, Entry" ) |
|
66 |
__ASSERT_ALWAYS( aMsrpSession, User::Leave( KErrArgument ) ); |
|
67 |
||
68 |
if ( !IsActive() ) |
|
69 |
{ |
|
70 |
iBuffer.Copy( aData ); |
|
71 |
SendPacketL(aMsrpSession); |
|
72 |
__MSRPSOURCESINK_CONTROLL( "CMccMsrpDataSender::Send, Exit" ) |
|
73 |
} |
|
74 |
} |
|
75 |
||
76 |
||
77 |
// ----------------------------------------------------------------------------- |
|
78 |
// CMccRtpSender::SendPacketL |
|
79 |
// ----------------------------------------------------------------------------- |
|
80 |
// |
|
81 |
void CMccMsrpDataSender::SendPacketL( CMSRPSession* aMsrpSession ) |
|
82 |
{ |
|
83 |
__MSRPSOURCESINK_CONTROLL( "CMccMsrpDataSender::SendPacketL, entry" ) |
|
84 |
__ASSERT_ALWAYS( aMsrpSession, User::Leave( KErrArgument ) ); |
|
85 |
||
86 |
if ( iBuffer.Size() ) |
|
87 |
{ |
|
88 |
__MSRPSOURCESINK_CONTROLL( "CMccMsrpDataSender::SendBuffer, entry" ) |
|
89 |
HBufC8* messageID = aMsrpSession->SendBuffer(iBuffer, _L8("text/plain")); |
|
90 |
// message Id might be useful for the file sharing use case |
|
91 |
delete messageID; |
|
92 |
} |
|
93 |
||
94 |
iTimeoutTimer->Stop( iTimerId ); |
|
95 |
iTimerId = iTimeoutTimer->StartL( this, iTimeoutTimeMilliseconds ); |
|
96 |
||
97 |
} |
|
98 |
||
99 |
||
100 |
// ----------------------------------------------------------------------------- |
|
101 |
// CMccMsrpDataSender::~CMccMsrpDataSender |
|
102 |
// ----------------------------------------------------------------------------- |
|
103 |
// |
|
104 |
CMccMsrpDataSender::~CMccMsrpDataSender() |
|
105 |
{ |
|
106 |
Cancel(); |
|
107 |
||
108 |
delete iTimeoutTimer; |
|
109 |
iMsgQueue.Close(); |
|
110 |
} |
|
111 |
||
112 |
// ----------------------------------------------------------------------------- |
|
113 |
// CMccMsrpDataSender::DoCancel |
|
114 |
// ----------------------------------------------------------------------------- |
|
115 |
// |
|
116 |
void CMccMsrpDataSender::DoCancel() |
|
117 |
{ |
|
118 |
iMsgQueue.CancelSpaceAvailable(); |
|
119 |
} |
|
120 |
||
121 |
// ----------------------------------------------------------------------------- |
|
122 |
// CMccMsrpDataSender::RunL |
|
123 |
// ----------------------------------------------------------------------------- |
|
124 |
// |
|
125 |
void CMccMsrpDataSender::RunL() |
|
126 |
{ |
|
127 |
iMsgQueue.Send( iBuffer ); |
|
128 |
iBuffer.Zero(); |
|
129 |
} |
|
130 |
||
131 |
// ----------------------------------------------------------------------------- |
|
132 |
// CMccMsrpDataSender::RunError |
|
133 |
// ----------------------------------------------------------------------------- |
|
134 |
// |
|
135 |
TInt CMccMsrpDataSender::RunError(TInt /*aError*/) |
|
136 |
{ |
|
137 |
return KErrNone; |
|
138 |
} |
|
139 |
||
140 |
||
141 |
// ----------------------------------------------------------------------------- |
|
142 |
// CMccRtpSender::InactivityTimeout |
|
143 |
// ----------------------------------------------------------------------------- |
|
144 |
// |
|
145 |
void CMccMsrpDataSender::TimerExpiredL( |
|
146 |
TMccTimerId /*aTimerId*/, TAny* /*aTimerParam*/ ) |
|
147 |
{ |
|
148 |
||
149 |
/* if ( iTimeoutTimeMilliseconds > KMccRtpSendTimeoutLongMillisecs ) |
|
150 |
{ |
|
151 |
// Timeout value is so long that if sending of one rtp packet really |
|
152 |
// took so long, receiver will have big problems and it's better |
|
153 |
// to drop all frames queued in order to avoid delay increase |
|
154 |
// at receiver side. |
|
155 |
Clear(); |
|
156 |
} |
|
157 |
else |
|
158 |
{ |
|
159 |
// Sending timeout, cancel send and discard that packet |
|
160 |
Cancel(); |
|
161 |
||
162 |
// Do also cleanup of related packets as those are useless as this |
|
163 |
// packet is removed because of timeout |
|
164 |
RemovePacket( ETrue ); |
|
165 |
||
166 |
// Send next packet anyway |
|
167 |
TRAPD( err, SendPacketL() ) |
|
168 |
if ( err ) |
|
169 |
{ |
|
170 |
ErrorReport( err ); |
|
171 |
} |
|
172 |
} */ |
|
173 |
||
174 |
} |