|
1 /* |
|
2 * Copyright (c) 2005 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: Implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include "MCEConstants.h" |
|
21 #include "TCmdCreateSession.h" |
|
22 #include "CTcMCEContext.h" |
|
23 |
|
24 #include <sipprofile.h> |
|
25 #include "TCLog.h" |
|
26 |
|
27 #include <MCEMicSource.h> |
|
28 #include <MceRtpSink.h> |
|
29 #include <mcefilesink.h> |
|
30 #include <MCEAudioStream.h> |
|
31 #include <MceRtpSource.h> |
|
32 #include <MCESpeakerSink.h> |
|
33 #include <MceOutSession.h> |
|
34 #include <MCEEvent.h> |
|
35 #include <MCERefer.h> |
|
36 #include <MCEAMRCodec.h> |
|
37 #include <MCECnCodec.h> |
|
38 #include <mceredcodec.h> |
|
39 #include <mcedefs.h> |
|
40 |
|
41 #include <MCEVideoStream.h> |
|
42 #include <mcecamerasource.h> |
|
43 #include <mcedisplaysink.h> |
|
44 #include <MCEVideoCodec.h> |
|
45 #include <mceh263codec.h> |
|
46 #include <mcefilesource.h> |
|
47 |
|
48 const TUint KAudioPriorityPocAudioUplink = 95; |
|
49 const TUint KAudioPriorityPocAudioDownlink = 95; |
|
50 const TUint KAudioPrefPocAudioUplink = 0x05130001; |
|
51 const TUint KAudioPrefPocAudioDownlink = 0x05120001; |
|
52 |
|
53 const TUint KDtmfAudioPriority = 45; |
|
54 const TUint KDtmfAudioPref = 0x00150001; |
|
55 |
|
56 class CMceManager; |
|
57 class CTcNameValue; |
|
58 |
|
59 _LIT8( CN, "CN" ); |
|
60 _LIT8( red, "red" ); |
|
61 // ---------------------------------------------------------------------------- |
|
62 // TCmdCreateSession::ExecuteL |
|
63 // ---------------------------------------------------------------------------- |
|
64 // |
|
65 void TCmdCreateSession::ExecuteL() |
|
66 { |
|
67 TcLog::Write( _L8("\nTCmdCreateSession::ExecuteL()") ); |
|
68 CreateOutSessionL(); |
|
69 } |
|
70 |
|
71 // ---------------------------------------------------------------------------- |
|
72 // TCmdCreateSession::CreateOutSessionL |
|
73 // ---------------------------------------------------------------------------- |
|
74 // |
|
75 void TCmdCreateSession::CreateOutSessionL() |
|
76 { |
|
77 TcLog::Write( _L8("\nTCmdCreateSession::CreateOutSessionL()") ); |
|
78 // ---- Setup -------------------------------------------------------------- |
|
79 // Extract parameters |
|
80 |
|
81 TPtrC8 sessionType = ExtractTextL( KParamSessionType, EFalse ); |
|
82 |
|
83 TBool suppressRtcp = ExtractBooleanL( KParamSuppressRtcp, EFalse ); |
|
84 |
|
85 // Get profile |
|
86 CSIPProfile* profile = |
|
87 reinterpret_cast<CSIPProfile*>(GetObjectForIdL(KProfileObj, EFalse)); |
|
88 |
|
89 // Get event |
|
90 CMceEvent* event = |
|
91 reinterpret_cast<CMceEvent*>(GetObjectForIdL(KEventId, EFalse)); |
|
92 |
|
93 // Get refer |
|
94 CMceRefer* refer = |
|
95 reinterpret_cast<CMceRefer*>(GetObjectForIdL(KReferId, EFalse)); |
|
96 |
|
97 // Get alternative mainStream |
|
98 TBool mainStreamAudioOut = ExtractBooleanL( KParamMainStreamAudioOut, EFalse ); |
|
99 |
|
100 //get path for media file source |
|
101 TPtrC8 pathMediaFile = ExtractTextL( KParamAudioFileSource, EFalse ); |
|
102 |
|
103 //get path for media file sink |
|
104 TPtrC8 mediaFileSink = ExtractTextL( KParamMediaFileSink, EFalse ); |
|
105 |
|
106 //extract Array of codecs |
|
107 CDesC8Array* codecsList = ExtractArrayL(KArrayCodecsList, EFalse); |
|
108 |
|
109 //get the inactivity timer value for rtp source |
|
110 TInt rtpInactivityTimer = ExtractIntegerL(KParamRTPInactivityTimer, 0, EFalse); |
|
111 |
|
112 TInt keepAliveTimer = ExtractIntegerL( KParamKeepAliveValue, 0, EFalse ); |
|
113 keepAliveTimer = Max( 0, keepAliveTimer ); |
|
114 keepAliveTimer = Min( KMaxTUint8, keepAliveTimer ); |
|
115 // ---- Execution ---------------------------------------------------------- |
|
116 |
|
117 // Contruct session |
|
118 |
|
119 CMceSession* session = NULL; |
|
120 |
|
121 if ( profile ) |
|
122 { |
|
123 |
|
124 ///--------------------------------------------------------------- |
|
125 // Next is used only during API change, use only first row after change |
|
126 TPtrC8 recipient = ExtractTextL( KParamRecipient, EFalse ); |
|
127 TPtrC8 toHeader = ExtractTextL( KParamToHeader, EFalse ); |
|
128 |
|
129 TPtrC8 recipientOrToHeader; |
|
130 |
|
131 if ( recipient != KNullDesC8 ) |
|
132 { |
|
133 recipientOrToHeader.Set( recipient ); |
|
134 } |
|
135 else |
|
136 { |
|
137 recipientOrToHeader.Set( toHeader ); |
|
138 } |
|
139 |
|
140 //------------------------------------------------------------------ |
|
141 |
|
142 HBufC8* originator = HBufCParameterL(ExtractTextL( KParamOriginator, |
|
143 EFalse)); |
|
144 |
|
145 CleanupStack::PushL( originator ); |
|
146 |
|
147 session = CreateSessionL( iContext.MCEManager(), |
|
148 *profile, |
|
149 recipientOrToHeader, |
|
150 originator ); |
|
151 |
|
152 CleanupStack::Pop( originator ); |
|
153 } |
|
154 else if ( event ) |
|
155 { |
|
156 session = CreateSessionL( *event ); |
|
157 } |
|
158 else if ( refer ) |
|
159 { |
|
160 session = CreateSessionL( *refer ); |
|
161 } |
|
162 else |
|
163 { |
|
164 User::Leave( KErrNotFound ); |
|
165 } |
|
166 |
|
167 CleanupStack::PushL(session); |
|
168 |
|
169 // Construct and bind streams |
|
170 if ( (sessionType == KValueSessionTypeAudio) || (sessionType == KValueSessionTypeAudioVideo )) |
|
171 { |
|
172 CMceAudioStream* audioInStream = CMceAudioStream::NewLC(); |
|
173 |
|
174 CMceRtpSource* rtpSource = NULL; |
|
175 if(rtpInactivityTimer != 0) |
|
176 rtpSource = CMceRtpSource::NewLC(KMceJitterBufferLength, KMceJitterBufferTreshold, rtpInactivityTimer * 1000); |
|
177 else |
|
178 rtpSource = CMceRtpSource::NewLC(); |
|
179 |
|
180 audioInStream->SetSourceL(rtpSource); |
|
181 CleanupStack::Pop(rtpSource); |
|
182 |
|
183 CMceSpeakerSink* speaker = CMceSpeakerSink::NewLC(); |
|
184 audioInStream->AddSinkL(speaker); |
|
185 CleanupStack::Pop(speaker); |
|
186 |
|
187 |
|
188 CMceAudioStream* audioOutStream = CMceAudioStream::NewLC(); |
|
189 |
|
190 //use file stream as a source |
|
191 if( pathMediaFile.Compare( KNullDesC8 ) != 0 ) |
|
192 { |
|
193 // If source path was defined use the file audio specified in path |
|
194 iSessionHelper.SetMediaFileSourceL( iContext.MCEManager(), *audioOutStream, pathMediaFile ); |
|
195 } |
|
196 else |
|
197 { |
|
198 CMceMicSource* mic = CMceMicSource::NewLC(); |
|
199 audioOutStream->SetSourceL(mic); |
|
200 CleanupStack::Pop(mic); |
|
201 } |
|
202 |
|
203 CMceRtpSink* rtpSink = CMceRtpSink::NewL(suppressRtcp); |
|
204 CleanupStack::PushL(rtpSink); |
|
205 audioOutStream->AddSinkL(rtpSink); |
|
206 CleanupStack::Pop(rtpSink); |
|
207 |
|
208 if ( mainStreamAudioOut ) |
|
209 { |
|
210 audioOutStream->BindL( audioInStream ); |
|
211 // Add bound streams to session |
|
212 session->AddStreamL( audioOutStream ); |
|
213 } |
|
214 else |
|
215 { |
|
216 audioInStream->BindL( audioOutStream ); |
|
217 // Add bound streams to session |
|
218 session->AddStreamL( audioInStream ); |
|
219 } |
|
220 |
|
221 //use file as a media sink for recording the sending media |
|
222 if( mediaFileSink.Compare( KNullDesC8 ) != 0 ) |
|
223 { |
|
224 CMceAudioStream* audioOutStreamFile = CMceAudioStream::NewL(); |
|
225 CleanupStack::PushL( audioOutStreamFile ); |
|
226 |
|
227 //use the same source which was used for outgoing audio stream |
|
228 audioOutStreamFile->SetSourceL( audioOutStream->Source() ); |
|
229 |
|
230 iSessionHelper.SetMediaFileSinkL(*audioOutStreamFile, mediaFileSink); |
|
231 session->AddStreamL( audioOutStreamFile ); |
|
232 CleanupStack::Pop( audioOutStreamFile ); |
|
233 |
|
234 if(codecsList) |
|
235 { |
|
236 RemoveMediaCodecsL(audioOutStreamFile, audioOutStreamFile, codecsList, EStreamAudio); |
|
237 } |
|
238 } |
|
239 |
|
240 CleanupStack::Pop( audioOutStream ); |
|
241 CleanupStack::Pop( audioInStream ); |
|
242 |
|
243 const RPointerArray<CMceAudioCodec>& codecsIn = audioInStream->Codecs(); |
|
244 const RPointerArray<CMceAudioCodec>& codecsOut = audioOutStream->Codecs(); |
|
245 |
|
246 TUint audioPriorityUplink = ExtractIntegerL(KParamSessionPriorityUplink, KAudioPriorityPocAudioUplink ,EFalse); |
|
247 TUint audioPriorityDownlink = ExtractIntegerL(KParamSessionPriorityDownlink, KAudioPriorityPocAudioDownlink, EFalse ); |
|
248 TUint audioPrefUplink = ExtractIntegerL(KParamAudioPrefUplink, KAudioPrefPocAudioUplink, EFalse); |
|
249 TUint audioPrefDownlink = ExtractIntegerL(KParamAudioPrefDownlink, KAudioPrefPocAudioDownlink, EFalse); |
|
250 |
|
251 //removing selected codecs from streams |
|
252 if(codecsList) |
|
253 { |
|
254 //remove codecs which are not presented in the given list |
|
255 RemoveMediaCodecsL(audioOutStream, audioInStream, codecsList, EStreamAudio); |
|
256 |
|
257 } |
|
258 |
|
259 //defined here because KMceSDPNameDtmf hasn't been defined in mce2 |
|
260 _LIT8( DTMF, "telephone-event" ); |
|
261 //deleting pcm codecs. bug work-around until selected codecs can be passed from the test case |
|
262 for (TInt i = codecsOut.Count()-1; i >= 0; i --) |
|
263 { |
|
264 if ( keepAliveTimer ) |
|
265 { |
|
266 iSessionHelper.SetKeepaliveL(*codecsOut[i], keepAliveTimer); |
|
267 } |
|
268 |
|
269 if (!codecsOut[i]->SdpName().Compare(/*KMceSDPNameDtmf*/DTMF)) |
|
270 { |
|
271 iSessionHelper.SetCodecPrioritiesL(*codecsOut[i], iSessionHelper.dtmf); |
|
272 } |
|
273 else |
|
274 { |
|
275 iSessionHelper.SetCodecPriPrefL(*codecsOut[i],audioPriorityUplink,audioPrefUplink); |
|
276 } |
|
277 } |
|
278 for (TInt i = 0; i < codecsIn.Count(); i ++) |
|
279 { |
|
280 if (!codecsIn[i]->SdpName().Compare(DTMF)) |
|
281 { |
|
282 iSessionHelper.SetCodecPrioritiesL(*codecsIn[i], iSessionHelper.dtmf); |
|
283 |
|
284 } |
|
285 else |
|
286 { |
|
287 iSessionHelper.SetCodecPriPrefL(*codecsIn[i],audioPriorityDownlink,audioPrefDownlink); |
|
288 } |
|
289 } |
|
290 |
|
291 AddIdResponseL( KStreamId, *audioOutStream ); |
|
292 |
|
293 } |
|
294 // Initializing Video stream |
|
295 if ( (sessionType == KValueSessionTypeVideo) || (sessionType == KValueSessionTypeAudioVideo )) |
|
296 { |
|
297 |
|
298 //TODO |
|
299 CMceVideoStream* videoInStream = CMceVideoStream::NewLC(); |
|
300 |
|
301 CMceRtpSource* rtpSource = CMceRtpSource::NewLC(200, 100, 10); |
|
302 videoInStream->SetSourceL(rtpSource); |
|
303 CleanupStack::Pop(rtpSource); |
|
304 |
|
305 CMceDisplaySink* display = CMceDisplaySink::NewLC(iContext.MCEManager()); |
|
306 videoInStream->AddSinkL(display); |
|
307 CleanupStack::Pop(display); |
|
308 |
|
309 //creating outgoing video stream |
|
310 CMceVideoStream* videoOutStream = CMceVideoStream::NewLC(); |
|
311 |
|
312 //use file stream as a source |
|
313 if( pathMediaFile.Compare( KNullDesC8 ) != 0 ) |
|
314 { |
|
315 // If source path was defined use the file audio specified in path |
|
316 iSessionHelper.SetMediaFileSourceL( iContext.MCEManager(), *videoOutStream, pathMediaFile ); |
|
317 } |
|
318 else |
|
319 { |
|
320 CMceCameraSource* cam = CMceCameraSource::NewLC(iContext.MCEManager()); |
|
321 videoOutStream->SetSourceL(cam); |
|
322 CleanupStack::Pop(cam); |
|
323 } |
|
324 |
|
325 |
|
326 CMceRtpSink* rtpSink = CMceRtpSink::NewL(EFalse); |
|
327 CleanupStack::PushL(rtpSink); |
|
328 videoOutStream->AddSinkL(rtpSink); |
|
329 CleanupStack::Pop(rtpSink); |
|
330 |
|
331 if ( mainStreamAudioOut ) |
|
332 { |
|
333 videoOutStream->BindL( videoInStream ); |
|
334 // Add bound streams to session |
|
335 session->AddStreamL( videoOutStream ); |
|
336 } |
|
337 else |
|
338 { |
|
339 videoInStream->BindL( videoOutStream ); |
|
340 // Add bound streams to session |
|
341 session->AddStreamL( videoInStream ); |
|
342 } |
|
343 |
|
344 //use file as a media sink for recording the sending media |
|
345 if( mediaFileSink.Compare( KNullDesC8 ) != 0 ) |
|
346 { |
|
347 CMceVideoStream* videoOutStreamFile = CMceVideoStream::NewL(); |
|
348 CleanupStack::PushL( videoOutStreamFile ); |
|
349 |
|
350 //use the same source which was used for outgoing video stream |
|
351 videoOutStreamFile->SetSourceL( videoOutStream->Source() ); |
|
352 |
|
353 iSessionHelper.SetMediaFileSinkL(*videoOutStreamFile, mediaFileSink); |
|
354 session->AddStreamL( videoOutStreamFile ); |
|
355 CleanupStack::Pop( videoOutStreamFile ); |
|
356 |
|
357 if(codecsList) |
|
358 { |
|
359 RemoveMediaCodecsL(videoOutStreamFile, videoOutStreamFile, codecsList, EStreamVideo); |
|
360 } |
|
361 } |
|
362 |
|
363 CleanupStack::Pop( videoOutStream ); |
|
364 CleanupStack::Pop( videoInStream ); |
|
365 |
|
366 //remove selected codecs from the streams |
|
367 if(codecsList) |
|
368 { |
|
369 RemoveMediaCodecsL(videoOutStream, videoInStream, codecsList, EStreamVideo); |
|
370 } |
|
371 |
|
372 AddIdResponseL( KStreamId, *videoOutStream ); |
|
373 |
|
374 // AddIdResponseL(KSessionId, session); // uses CleanupStack internally |
|
375 } |
|
376 else |
|
377 { |
|
378 // NOP |
|
379 } |
|
380 |
|
381 |
|
382 CTcStructure* structure; |
|
383 do |
|
384 { |
|
385 structure = FindStructureL( KParamSessionModifier, EFalse ); |
|
386 if( structure ) |
|
387 { |
|
388 //structure contains a list of name-value pairs |
|
389 for (int i=0; i < structure->Count(); i++) |
|
390 { |
|
391 CTcNameValue* item = structure->ItemL( i ); |
|
392 session->SetModifierL( item->NameAsIntL(), item->ValueAsIntL() ); |
|
393 } |
|
394 iContext.List().RemoveParameter( KParamSessionModifier ); |
|
395 } |
|
396 } while( structure ); |
|
397 |
|
398 CleanupStack::Pop( session ); |
|
399 |
|
400 |
|
401 // ---- Response creation -------------------------------------------------- |
|
402 |
|
403 // Session must be added by pointer |
|
404 AddIdResponseL( KSessionId, session ); // uses CleanupStack internally |
|
405 } |
|
406 |
|
407 // ---------------------------------------------------------------------------- |
|
408 // TCmdCreateSession::CreateSessionL |
|
409 // ---------------------------------------------------------------------------- |
|
410 // |
|
411 CMceSession* TCmdCreateSession::CreateSessionL( CMceManager& aManager, |
|
412 CSIPProfile& aProfile, |
|
413 const TDesC8& aRecipient, |
|
414 HBufC8* aOriginator ) |
|
415 { |
|
416 return CMceOutSession::NewL( aManager, aProfile, |
|
417 aRecipient, aOriginator ); |
|
418 } |
|
419 |
|
420 // ---------------------------------------------------------------------------- |
|
421 // TCmdCreateSession::CreateSessionL |
|
422 // ---------------------------------------------------------------------------- |
|
423 // |
|
424 CMceSession* TCmdCreateSession::CreateSessionL( CMceEvent& aEvent ) |
|
425 { |
|
426 return CMceOutSession::NewL( aEvent ); |
|
427 } |
|
428 |
|
429 // ---------------------------------------------------------------------------- |
|
430 // TCmdCreateSession::CreateSessionL |
|
431 // ---------------------------------------------------------------------------- |
|
432 // |
|
433 CMceSession* TCmdCreateSession::CreateSessionL( CMceRefer& aRefer ) |
|
434 { |
|
435 return CMceOutSession::NewL( aRefer ); |
|
436 } |
|
437 |
|
438 // ---------------------------------------------------------------------------- |
|
439 // TCmdCreateSession::Match |
|
440 // ---------------------------------------------------------------------------- |
|
441 // |
|
442 TBool TCmdCreateSession::Match( const TTcIdentifier& aId ) |
|
443 { |
|
444 return TTcMceCommandBase::Match( aId, _L8("CreateSession") ); |
|
445 } |
|
446 |
|
447 // ---------------------------------------------------------------------------- |
|
448 // TCmdCreateSession::CreateL |
|
449 // ---------------------------------------------------------------------------- |
|
450 // |
|
451 TTcCommandBase* TCmdCreateSession::CreateL( MTcTestContext& aContext ) |
|
452 { |
|
453 return new( ELeave ) TCmdCreateSession( aContext ); |
|
454 } |
|
455 |
|
456 // ---------------------------------------------------------------------------- |
|
457 // TCmdCreateSession::RemoveMediaCodecsL |
|
458 // ---------------------------------------------------------------------------- |
|
459 TInt TCmdCreateSession::RemoveMediaCodecsL(CMceMediaStream* aStreamOut, CMceMediaStream* aStreamIn, |
|
460 CDesC8Array* aCodecsList, TStreamType aType) |
|
461 { |
|
462 |
|
463 CleanupStack::PushL(aCodecsList); |
|
464 const TInt codecsListCount = aCodecsList->Count(); |
|
465 |
|
466 if(codecsListCount>0) |
|
467 { |
|
468 |
|
469 if( aType == EStreamAudio ) |
|
470 { |
|
471 CMceAudioStream* audioOutStream = dynamic_cast<CMceAudioStream*>(aStreamOut); |
|
472 CMceAudioStream* audioInStream = dynamic_cast<CMceAudioStream*>(aStreamIn); |
|
473 |
|
474 const RPointerArray<CMceAudioCodec>& streamCodecsOut = |
|
475 audioOutStream->Codecs(); |
|
476 const RPointerArray<CMceAudioCodec>& streamCodecsIn = |
|
477 audioInStream->Codecs(); |
|
478 |
|
479 if ( (*aCodecsList)[0] != KValueCodecAll ) |
|
480 { |
|
481 TBool found = EFalse; |
|
482 //removing from audioOutStream |
|
483 for(TInt iCount = streamCodecsOut.Count()-1; iCount >= 0; iCount-- ) |
|
484 { |
|
485 CMceAudioCodec* codecOut = streamCodecsOut[iCount]; |
|
486 found = EFalse; |
|
487 |
|
488 for(TInt i = 0; i < codecsListCount; i++) |
|
489 { |
|
490 if(codecOut->SdpName() == (*aCodecsList)[i] ) |
|
491 { |
|
492 //CN codec will get enabled |
|
493 if( codecOut->SdpName() == CN ) |
|
494 { |
|
495 codecOut->SetStateL(CMceCodec::EEnabled); |
|
496 } |
|
497 else if( codecOut->SdpName() == red ) |
|
498 { |
|
499 codecOut->SetStateL(CMceCodec::EEnabled); |
|
500 } |
|
501 //setting preference |
|
502 codecOut->SetPreferenceL( i ); |
|
503 |
|
504 found = ETrue; |
|
505 } |
|
506 |
|
507 } |
|
508 |
|
509 if(found == EFalse) |
|
510 audioOutStream->RemoveCodecL(*streamCodecsOut[iCount]); |
|
511 } |
|
512 |
|
513 audioOutStream->ReorderCodecsByPreferenceL(EFalse); |
|
514 |
|
515 found = EFalse; |
|
516 //removing from audioInStream |
|
517 for(TInt iCount = streamCodecsIn.Count()-1; iCount >= 0; iCount-- ) |
|
518 { |
|
519 CMceAudioCodec* codecIn = streamCodecsIn[iCount]; |
|
520 found = EFalse; |
|
521 |
|
522 for(TInt i = 0; i < codecsListCount; i++) |
|
523 { |
|
524 if( codecIn->SdpName() == (*aCodecsList)[i] ) |
|
525 { |
|
526 found = ETrue; |
|
527 //CN codec will get enabled |
|
528 if( codecIn->SdpName() == CN ) |
|
529 { |
|
530 codecIn->SetStateL(CMceCodec::EEnabled); |
|
531 } |
|
532 else if( codecIn->SdpName() == red ) |
|
533 { |
|
534 codecIn->SetStateL(CMceCodec::EEnabled); |
|
535 } |
|
536 //setting preference according to the order in list |
|
537 codecIn->SetPreferenceL( i ); |
|
538 } |
|
539 |
|
540 } |
|
541 |
|
542 |
|
543 if(found == EFalse) |
|
544 audioInStream->RemoveCodecL(*streamCodecsIn[iCount]); |
|
545 } |
|
546 |
|
547 audioInStream->ReorderCodecsByPreferenceL( EFalse ); |
|
548 |
|
549 } |
|
550 |
|
551 } //end of audio stream |
|
552 if( aType == EStreamVideo ) |
|
553 { |
|
554 CMceVideoStream* videoOutStream = dynamic_cast<CMceVideoStream*>(aStreamOut); |
|
555 CMceVideoStream* videoInStream = dynamic_cast<CMceVideoStream*>(aStreamIn); |
|
556 |
|
557 const RPointerArray<CMceVideoCodec>& streamCodecsOut = |
|
558 videoOutStream->Codecs(); |
|
559 const RPointerArray<CMceVideoCodec>& streamCodecsIn = |
|
560 videoInStream->Codecs(); |
|
561 |
|
562 if ( (*aCodecsList)[0] != KValueCodecAll ) |
|
563 { |
|
564 |
|
565 //removing from videoOutStream |
|
566 for(TInt iCount = streamCodecsOut.Count()-1; iCount >= 0; iCount-- ) |
|
567 { |
|
568 CMceVideoCodec* codecOut = streamCodecsOut[iCount]; |
|
569 |
|
570 TBool found = EFalse; |
|
571 |
|
572 for(TInt i = 0; i < codecsListCount; i++) |
|
573 { |
|
574 if(codecOut->SdpName() == (*aCodecsList)[i] ) |
|
575 { |
|
576 found = ETrue; |
|
577 codecOut->SetPreferenceL( i ); |
|
578 } |
|
579 |
|
580 } |
|
581 |
|
582 if(found == EFalse) |
|
583 videoOutStream->RemoveCodecL(*streamCodecsOut[iCount]); |
|
584 |
|
585 } |
|
586 videoOutStream->ReorderCodecsByPreferenceL(EFalse); |
|
587 |
|
588 //removing from videoInStream |
|
589 for(TInt iCount = streamCodecsIn.Count()-1; iCount >= 0; iCount-- ) |
|
590 { |
|
591 CMceVideoCodec* codecIn = streamCodecsIn[iCount]; |
|
592 |
|
593 TBool found = EFalse; |
|
594 |
|
595 for(TInt i = 0; i < codecsListCount; i++) |
|
596 { |
|
597 if( codecIn->SdpName() == (*aCodecsList)[i] ) |
|
598 { |
|
599 found = ETrue; |
|
600 codecIn->SetPreferenceL( i ); |
|
601 } |
|
602 |
|
603 } |
|
604 |
|
605 if(found == EFalse) |
|
606 videoInStream->RemoveCodecL(*streamCodecsIn[iCount]); |
|
607 } |
|
608 videoInStream->ReorderCodecsByPreferenceL(EFalse); |
|
609 } |
|
610 }// end of video stream |
|
611 } |
|
612 |
|
613 CleanupStack::Pop(aCodecsList); |
|
614 return 0; |
|
615 } |