|
1 /* |
|
2 * Copyright (c) 2007-2009 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: VoIP Audio Services |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <e32base.h> |
|
19 #include <AudioPreference.h> |
|
20 #include <mmffourcc.h> |
|
21 #include <voipuplinkstream.h> |
|
22 #include <voipdownlinkstream.h> |
|
23 #include "debugtracemacros.h" |
|
24 #include "VoIPDataBufferImpl.h" |
|
25 #include "VoIPJBDataBufferImpl.h" |
|
26 #include "VoIPQueueHandler.h" |
|
27 #include "VoIPSharedData.h" |
|
28 #include "VoIPAudioSession.h" |
|
29 #include "VoIPDtmfTonePlayerImpl.h" |
|
30 #include "VoIPDownlinkStreamImpl.h" |
|
31 #include "VoIPUplinkStreamImpl.h" |
|
32 #include "VoIPUtilityFactoryImpl.h" |
|
33 |
|
34 // --------------------------------------------------------------------------- |
|
35 // CVoIPUtilityFactoryImpl::NewL |
|
36 // --------------------------------------------------------------------------- |
|
37 // |
|
38 CVoIPUtilityFactoryImpl* CVoIPUtilityFactoryImpl::NewL() |
|
39 { |
|
40 CVoIPUtilityFactoryImpl* self = new (ELeave) CVoIPUtilityFactoryImpl(); |
|
41 CleanupStack::PushL(self); |
|
42 self->ConstructL(); |
|
43 CleanupStack::Pop(self); |
|
44 return self; |
|
45 } |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // CVoIPUtilityFactoryImpl::~CVoIPUtilityFactoryImpl |
|
49 // --------------------------------------------------------------------------- |
|
50 // |
|
51 CVoIPUtilityFactoryImpl::~CVoIPUtilityFactoryImpl() |
|
52 { |
|
53 } |
|
54 |
|
55 // --------------------------------------------------------------------------- |
|
56 // CVoIPUtilityFactoryImpl::CVoIPUtilityFactoryImpl |
|
57 // --------------------------------------------------------------------------- |
|
58 // |
|
59 CVoIPUtilityFactoryImpl::CVoIPUtilityFactoryImpl() |
|
60 { |
|
61 } |
|
62 |
|
63 // --------------------------------------------------------------------------- |
|
64 // CVoIPUtilityFactoryImpl::ConstructL |
|
65 // --------------------------------------------------------------------------- |
|
66 // |
|
67 void CVoIPUtilityFactoryImpl::ConstructL() |
|
68 { |
|
69 // Clients must have MultimediaDD capability to use this priority/pref. |
|
70 // Also, VAS will monitor for emergency call and if detected it will |
|
71 // deny access to audio resources. |
|
72 iPriorityDn.iPref = KAudioPrefVoipAudioDownlink; |
|
73 iPriorityDn.iPriority = KAudioPriorityVoipAudioDownlink; |
|
74 iPriorityUp.iPref = KAudioPrefVoipAudioUplink; |
|
75 iPriorityUp.iPriority = KAudioPriorityVoipAudioUplink; |
|
76 } |
|
77 |
|
78 // --------------------------------------------------------------------------- |
|
79 // CVoIPUtilityFactoryImpl::CreateDownlinkStreamL |
|
80 // --------------------------------------------------------------------------- |
|
81 // |
|
82 void CVoIPUtilityFactoryImpl::CreateDownlinkStreamL( |
|
83 const TVersion /*aVersion*/, |
|
84 const CVoIPUtilityFactory::TVoIPCallType /*aCallType*/, |
|
85 CVoIPAudioDownlinkStream*& aDnLink) |
|
86 { |
|
87 iDownLink = CVoIPAudioDownlinkStreamImpl::NewL(iPriorityDn); |
|
88 if (iDownLink) |
|
89 { |
|
90 aDnLink = iDownLink; |
|
91 } |
|
92 } |
|
93 |
|
94 // --------------------------------------------------------------------------- |
|
95 // CVoIPUtilityFactoryImpl::CreateDownlinkStreamL |
|
96 // --------------------------------------------------------------------------- |
|
97 // |
|
98 void CVoIPUtilityFactoryImpl::CreateDownlinkStreamL( |
|
99 const TVersion /*aVersion*/, CVoIPJitterBufferIntfc*& aJBIntfc, |
|
100 CVoIPAudioDownlinkStream*& aDnLink) |
|
101 { |
|
102 iDownLink = CVoIPAudioDownlinkStreamImpl::NewL(iPriorityDn); |
|
103 |
|
104 if (iDownLink) |
|
105 { |
|
106 iDownLink->CreateJitterBufferIntfcL(aJBIntfc); |
|
107 aDnLink = iDownLink; |
|
108 } |
|
109 } |
|
110 |
|
111 // --------------------------------------------------------------------------- |
|
112 // CVoIPUtilityFactoryImpl::CreateUplinkStreamL |
|
113 // --------------------------------------------------------------------------- |
|
114 // |
|
115 void CVoIPUtilityFactoryImpl::CreateUplinkStreamL( |
|
116 const TVersion /*aVersion*/, |
|
117 const CVoIPUtilityFactory::TVoIPCallType /*aCallType*/, |
|
118 CVoIPAudioUplinkStream*& aUpLink) |
|
119 { |
|
120 iUpLink = CVoIPAudioUplinkStreamImpl::NewL(iPriorityUp); |
|
121 aUpLink = iUpLink; |
|
122 } |
|
123 |
|
124 // --------------------------------------------------------------------------- |
|
125 // CVoIPUtilityFactoryImpl::CreateDTMFTonePlayerL |
|
126 // --------------------------------------------------------------------------- |
|
127 // |
|
128 void CVoIPUtilityFactoryImpl::CreateDTMFTonePlayerL( |
|
129 CDTMFTonePlayer*& aDtmfPlayer) |
|
130 { |
|
131 aDtmfPlayer = CDTMFTonePlayerImpl::NewL(); |
|
132 } |
|
133 |
|
134 // --------------------------------------------------------------------------- |
|
135 // CVoIPUtilityFactoryImpl::CreateBufferL |
|
136 // --------------------------------------------------------------------------- |
|
137 // |
|
138 void CVoIPUtilityFactoryImpl::CreateBufferL(CVoIPDataBuffer*& aBuffer, |
|
139 const CVoIPDataBuffer::TVoIPBufferType aType, |
|
140 const TVoIPCodecFormat aCodecFormat) |
|
141 { |
|
142 TRACE_PRN_FN_ENT; |
|
143 |
|
144 TInt bufLen = 0; |
|
145 |
|
146 switch (aCodecFormat) |
|
147 { |
|
148 case EG729: |
|
149 bufLen = KVoIPG729FrameLen; |
|
150 break; |
|
151 case EILBC: |
|
152 bufLen = KVoIPILBCFrameLen; |
|
153 break; |
|
154 case EAMR_NB: |
|
155 bufLen = KVoIPAMRNBFrameLen; |
|
156 break; |
|
157 case EPCM16: |
|
158 bufLen = KVoIPPCM16FrameLen; |
|
159 break; |
|
160 case EG711_10MS: |
|
161 bufLen = KVoIPG711FrameLen10ms; |
|
162 break; |
|
163 case EG711: |
|
164 default: |
|
165 bufLen = KVoIPG711FrameLen20ms; |
|
166 } |
|
167 |
|
168 // Create buffer type- and codec-dependent |
|
169 if (aType == CVoIPDataBuffer::EJitterBuffer && aCodecFormat != EPCM16) |
|
170 { |
|
171 aBuffer = CVoIPJBDataBufferImpl::NewL(bufLen); |
|
172 } |
|
173 else |
|
174 { |
|
175 aBuffer = CVoIPDataBufferImpl::NewL(bufLen); |
|
176 } |
|
177 |
|
178 TRACE_PRN_FN_EXT; |
|
179 } |
|
180 |
|
181 // --------------------------------------------------------------------------- |
|
182 // CVoIPUtilityFactoryImpl::GetSupportedDownlinkFormats |
|
183 // --------------------------------------------------------------------------- |
|
184 // |
|
185 TInt CVoIPUtilityFactoryImpl::GetSupportedDownlinkFormats( |
|
186 RArray<TVoIPCodecFormat>& aFormats) |
|
187 { |
|
188 TInt err = KErrNotFound; |
|
189 if (iDownLink) |
|
190 { |
|
191 TRAP(err, iDownLink->GetSupportedFormatsL(iPriorityDn, aFormats)); |
|
192 } |
|
193 return err; |
|
194 } |
|
195 |
|
196 // --------------------------------------------------------------------------- |
|
197 // CVoIPUtilityFactoryImpl::GetSupportedUplinkFormats |
|
198 // --------------------------------------------------------------------------- |
|
199 // |
|
200 TInt CVoIPUtilityFactoryImpl::GetSupportedUplinkFormats( |
|
201 RArray<TVoIPCodecFormat>& aFormats) |
|
202 { |
|
203 TInt err = KErrNotFound; |
|
204 if (iUpLink) |
|
205 { |
|
206 TRAP(err, iUpLink->GetSupportedFormatsL(iPriorityUp, aFormats)); |
|
207 } |
|
208 return err; |
|
209 } |
|
210 |
|
211 // End of file |