|
1 /* |
|
2 * Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). |
|
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: RTP Keepalive mechanism |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <e32math.h> |
|
23 #include "mccrtpkeepalivecontainer.h" |
|
24 #include "mccrtpkeepalive.h" |
|
25 #include "mccdef.h" |
|
26 #include "mccinternaldef.h" |
|
27 #include "mccsubcontrollerlogs.h" |
|
28 #include "mccinternalevents.h" |
|
29 #include "mccrtpinterface.h" |
|
30 |
|
31 |
|
32 // EXTERNAL DATA STRUCTURES |
|
33 |
|
34 // EXTERNAL FUNCTION PROTOTYPES |
|
35 |
|
36 // CONSTANTS |
|
37 |
|
38 // MACROS |
|
39 |
|
40 // LOCAL CONSTANTS AND MACROS |
|
41 |
|
42 // MODULE DATA STRUCTURES |
|
43 |
|
44 // LOCAL FUNCTION PROTOTYPES |
|
45 |
|
46 // FORWARD DECLARATIONS |
|
47 |
|
48 |
|
49 // ============================= LOCAL FUNCTIONS ============================= |
|
50 |
|
51 |
|
52 // ============================ MEMBER FUNCTIONS ============================= |
|
53 |
|
54 // --------------------------------------------------------------------------- |
|
55 // CMccRtpKeepaliveContainer::NewL |
|
56 // --------------------------------------------------------------------------- |
|
57 // |
|
58 CMccRtpKeepaliveContainer* CMccRtpKeepaliveContainer::NewL( |
|
59 MAsyncEventHandler& aEventHandler, |
|
60 CRtpAPI& aRtpAPI, |
|
61 TRtpId aRtpSessionId ) |
|
62 { |
|
63 CMccRtpKeepaliveContainer* self = |
|
64 new ( ELeave ) CMccRtpKeepaliveContainer( aEventHandler, |
|
65 aRtpAPI, |
|
66 aRtpSessionId ); |
|
67 |
|
68 return self; |
|
69 } |
|
70 |
|
71 // --------------------------------------------------------------------------- |
|
72 // CMccRtpKeepaliveContainer::~CMccRtpKeepaliveContainer |
|
73 // --------------------------------------------------------------------------- |
|
74 // |
|
75 CMccRtpKeepaliveContainer::~CMccRtpKeepaliveContainer() |
|
76 { |
|
77 iKeepaliveHandlers.ResetAndDestroy(); |
|
78 } |
|
79 |
|
80 // --------------------------------------------------------------------------- |
|
81 // CMccRtpKeepaliveContainer::StartKeepaliveL |
|
82 // --------------------------------------------------------------------------- |
|
83 // |
|
84 void CMccRtpKeepaliveContainer::StartKeepaliveL( |
|
85 MMccRtpInterface& /*aUser*/, |
|
86 TMccCodecInfo& /*aCodecInfo*/, |
|
87 CMccRtpMediaClock& /*aRtpMediaClock*/ ) |
|
88 { |
|
89 __SUBCONTROLLER( "CMccRtpKeepalive::StartKeepaliveL()" ) |
|
90 |
|
91 iStopped = EFalse; |
|
92 |
|
93 /* |
|
94 if ( aCodecInfo.iKeepaliveInterval > 0 && !iStopped ) |
|
95 { |
|
96 __SUBCONTROLLER( "CMccRtpKeepalive::StartKeepaliveL(), interval defined" ) |
|
97 |
|
98 CMccRtpKeepalive* handler = FindKeepaliveHandler( aCodecInfo.iKeepalivePT ); |
|
99 if ( !handler ) |
|
100 { |
|
101 handler = CMccRtpKeepalive::NewL( iEventHandler, |
|
102 iRtpAPI, |
|
103 iRtpSessionId, |
|
104 aCodecInfo.iKeepalivePT, |
|
105 aCodecInfo.iKeepaliveInterval, |
|
106 aCodecInfo.iKeepaliveData, |
|
107 iRemoteAddressSet ); |
|
108 CleanupStack::PushL( handler ); |
|
109 iKeepaliveHandlers.AppendL( handler ); |
|
110 CleanupStack::Pop( handler ); |
|
111 } |
|
112 handler->StartKeepaliveL( aUser ); |
|
113 } |
|
114 */ |
|
115 } |
|
116 |
|
117 // --------------------------------------------------------------------------- |
|
118 // CMccRtpKeepaliveContainer::StopKeepalive |
|
119 // --------------------------------------------------------------------------- |
|
120 // |
|
121 TInt CMccRtpKeepaliveContainer::StopKeepalive( |
|
122 MMccRtpInterface& /*aUser*/, |
|
123 const TMccCodecInfo& /*aCodecInfo*/ ) |
|
124 { |
|
125 |
|
126 iStopped = ETrue; |
|
127 |
|
128 /* |
|
129 TInt err( KErrNotFound ); |
|
130 CMccRtpKeepalive* handler = FindKeepaliveHandler( aCodecInfo.iKeepalivePT ); |
|
131 if ( handler ) |
|
132 { |
|
133 TInt refCount( 0 ); |
|
134 err = handler->StopKeepalive( aUser, refCount ); |
|
135 if ( !refCount ) |
|
136 { |
|
137 // No more users, can be removed |
|
138 TInt index = iKeepaliveHandlers.Find( handler ); |
|
139 if ( index != KErrNotFound ) |
|
140 { |
|
141 delete iKeepaliveHandlers[ index ]; |
|
142 iKeepaliveHandlers.Remove( index ); |
|
143 } |
|
144 } |
|
145 } |
|
146 return err; |
|
147 */ |
|
148 return KErrNone; |
|
149 } |
|
150 |
|
151 // --------------------------------------------------------------------------- |
|
152 // CMccRtpKeepaliveContainer::ResetKeepAliveTimer |
|
153 // --------------------------------------------------------------------------- |
|
154 // |
|
155 void CMccRtpKeepaliveContainer::ResetKeepaliveTimer() |
|
156 { |
|
157 /* TInt count = iKeepaliveHandlers.Count(); |
|
158 for ( TInt i = 0; i < count; i++ ) |
|
159 { |
|
160 iKeepaliveHandlers[ i ]->ResetKeepaliveTimer(); |
|
161 }*/ |
|
162 } |
|
163 |
|
164 // --------------------------------------------------------------------------- |
|
165 // CMccRtpKeepaliveContainer::UpdateParamsL |
|
166 // --------------------------------------------------------------------------- |
|
167 // |
|
168 void CMccRtpKeepaliveContainer::UpdateParamsL( MMccRtpInterface& aUser, |
|
169 const TMccCodecInfo& aCodecInfo ) |
|
170 { |
|
171 } |
|
172 |
|
173 // --------------------------------------------------------------------------- |
|
174 // CMccRtpKeepaliveContainer::StopAll |
|
175 // --------------------------------------------------------------------------- |
|
176 // |
|
177 void CMccRtpKeepaliveContainer::StopAll() |
|
178 { |
|
179 iKeepaliveHandlers.ResetAndDestroy(); |
|
180 iStopped = ETrue; |
|
181 } |
|
182 |
|
183 // --------------------------------------------------------------------------- |
|
184 // CMccRtpKeepaliveContainer::RemoteAddressSet |
|
185 // --------------------------------------------------------------------------- |
|
186 // |
|
187 TInt CMccRtpKeepaliveContainer::RemoteAddressSet() |
|
188 { |
|
189 /*TInt err( KErrNotReady ); |
|
190 iRemoteAddressSet = ETrue; |
|
191 if ( !iStopped ) |
|
192 { |
|
193 err = KErrNone; |
|
194 for ( TInt i = 0; i < iKeepaliveHandlers.Count(); i++ ) |
|
195 { |
|
196 err |= iKeepaliveHandlers[ i ]->RemoteAddressSet(); |
|
197 } |
|
198 } |
|
199 return err;*/ |
|
200 } |
|
201 |
|
202 // --------------------------------------------------------------------------- |
|
203 // CMccRtpKeepaliveContainer::FindKeepaliveHandler |
|
204 // --------------------------------------------------------------------------- |
|
205 // |
|
206 CMccRtpKeepalive* CMccRtpKeepaliveContainer::FindKeepaliveHandler( |
|
207 TUint8 aKeepAlivePT, MMccRtpInterface& aUser ) |
|
208 { |
|
209 /*CMccRtpKeepalive* handler = NULL; |
|
210 for ( TInt i = 0; i < iKeepaliveHandlers.Count() && !handler; i++ ) |
|
211 { |
|
212 if ( aUser.IsSink() ) |
|
213 { |
|
214 if ( iKeepaliveHandlers[ i ]->StreamId() == aUser.RtpStreamId() ) |
|
215 { |
|
216 handler = iKeepaliveHandlers[ i ]; |
|
217 } |
|
218 } |
|
219 else |
|
220 { |
|
221 if ( iKeepaliveHandlers[ i ]->PayloadType() == aKeepAlivePayloadType ) |
|
222 { |
|
223 handler = iKeepaliveHandlers[ i ]; |
|
224 } |
|
225 } |
|
226 } |
|
227 return handler;*/ |
|
228 } |
|
229 |
|
230 // --------------------------------------------------------------------------- |
|
231 // CMccRtpKeepaliveContainer::CMccRtpKeepaliveContainer |
|
232 // --------------------------------------------------------------------------- |
|
233 // |
|
234 CMccRtpKeepaliveContainer::CMccRtpKeepaliveContainer( |
|
235 MAsyncEventHandler& aEventHandler, |
|
236 CRtpAPI& aRtpAPI, |
|
237 TRtpId aRtpSessionId ) : |
|
238 iEventHandler( aEventHandler ), |
|
239 iRtpAPI( aRtpAPI ), |
|
240 iRtpSessionId( aRtpSessionId ) |
|
241 { |
|
242 } |
|
243 |
|
244 |
|
245 // ========================== OTHER EXPORTED FUNCTIONS ======================= |
|
246 |
|
247 // End of File |