|
1 /* |
|
2 * Copyright (c) 2005-2007 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: Capability (answer to OPTIONS) |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include "musavacapability.h" |
|
21 #include "muslogger.h" |
|
22 #include "musavacapabilityexchange.h" |
|
23 #include "musavacapabilitycontext.h" |
|
24 #include "mmusavacapabilityqueryobserver.h" |
|
25 #include "mussettings.h" |
|
26 |
|
27 #include <e32math.h> |
|
28 #include <uri8.h> |
|
29 #include <escapeutils.h> |
|
30 #include <sipservertransaction.h> |
|
31 #include <sipacceptcontactheader.h> |
|
32 #include <sipcontactheader.h> |
|
33 #include <siprequestelements.h> |
|
34 #include <sdpdocument.h> |
|
35 #include <sdpmediafield.h> |
|
36 #include <sdpconnectionfield.h> |
|
37 #include <sdporiginfield.h> |
|
38 #include <sdpfmtattributefield.h> |
|
39 #include <sdpattributefield.h> |
|
40 #include <sdprtpmapvalue.h> |
|
41 #include <sipstrings.h> |
|
42 #include <sdpcodecstringpool.h> |
|
43 #include <sipstrconsts.h> |
|
44 |
|
45 _LIT8(KSessionName, "-"); |
|
46 _LIT8(KOriginFieldUser, "-"); |
|
47 |
|
48 const TInt KMaxNumAsStringSize = 16; |
|
49 |
|
50 // -------------------------------------------------------------------------- |
|
51 // Symbian two-phase constructor |
|
52 // -------------------------------------------------------------------------- |
|
53 // |
|
54 CMusAvaCapability* CMusAvaCapability::NewL( |
|
55 CMusAvaCapabilityExchange& aExchange ) |
|
56 { |
|
57 MUS_LOG( "mus: [MUSAVA] -> CMusAvaCapability::NewL" ) |
|
58 |
|
59 CMusAvaCapability* self = new (ELeave) CMusAvaCapability( aExchange ); |
|
60 CleanupStack::PushL( self ); |
|
61 self->ConstructL(); |
|
62 CleanupStack::Pop( self ); |
|
63 MUS_LOG( "mus: [MUSAVA] <- CMusAvaCapability::NewL" ) |
|
64 |
|
65 return self; |
|
66 } |
|
67 |
|
68 // -------------------------------------------------------------------------- |
|
69 // C++ destructor |
|
70 // -------------------------------------------------------------------------- |
|
71 // |
|
72 CMusAvaCapability::~CMusAvaCapability() |
|
73 { |
|
74 MUS_LOG( |
|
75 "mus: [MUSAVA]: -> CMusAvaCapability::~CMusAvaCapability" ) |
|
76 |
|
77 iFeature.Close(); |
|
78 SIPStrings::Close(); |
|
79 SdpCodecStringPool::Close(); |
|
80 |
|
81 MUS_LOG( |
|
82 "mus: [MUSAVA]: <- CMusAvaCapability::~CMusAvaCapability" ) |
|
83 } |
|
84 |
|
85 |
|
86 // -------------------------------------------------------------------------- |
|
87 // C++ constructor |
|
88 // -------------------------------------------------------------------------- |
|
89 // |
|
90 CMusAvaCapability::CMusAvaCapability( |
|
91 CMusAvaCapabilityExchange& aExchange ) |
|
92 : iExchange( aExchange ), |
|
93 iIsEnabled( ETrue ) |
|
94 { |
|
95 } |
|
96 |
|
97 |
|
98 // -------------------------------------------------------------------------- |
|
99 // Symbian second-phase constructor |
|
100 // -------------------------------------------------------------------------- |
|
101 // |
|
102 void CMusAvaCapability::ConstructL( ) |
|
103 { |
|
104 MUS_LOG( "mus: [MUSAVA]: -> CMusAvaCapability::ConstructL" ) |
|
105 |
|
106 MUS_LOG( "mus: [MUSAVATEST]: SIPStrings::OpenL()" ) |
|
107 TRAP_IGNORE( SIPStrings::OpenL() ) |
|
108 TRAP_IGNORE( SdpCodecStringPool::OpenL() ) |
|
109 |
|
110 MUS_LOG( "mus: [MUSAVATEST]: MusAvaCapabilityContext::SIPStringL( KCapabilitySwisFeature )" ) |
|
111 iFeature = MusAvaCapabilityContext::SIPStringL( KCapabilitySwisFeature ); |
|
112 |
|
113 MUS_LOG( "mus: [MUSAVA]: <- CMusAvaCapability::ConstructL" ) |
|
114 } |
|
115 |
|
116 |
|
117 // -------------------------------------------------------------------------- |
|
118 // CMusAvaCapability::Exchange |
|
119 // -------------------------------------------------------------------------- |
|
120 // |
|
121 CMusAvaCapabilityExchange& CMusAvaCapability::Exchange() const |
|
122 { |
|
123 return iExchange; |
|
124 } |
|
125 |
|
126 |
|
127 // -------------------------------------------------------------------------- |
|
128 // CMusAvaCapability::Feature |
|
129 // -------------------------------------------------------------------------- |
|
130 // |
|
131 const RStringF& CMusAvaCapability::Feature() const |
|
132 { |
|
133 return iFeature; |
|
134 } |
|
135 |
|
136 |
|
137 // -------------------------------------------------------------------------- |
|
138 // CMusAvaCapability::Supports |
|
139 // -------------------------------------------------------------------------- |
|
140 // |
|
141 TBool CMusAvaCapability::Supports( |
|
142 const CSIPAcceptContactHeader& acceptContact ) |
|
143 { |
|
144 return acceptContact.HasParam( Feature() ); |
|
145 } |
|
146 |
|
147 |
|
148 // -------------------------------------------------------------------------- |
|
149 // CMusAvaCapability::Enabled |
|
150 // -------------------------------------------------------------------------- |
|
151 // |
|
152 TBool& CMusAvaCapability::Enabled() |
|
153 { |
|
154 return iIsEnabled; |
|
155 } |
|
156 |
|
157 |
|
158 // -------------------------------------------------------------------------- |
|
159 // CMusAvaCapability::PopulateResponseL |
|
160 // -------------------------------------------------------------------------- |
|
161 // |
|
162 void CMusAvaCapability::PopulateResponseL( |
|
163 CSIPServerTransaction& aQuery, |
|
164 RPointerArray<CSIPHeaderBase>& aResponseHeaders, |
|
165 CSdpDocument& aResponseContent ) |
|
166 |
|
167 { |
|
168 MUS_LOG( "mus: [MUSAVA]: -> CMusAvaCapability::PopulateResponseL" ) |
|
169 |
|
170 AddContactHeaderL( aQuery, aResponseHeaders ); |
|
171 |
|
172 DoPopulateResponseL( aResponseContent ); |
|
173 |
|
174 MUS_LOG( "mus: [MUSAVA]: <- CMusAvaCapability::PopulateResponseL" ) |
|
175 } |
|
176 |
|
177 // -------------------------------------------------------------------------- |
|
178 // CMusAvaCapability::DoPopulateResponseL |
|
179 // -------------------------------------------------------------------------- |
|
180 // |
|
181 void CMusAvaCapability::DoPopulateResponseL( CSdpDocument& aResponseContent ) |
|
182 |
|
183 { |
|
184 MUS_LOG( "mus: [MUSAVA] -> CMusAvaCapability::DoPopulateResponseL" ) |
|
185 |
|
186 MUS_LOG( "mus: [MUSAVA] Adding application attribute to SDP" ) |
|
187 //application |
|
188 CSdpAttributeField* application = CSdpAttributeField::NewLC( |
|
189 MusAvaCapabilityContext::SDPStringL( |
|
190 SdpCodecStringConstants::EMediaApplication ), |
|
191 KCapabilitySwisApplication ); |
|
192 |
|
193 aResponseContent.AttributeFields().AppendL( application ); |
|
194 CleanupStack::Pop( application ); |
|
195 |
|
196 MUS_LOG( "mus: [MUSAVA] Adding type attribute to SDP" ) |
|
197 //type |
|
198 RStringF typeStr = MusAvaCapabilityContext::SDPStringL( |
|
199 KCapabilitySDPAttributeNameType ); |
|
200 CleanupClosePushL( typeStr ); |
|
201 CSdpAttributeField* type = |
|
202 CSdpAttributeField::NewL( typeStr, KCapabilitySDPAttributeType ); |
|
203 CleanupStack::PopAndDestroy();//typeStr |
|
204 CleanupStack::PushL( type ); |
|
205 |
|
206 aResponseContent.AttributeFields().AppendL( type ); |
|
207 CleanupStack::Pop( type ); |
|
208 |
|
209 //Add fast startup mode, if supported |
|
210 AddFastModeL( aResponseContent ); |
|
211 |
|
212 MUS_LOG( "mus: [MUSAVA] Adding media line to SDP" ) |
|
213 //media line |
|
214 CSdpMediaField* mediaLine = MediaLineLC( |
|
215 MusAvaCapabilityContext::SDPStringL( |
|
216 SdpCodecStringConstants::EMediaVideo ), |
|
217 KCapabilitySwisFormatListH263Only ); |
|
218 |
|
219 //adding H.264 codec to SDP |
|
220 if( !MultimediaSharingSettings::IsAvcDisabled()) |
|
221 { |
|
222 MUS_LOG( "mus: [MUSAVA] - Adding avc to supported codec list" ) |
|
223 // reconstruct media line with H264 and H263 |
|
224 CleanupStack::PopAndDestroy(mediaLine); |
|
225 mediaLine = MediaLineLC( |
|
226 MusAvaCapabilityContext::SDPStringL( |
|
227 SdpCodecStringConstants::EMediaVideo ), |
|
228 KCapabilitySwisFormatList ); |
|
229 |
|
230 //adding H.264 codec to SDP |
|
231 CSdpFmtAttributeField* rtpMapH264 = |
|
232 RtpMapLineLC( KCapabilitySDPAttributeCodecH264, |
|
233 KCapabilitySDPAttributePayloadTypeH264, |
|
234 KCapabilitySDPAttributeClockrate ); |
|
235 |
|
236 mediaLine->FormatAttributeFields().AppendL( rtpMapH264 ); |
|
237 CleanupStack::Pop( rtpMapH264 ); |
|
238 } |
|
239 //H.263 codec |
|
240 CSdpFmtAttributeField* rtpMapH263 = |
|
241 RtpMapLineLC( KCapabilitySDPAttributeCodecH263, |
|
242 KCapabilitySDPAttributePayloadType, |
|
243 KCapabilitySDPAttributeClockrate ); |
|
244 |
|
245 mediaLine->FormatAttributeFields().AppendL( rtpMapH263 ); |
|
246 CleanupStack::Pop( rtpMapH263 ); |
|
247 |
|
248 aResponseContent.MediaFields().AppendL( mediaLine ); |
|
249 CleanupStack::Pop( mediaLine ); |
|
250 |
|
251 |
|
252 MUS_LOG( "mus: [MUSAVA] <- CMusAvaCapability::DoPopulateResponseL" ) |
|
253 } |
|
254 |
|
255 |
|
256 // -------------------------------------------------------------------------- |
|
257 // CMusAvaCapability::ResponseContentLC |
|
258 // -------------------------------------------------------------------------- |
|
259 // |
|
260 CSdpDocument* CMusAvaCapability::ResponseContentLC( |
|
261 const CSIPServerTransaction& aQuery ) |
|
262 |
|
263 { |
|
264 MUS_LOG( |
|
265 "mus: [MUSAVA]: -> CMusAvaCapability::CreateResponseContentL" ) |
|
266 |
|
267 RStringF netType = |
|
268 MusAvaCapabilityContext::SDPStringL( SdpCodecStringConstants::ENetType ); |
|
269 |
|
270 CSdpDocument* responseContent = CSdpDocument::NewLC(); |
|
271 |
|
272 responseContent->SetSessionNameL( KSessionName ); |
|
273 |
|
274 TPtrC8 localHost; |
|
275 RStringF hostType; |
|
276 |
|
277 MusAvaCapabilityContext::LocalHostL( aQuery, localHost, hostType ); |
|
278 |
|
279 CSdpOriginField* originField = OriginFieldL( |
|
280 netType, localHost, hostType ); |
|
281 responseContent->SetOriginField( originField ); |
|
282 |
|
283 // Connection field |
|
284 CSdpConnectionField* connectionField = |
|
285 CSdpConnectionField::NewL( netType, hostType, localHost ); |
|
286 responseContent->SetConnectionField( connectionField ); |
|
287 |
|
288 MUS_LOG( |
|
289 "mus: [MUSAVA]: <- CMusAvaCapability::CreateResponseContentL" ) |
|
290 |
|
291 return responseContent; |
|
292 } |
|
293 |
|
294 |
|
295 // ----------------------------------------------------------------------------- |
|
296 // CMusAvaCapability::Codec |
|
297 // ----------------------------------------------------------------------------- |
|
298 // |
|
299 CDesCArrayFlat* CMusAvaCapability::ResolveCodecsL( CSdpDocument& aSDP ) |
|
300 { |
|
301 // TODO: use array of 2 elements, as we assume that max 2 codecs are supported (H.263 and H.264) |
|
302 CDesCArrayFlat* codecs = new( ELeave ) CDesCArrayFlat( 2 ); |
|
303 CleanupStack::PushL( codecs ); |
|
304 |
|
305 RStringF media = MusAvaCapabilityContext::SDPStringL( |
|
306 SdpCodecStringConstants::EMediaVideo ); |
|
307 |
|
308 RStringF rtpmap = MusAvaCapabilityContext::SDPStringL( |
|
309 SdpCodecStringConstants::EAttributeRtpmap ); |
|
310 |
|
311 RPointerArray<CSdpMediaField>& mediaFields = aSDP.MediaFields(); |
|
312 |
|
313 for ( TInt i=0; i < mediaFields.Count(); i++ ) |
|
314 { |
|
315 if ( mediaFields[ i ]->Media() == media ) |
|
316 { |
|
317 RPointerArray<CSdpFmtAttributeField>& fmtLines = |
|
318 mediaFields[ i ]->FormatAttributeFields(); |
|
319 |
|
320 for ( TInt j=0; j < fmtLines.Count(); j++ ) |
|
321 { |
|
322 if ( fmtLines[ j ]->Attribute() == rtpmap ) |
|
323 { |
|
324 if ( CAPABILITY_CONTAINS( fmtLines[ j ]->Value(), KCapabilitySDPAttributeCodecH263 ) |
|
325 || ( CAPABILITY_CONTAINS( fmtLines[ j ]->Value(), KCapabilitySDPAttributeCodecH264 ) && |
|
326 !MultimediaSharingSettings::IsAvcDisabled() ) ) |
|
327 { |
|
328 HBufC* codecBuf = |
|
329 EscapeUtils::ConvertToUnicodeFromUtf8L( fmtLines[ j ]->Value() ); |
|
330 CleanupStack::PushL( codecBuf ); |
|
331 codecs->AppendL( *codecBuf ); |
|
332 CleanupStack::PopAndDestroy( codecBuf ); |
|
333 } |
|
334 } |
|
335 } |
|
336 } |
|
337 } |
|
338 CleanupStack::Pop( codecs ); |
|
339 |
|
340 return codecs; |
|
341 } |
|
342 |
|
343 // ----------------------------------------------------------------------------- |
|
344 // CMusAvaCapability::ResolveFastModeL |
|
345 // ----------------------------------------------------------------------------- |
|
346 // |
|
347 MusSettingsKeys::TFastMode CMusAvaCapability::ResolveFastModeL( |
|
348 CSdpDocument& aSDP ) |
|
349 { |
|
350 MUS_LOG( "mus: [MUSAVA]: -> CMusAvaCapability::ResolveFastModeL" ) |
|
351 MusSettingsKeys::TFastMode mode = MusSettingsKeys::EFastModeOff; |
|
352 if ( MultimediaSharingSettings::FastStartupModeL() == |
|
353 MusSettingsKeys::EFastModeOn ) |
|
354 { |
|
355 MUS_LOG( "mus: [MUSAVA] Checking if a=keywds:fastmode present..." ) |
|
356 const CSdpAttributeField* keywds = CMusAvaCapability::Attribute( |
|
357 MusAvaCapabilityContext::SDPStringL( |
|
358 SdpCodecStringConstants::EAttributeKeywds ), |
|
359 aSDP ); |
|
360 if ( keywds && |
|
361 keywds->Value().Compare( KCapabilitySDPAttributeFastMode ) == 0 ) |
|
362 { |
|
363 mode = MusSettingsKeys::EFastModeOn; |
|
364 } |
|
365 } |
|
366 MUS_LOG( "mus: [MUSAVA]: <- CMusAvaCapability::ResolveFastModeL" ) |
|
367 return mode; |
|
368 } |
|
369 |
|
370 // ----------------------------------------------------------------------------- |
|
371 // CMusAvaCapability::ResolveFastModeL |
|
372 // ----------------------------------------------------------------------------- |
|
373 // |
|
374 void CMusAvaCapability::AddFastModeL( CSdpDocument& aSdp ) |
|
375 { |
|
376 MUS_LOG( "mus: [MUSAVA]: -> CMusAvaCapability::AddFastModeL" ) |
|
377 if ( MultimediaSharingSettings::FastStartupModeL() == |
|
378 MusSettingsKeys::EFastModeOn ) |
|
379 { |
|
380 CSdpAttributeField* fastmode = CSdpAttributeField::NewLC( |
|
381 MusAvaCapabilityContext::SDPStringL( |
|
382 SdpCodecStringConstants::EAttributeKeywds ), |
|
383 KCapabilitySDPAttributeFastMode ); |
|
384 |
|
385 aSdp.AttributeFields().AppendL( fastmode ); |
|
386 CleanupStack::Pop( fastmode ); |
|
387 } |
|
388 MUS_LOG( "mus: [MUSAVA]: <- CMusAvaCapability::AddFastModeL" ) |
|
389 } |
|
390 |
|
391 |
|
392 // ----------------------------------------------------------------------------- |
|
393 // CMusAvaCapability::Attribute |
|
394 // ----------------------------------------------------------------------------- |
|
395 // |
|
396 const CSdpAttributeField* CMusAvaCapability::Attribute( |
|
397 const RStringF& aAttribute, |
|
398 CSdpDocument& aSDP ) |
|
399 { |
|
400 const CSdpAttributeField* field = NULL; |
|
401 |
|
402 TBool found = EFalse; |
|
403 RPointerArray<CSdpAttributeField>& attributes = aSDP.AttributeFields(); |
|
404 |
|
405 for ( TInt i=0; i < attributes.Count() && !found; i++ ) |
|
406 { |
|
407 if ( attributes[ i ]->Attribute() == aAttribute ) |
|
408 { |
|
409 field = attributes[ i ]; |
|
410 found = ETrue; |
|
411 } |
|
412 } |
|
413 |
|
414 if ( !found ) |
|
415 { |
|
416 TRAP_IGNORE( field = Attribute( MusAvaCapabilityContext::SDPStringL( |
|
417 SdpCodecStringConstants::EMediaVideo ), |
|
418 aAttribute, |
|
419 aSDP ) ); |
|
420 } |
|
421 return field; |
|
422 } |
|
423 |
|
424 |
|
425 // ----------------------------------------------------------------------------- |
|
426 // CMusAvaCapability::Attribute |
|
427 // ----------------------------------------------------------------------------- |
|
428 // |
|
429 const CSdpAttributeField* CMusAvaCapability::Attribute( |
|
430 const RStringF& aMedia, |
|
431 const RStringF& aAttribute, |
|
432 CSdpDocument& aSDP ) |
|
433 { |
|
434 const CSdpAttributeField* field = NULL; |
|
435 |
|
436 TBool found = EFalse; |
|
437 RPointerArray<CSdpMediaField>& mediaFields = aSDP.MediaFields(); |
|
438 |
|
439 for ( TInt i=0; i < mediaFields.Count() && !found; i++ ) |
|
440 { |
|
441 if ( mediaFields[ i ]->Media() == aMedia ) |
|
442 { |
|
443 RPointerArray<CSdpAttributeField>& attributes = |
|
444 mediaFields[ i ]->AttributeFields(); |
|
445 |
|
446 for ( TInt j=0; j < attributes.Count() && !found; j++ ) |
|
447 { |
|
448 if ( attributes[ j ]->Attribute() == aAttribute ) |
|
449 { |
|
450 field = attributes[ j ]; |
|
451 found = ETrue; |
|
452 } |
|
453 } |
|
454 } |
|
455 } |
|
456 return field; |
|
457 } |
|
458 |
|
459 |
|
460 // -------------------------------------------------------------------------- |
|
461 // CMusAvaCapability::AddContactHeaderL |
|
462 // -------------------------------------------------------------------------- |
|
463 // |
|
464 void CMusAvaCapability::AddContactHeaderL( |
|
465 CSIPServerTransaction& aQuery, |
|
466 RPointerArray<CSIPHeaderBase>& aResponseHeaders ) |
|
467 { |
|
468 MUS_LOG( "mus: [MUSAVA]: -> CMusAvaCapability::AddContactHeaderL" ) |
|
469 |
|
470 const CUri8& uri = aQuery.RequestElements()->RemoteUri(); |
|
471 |
|
472 |
|
473 TBool cingular = |
|
474 MultimediaSharingSettings::OperatorVariantSettingL() == |
|
475 MusSettingsKeys::EOperatorSpecific; |
|
476 |
|
477 TBool alreadyRequested = iExchange.QueryObserver(). |
|
478 CapabilitiesResolvedForCingular() && cingular; |
|
479 |
|
480 CSIPContactHeader* contact = NULL; |
|
481 |
|
482 if ( alreadyRequested ) |
|
483 { |
|
484 contact = MusAvaCapabilityContext::ContactHeaderLC( uri, |
|
485 SIPStrings::StringF( SipStrConsts::EEmpty ) ); |
|
486 } |
|
487 else |
|
488 { |
|
489 //Contact header with feature tag |
|
490 contact = MusAvaCapabilityContext::ContactHeaderLC( uri, Feature() ); |
|
491 } |
|
492 |
|
493 aResponseHeaders.AppendL( contact ); |
|
494 CleanupStack::Pop( contact ); |
|
495 |
|
496 MUS_LOG( "mus: [MUSAVA]: <- CMusAvaCapability::AddContactHeaderL" ) |
|
497 } |
|
498 |
|
499 |
|
500 // ---------------------------------------------------------------------------- |
|
501 // CMusAvaCapability::OriginFieldL |
|
502 // ---------------------------------------------------------------------------- |
|
503 // |
|
504 CSdpOriginField* CMusAvaCapability::OriginFieldL( |
|
505 const RStringF& aNetType, |
|
506 const TDesC8& aLocalHost, |
|
507 const RStringF& aHostType ) |
|
508 { |
|
509 #ifdef CAPABILITY_UNIT_TESTING |
|
510 TInt64 sessionID = 452027953; |
|
511 #else |
|
512 TTime now; |
|
513 now.UniversalTime(); |
|
514 TInt64 rand = now.Int64(); |
|
515 TInt64 sessionID = Math::Rand( rand ); |
|
516 #endif |
|
517 |
|
518 return CSdpOriginField::NewL( KOriginFieldUser, |
|
519 sessionID, |
|
520 sessionID, |
|
521 aNetType, |
|
522 aHostType, |
|
523 aLocalHost ); |
|
524 } |
|
525 |
|
526 // ----------------------------------------------------------------------------- |
|
527 // CMusAvaCapability::MediaLineLC |
|
528 // ----------------------------------------------------------------------------- |
|
529 // |
|
530 CSdpMediaField* CMusAvaCapability::MediaLineLC( const RStringF& aMedia, |
|
531 const TDesC8& aFormatList ) const |
|
532 { |
|
533 return CSdpMediaField::NewLC( aMedia, |
|
534 NULL, |
|
535 MusAvaCapabilityContext::SDPStringL( |
|
536 SdpCodecStringConstants::EProtocolRtpAvp ), |
|
537 aFormatList ); |
|
538 } |
|
539 |
|
540 // ----------------------------------------------------------------------------- |
|
541 // CMusAvaCapability::RtpMapLineLC |
|
542 // ------------------------------------------------ ----------------------------- |
|
543 // |
|
544 CSdpFmtAttributeField* CMusAvaCapability::RtpMapLineLC( |
|
545 const TDesC8& aCodec, |
|
546 const TUint64 aPayloadType, |
|
547 const TUint64 aClockRate, |
|
548 const TDesC8& aParams ) |
|
549 { |
|
550 |
|
551 HBufC8* clockrate = HBufC8::NewLC( KMaxNumAsStringSize ); |
|
552 clockrate->Des().Num( aClockRate, EDecimal ); |
|
553 HBufC8* payload = HBufC8::NewLC( KMaxNumAsStringSize ); |
|
554 payload->Des().Num( aPayloadType, EDecimal ); |
|
555 |
|
556 |
|
557 TSdpRtpmapValue rtpmapValue( aCodec, |
|
558 *clockrate, |
|
559 aParams ); |
|
560 |
|
561 |
|
562 HBufC8* rtpmap = rtpmapValue.EncodeL(); |
|
563 CleanupStack::PushL( rtpmap ); |
|
564 |
|
565 CSdpFmtAttributeField* rtpmapAttribute = |
|
566 CSdpFmtAttributeField::NewL( MusAvaCapabilityContext::SDPStringL( |
|
567 SdpCodecStringConstants::EAttributeRtpmap ), |
|
568 *payload, |
|
569 *rtpmap ); |
|
570 |
|
571 CleanupStack::PopAndDestroy( rtpmap ); |
|
572 CleanupStack::PopAndDestroy( payload ); |
|
573 CleanupStack::PopAndDestroy( clockrate ); |
|
574 |
|
575 CleanupStack::PushL( rtpmapAttribute ); |
|
576 |
|
577 return rtpmapAttribute; |
|
578 } |
|
579 |
|
580 |
|
581 |