equal
deleted
inserted
replaced
20 #include <voipdatabuffer.h> |
20 #include <voipdatabuffer.h> |
21 #include "debugtracemacros.h" |
21 #include "debugtracemacros.h" |
22 #include "VoIPAudioSession.h" |
22 #include "VoIPAudioSession.h" |
23 #include "VoIPAudioClientServer.h" |
23 #include "VoIPAudioClientServer.h" |
24 #include "VoIPFormatIntfcImpl.h" |
24 #include "VoIPFormatIntfcImpl.h" |
25 #include "VoIPFormatIntfcImpl.h" |
|
26 #include "VoIPBaseCodecIntfcImpl.h" |
25 #include "VoIPBaseCodecIntfcImpl.h" |
27 #include "VoIPILBCEncoderIntfcImpl.h" |
26 #include "VoIPILBCEncoderIntfcImpl.h" |
28 #include "VoIPG711EncoderIntfcImpl.h" |
27 #include "VoIPG711EncoderIntfcImpl.h" |
29 #include "VoIPSharedData.h" |
28 #include "VoIPSharedData.h" |
30 #include "VoIPUplinkStreamImpl.h" |
29 #include "VoIPUplinkStreamImpl.h" |
49 // --------------------------------------------------------------------------- |
48 // --------------------------------------------------------------------------- |
50 // |
49 // |
51 CVoIPAudioUplinkStreamImpl::~CVoIPAudioUplinkStreamImpl() |
50 CVoIPAudioUplinkStreamImpl::~CVoIPAudioUplinkStreamImpl() |
52 { |
51 { |
53 Close(); |
52 Close(); |
|
53 iCodecFormats.Close(); |
54 |
54 |
55 if (iMsgQHandler) |
55 if (iMsgQHandler) |
56 { |
56 { |
57 iMsgQHandler->Cancel(); |
57 iMsgQHandler->Cancel(); |
58 delete iMsgQHandler; |
58 delete iMsgQHandler; |
174 // |
174 // |
175 void CVoIPAudioUplinkStreamImpl::GetSupportedFormatsL( |
175 void CVoIPAudioUplinkStreamImpl::GetSupportedFormatsL( |
176 const TMMFPrioritySettings aPriority, |
176 const TMMFPrioritySettings aPriority, |
177 RArray<TVoIPCodecFormat>& aFormats) |
177 RArray<TVoIPCodecFormat>& aFormats) |
178 { |
178 { |
179 if (!iCodecFormats || aFormats.Count() <= 0) |
179 TInt count = iCodecFormats.Count(); |
|
180 aFormats.Reset(); |
|
181 if (count > 0) |
|
182 { |
|
183 for (TInt i = 0; i < count; i++) |
|
184 { |
|
185 aFormats.Append(iCodecFormats[i]); |
|
186 } |
|
187 } |
|
188 else |
180 { |
189 { |
181 RArray<TUint32> codecIDs; |
190 RArray<TUint32> codecIDs; |
182 CleanupClosePushL(codecIDs); |
191 CleanupClosePushL(codecIDs); |
183 codecIDs.Reset(); |
192 codecIDs.Reset(); |
184 iVoIPAudioSession.GetSupportedEncoders(aPriority, codecIDs, |
193 iVoIPAudioSession.GetSupportedEncoders(aPriority, codecIDs, |
185 iG711FrameSize); |
194 iG711FrameSize); |
186 |
195 |
|
196 #ifdef _DEBUG |
|
197 RDebug::Print(_L("G711 Frame Size=%d"), iG711FrameSize); |
|
198 #endif |
|
199 |
187 TUint32 codec = 0; |
200 TUint32 codec = 0; |
188 TInt count = codecIDs.Count(); |
201 TInt count = codecIDs.Count(); |
189 TVoIPCodecFormat format; |
202 TVoIPCodecFormat format; |
190 aFormats.Reset(); |
203 iCodecFormats.Reset(); |
191 |
204 |
192 for (TInt i = 0; i < count; i++) |
205 for (TInt i = 0; i < count; i++) |
193 { |
206 { |
194 codec = codecIDs[i]; |
207 codec = codecIDs[i]; |
195 |
208 |
201 RDebug::Print(_L("%c%c%c%c"), a, b, c, d); |
214 RDebug::Print(_L("%c%c%c%c"), a, b, c, d); |
202 #endif |
215 #endif |
203 format = ConvertFourCC(codec); |
216 format = ConvertFourCC(codec); |
204 if (format != ENULL) |
217 if (format != ENULL) |
205 { |
218 { |
|
219 iCodecFormats.Append(format); |
206 aFormats.Append(format); |
220 aFormats.Append(format); |
207 } |
221 } |
208 } |
222 } |
209 |
|
210 iCodecFormats = &aFormats; |
|
211 CleanupStack::PopAndDestroy(&codecIDs); |
223 CleanupStack::PopAndDestroy(&codecIDs); |
212 } |
224 } |
213 } |
225 } |
214 |
226 |
215 // --------------------------------------------------------------------------- |
227 // --------------------------------------------------------------------------- |
268 iBufferLen = 0; |
280 iBufferLen = 0; |
269 User::Leave(KErrNotSupported); |
281 User::Leave(KErrNotSupported); |
270 } |
282 } |
271 } |
283 } |
272 |
284 |
273 TUint32 codecFourCC = CodecFourCC(aFormat); |
285 TUint32 codecFourCC = CodecFourCC(iFormat); |
274 iVoIPAudioSession.SetEncoder(codecFourCC); |
286 iVoIPAudioSession.SetEncoder(codecFourCC); |
275 } |
|
276 |
|
277 // --------------------------------------------------------------------------- |
|
278 // CVoIPAudioUplinkStreamImpl::GetFormat |
|
279 // --------------------------------------------------------------------------- |
|
280 // |
|
281 TVoIPCodecFormat CVoIPAudioUplinkStreamImpl::GetFormat() |
|
282 { |
|
283 return iFormat; |
|
284 } |
287 } |
285 |
288 |
286 // --------------------------------------------------------------------------- |
289 // --------------------------------------------------------------------------- |
287 // CVoIPAudioUplinkStreamImpl::Start |
290 // CVoIPAudioUplinkStreamImpl::Start |
288 // --------------------------------------------------------------------------- |
291 // --------------------------------------------------------------------------- |
505 // |
508 // |
506 TBool CVoIPAudioUplinkStreamImpl::IsCodecSupportedL(TVoIPCodecFormat aFormat) |
509 TBool CVoIPAudioUplinkStreamImpl::IsCodecSupportedL(TVoIPCodecFormat aFormat) |
507 { |
510 { |
508 TBool status = EFalse; |
511 TBool status = EFalse; |
509 |
512 |
510 if (!iCodecFormats) |
513 if (iCodecFormats.Count() > 0) |
|
514 { |
|
515 status = FindFormat(aFormat); |
|
516 } |
|
517 else |
511 { |
518 { |
512 // Client hasn't called GetSupportedFormatsL |
519 // Client hasn't called GetSupportedFormatsL |
513 RArray<TVoIPCodecFormat> codecs; |
520 RArray<TVoIPCodecFormat> codecs; |
514 CleanupClosePushL(codecs); |
521 CleanupClosePushL(codecs); |
515 codecs.Reset(); |
522 codecs.Reset(); |
516 GetSupportedFormatsL(iPriority, codecs); //sets iCodecFormats |
523 GetSupportedFormatsL(iPriority, codecs); //sets iCodecFormats |
517 status = FindFormat(aFormat); |
524 status = FindFormat(aFormat); |
518 CleanupStack::PopAndDestroy(&codecs); |
525 CleanupStack::PopAndDestroy(&codecs); |
519 iCodecFormats = NULL; |
|
520 } |
|
521 else |
|
522 { |
|
523 status = FindFormat(aFormat); |
|
524 } |
526 } |
525 |
527 |
526 return status; |
528 return status; |
527 } |
529 } |
528 |
530 |
532 // |
534 // |
533 TBool CVoIPAudioUplinkStreamImpl::FindFormat(TVoIPCodecFormat aFormat) |
535 TBool CVoIPAudioUplinkStreamImpl::FindFormat(TVoIPCodecFormat aFormat) |
534 { |
536 { |
535 TBool found = EFalse; |
537 TBool found = EFalse; |
536 |
538 |
537 if (iCodecFormats) |
539 if (iCodecFormats.Count() > 0) |
538 { |
540 { |
539 if (iCodecFormats->Count() > 0) |
541 if (iCodecFormats.Find(aFormat) == KErrNotFound) |
540 { |
542 { |
541 if (iCodecFormats->Find(aFormat) == KErrNotFound) |
543 // For backward compatibility with VAS 1.0 |
542 { |
544 if (aFormat == EG711) |
543 // For backward compatibility with VAS 1.0 |
545 { |
544 if (aFormat == EG711) |
546 if (iCodecFormats.Find(EG711_10MS) != KErrNotFound) |
545 { |
547 { |
546 if (iCodecFormats->Find(EG711_10MS) != KErrNotFound) |
548 iFormat = EG711_10MS; |
547 { |
549 found = ETrue; |
548 iFormat = EG711_10MS; |
|
549 found = ETrue; |
|
550 } |
|
551 } |
550 } |
552 } |
551 } |
553 else |
552 else if (aFormat == EG711_10MS) |
554 { |
553 { |
555 iFormat = aFormat; |
554 if (iCodecFormats.Find(EG711) != KErrNotFound) |
556 found = ETrue; |
555 { |
557 } |
556 iFormat = EG711; |
|
557 found = ETrue; |
|
558 } |
|
559 } |
|
560 } |
|
561 else |
|
562 { |
|
563 iFormat = aFormat; |
|
564 found = ETrue; |
558 } |
565 } |
559 } |
566 } |
560 |
567 |
561 return found; |
568 return found; |
562 } |
569 } |
584 void CVoIPAudioUplinkStreamImpl::Event(TInt aEventType, TInt aError) |
591 void CVoIPAudioUplinkStreamImpl::Event(TInt aEventType, TInt aError) |
585 { |
592 { |
586 iObserver->Event(*this, aEventType, aError); |
593 iObserver->Event(*this, aEventType, aError); |
587 } |
594 } |
588 |
595 |
589 // --------------------------------------------------------------------------- |
|
590 // CVoIPAudioUplinkStreamImpl::Event |
|
591 // From MVoIPFormatObserver |
|
592 // --------------------------------------------------------------------------- |
|
593 // |
|
594 void CVoIPAudioUplinkStreamImpl::Event(const CVoIPFormatIntfc& /*aSrc*/, |
|
595 TInt /*aEventType*/) |
|
596 { |
|
597 } |
|
598 |
|
599 // End of file |
596 // End of file |