|
1 /* |
|
2 * Copyright (c) 2004-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: Mcc Symmetric subthread uplink stream |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <mmf/server/mmfdatasource.h> |
|
22 #include <mmf/server/mmfdatasink.h> |
|
23 #include <mmf/server/mmfformat.h> |
|
24 #include <mmf/server/mmfaudioinput.h> |
|
25 #include "mccsymulstream.h" |
|
26 #include "mcculdatapath.h" |
|
27 #include "mcccodecconfigurator.h" |
|
28 #include "mccrtpmanager.h" |
|
29 #include "mccrtpdatasink.h" |
|
30 #include "mmccinterface.h" |
|
31 #include "mccsubcontrollerlogs.h" |
|
32 #include "mccmultiplexer.h" |
|
33 #include "mccresources.h" |
|
34 #include "amrpayloadformatwrite.h" |
|
35 #include "mccinternaldef.h" |
|
36 |
|
37 #include "mccredpayloadwrite.h" |
|
38 #include "mccuids.hrh" |
|
39 |
|
40 // EXTERNAL DATA STRUCTURES |
|
41 |
|
42 // EXTERNAL FUNCTION PROTOTYPES |
|
43 |
|
44 // CONSTANTS |
|
45 |
|
46 // MACROS |
|
47 |
|
48 // LOCAL CONSTANTS AND MACROS |
|
49 |
|
50 // MODULE DATA STRUCTURES |
|
51 |
|
52 // LOCAL FUNCTION PROTOTYPES |
|
53 |
|
54 // FORWARD DECLARATIONS |
|
55 |
|
56 // ============================= LOCAL FUNCTIONS =============================== |
|
57 |
|
58 // ============================ MEMBER FUNCTIONS =============================== |
|
59 |
|
60 // ----------------------------------------------------------------------------- |
|
61 // CMccSymUlStream::CMccSymUlStream |
|
62 // C++ default constructor can NOT contain any code, that |
|
63 // might leave. |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 CMccSymUlStream::CMccSymUlStream( |
|
67 TUint32 aMccStreamId, |
|
68 MAsyncEventHandler* aEventhandler, |
|
69 MMccResources* aMccResources, |
|
70 CMccRtpManager* aManager, |
|
71 TFourCC aFourCC, |
|
72 TInt aStreamType, |
|
73 CMccRtpMediaClock& aClock ) : |
|
74 CMccSymStreamBase( aMccStreamId, |
|
75 aEventhandler, |
|
76 aMccResources, |
|
77 aManager, |
|
78 aStreamType ), |
|
79 iFormatEncode( NULL ), |
|
80 iFourCC( aFourCC ) |
|
81 { |
|
82 iRtpMediaClock = &aClock; |
|
83 } |
|
84 |
|
85 // ----------------------------------------------------------------------------- |
|
86 // CMccSymUlStream::NewL |
|
87 // Two-phased constructor. |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 CMccSymUlStream* CMccSymUlStream::NewLC( |
|
91 TUint32 aMccStreamId, |
|
92 MAsyncEventHandler* aEventhandler, |
|
93 MMccResources* aMccResources, |
|
94 CMccRtpManager* aManager, |
|
95 TFourCC aFourCC, |
|
96 TInt aStreamType, |
|
97 CMccRtpMediaClock& aClock ) |
|
98 { |
|
99 CMccSymUlStream* s = |
|
100 new ( ELeave ) CMccSymUlStream( aMccStreamId, |
|
101 aEventhandler, |
|
102 aMccResources, |
|
103 aManager, |
|
104 aFourCC, |
|
105 aStreamType, |
|
106 aClock ); |
|
107 CleanupStack::PushL( s ); |
|
108 s->ConstructL(); |
|
109 return s; |
|
110 } |
|
111 |
|
112 // ----------------------------------------------------------------------------- |
|
113 // CMccSymUlStream::ConstructL |
|
114 // Symbian 2nd phase constructor can leave. |
|
115 // ----------------------------------------------------------------------------- |
|
116 // |
|
117 void CMccSymUlStream::ConstructL() |
|
118 { |
|
119 __SUBCONTROLLER( "CMccSymUlStream::ConstructL" ) |
|
120 __SUBCONTROLLER( "CMccSymUlStream::ConstructL, exit" ) |
|
121 } |
|
122 |
|
123 // ----------------------------------------------------------------------------- |
|
124 // CMccSymUlStream::~CMccSymUlStream |
|
125 // Destructor |
|
126 // ----------------------------------------------------------------------------- |
|
127 // |
|
128 CMccSymUlStream::~CMccSymUlStream() |
|
129 { |
|
130 __SUBCONTROLLER( "CMccSymUlStream::~CMccSymUlStream" ) |
|
131 |
|
132 if ( iSoundDevice ) |
|
133 { |
|
134 iSoundDevice = NULL; |
|
135 } |
|
136 |
|
137 MultiplexerCleanup(); |
|
138 |
|
139 // Sink may need update since encoder logoff is routed to it |
|
140 HandleSpecialSinksAndSources(); |
|
141 |
|
142 if ( iFormatEncode ) |
|
143 { |
|
144 iFormatEncode->SinkThreadLogoff(); |
|
145 delete iFormatEncode; |
|
146 } |
|
147 |
|
148 delete iRedFormatEncode; |
|
149 |
|
150 __SUBCONTROLLER( "CMccSymUlStream::~CMccSymUlStream, exit" ) |
|
151 |
|
152 } |
|
153 |
|
154 // ----------------------------------------------------------------------------- |
|
155 // CMccSymUlStream::SetPrioritySettingsL |
|
156 // Sets the MMF priority settings for this stream |
|
157 // ----------------------------------------------------------------------------- |
|
158 // |
|
159 void CMccSymUlStream::SetPrioritySettingsL( |
|
160 const TMMFPrioritySettings& aPriority ) |
|
161 { |
|
162 __SUBCONTROLLER( "CMccSymUlStream::SetPrioritySettingsL start" ); |
|
163 |
|
164 __ASSERT_ALWAYS( iDatasource, User::Leave( KErrNotReady ) ); |
|
165 __ASSERT_ALWAYS( iDatasink, User::Leave( KErrNotReady ) ); |
|
166 |
|
167 if ( iDatasink->DataSinkType() == KUidMccVideoSink ) |
|
168 { |
|
169 iDatasink->SetSinkPrioritySettings( aPriority ); |
|
170 } |
|
171 |
|
172 iDatasource->SetSourcePrioritySettings( aPriority ); |
|
173 |
|
174 __SUBCONTROLLER( "CMccSymUlStream::SetPrioritySettingsL end" ); |
|
175 } |
|
176 |
|
177 // ----------------------------------------------------------------------------- |
|
178 // CMccSymUlStream::AddSinkAndSourceL |
|
179 // From CMccSymStreamBase |
|
180 // ----------------------------------------------------------------------------- |
|
181 // |
|
182 void CMccSymUlStream::AddSinkAndSourceL( MDataSink* aDatasink, |
|
183 MDataSource* aDatasource ) |
|
184 { |
|
185 __SUBCONTROLLER( "CMccSymUlStream::AddSinkAndSourceL" ) |
|
186 __ASSERT_ALWAYS( aDatasink, User::Leave( KErrArgument ) ); |
|
187 __ASSERT_ALWAYS( aDatasource, User::Leave( KErrArgument ) ); |
|
188 __ASSERT_ALWAYS( !iDatapath, User::Leave( KErrAlreadyExists ) ); |
|
189 |
|
190 __SUBCONTROLLER( "CMccSymUlStream::AddSinkAndSourceL, adding" ) |
|
191 iDatasink = aDatasink; |
|
192 iDatasource = aDatasource; |
|
193 |
|
194 iMultiplexer = iMccResources->MultiplexerL( iDatasource ); |
|
195 |
|
196 iDatapath = CMccUlDataPath::NewL( this, |
|
197 iMccResources, |
|
198 Type() ); |
|
199 |
|
200 iDatapath->AddDataSourceL( iMultiplexer ); |
|
201 |
|
202 // Add datapath as the sink of the multiplexer, logon is routed to the |
|
203 // real datasource |
|
204 User::LeaveIfError( |
|
205 iMultiplexer->MultiplexerSourceThreadLogon( *this, *iDatapath, EFalse, Type() ) ); |
|
206 |
|
207 // Source logon must have been completed before fetching sounddevice |
|
208 if ( iDatasource->DataSourceType() == KUidMmfAudioInput ) |
|
209 { |
|
210 __SUBCONTROLLER( "CMccSymUlStream::AddSinkAndSourceL, KUidMmfAudioInput" ) |
|
211 |
|
212 iSoundDevice = &( static_cast<MMMFAudioInput*>( iDatasource )->SoundDevice() ); |
|
213 } |
|
214 |
|
215 // Inform datapath about ids of associated sink and source |
|
216 iDatapath->SetAssociatedSink( iDatasink ); |
|
217 iDatapath->SetAssociatedSource( iDatasource ); |
|
218 |
|
219 __SUBCONTROLLER( "CMccSymUlStream::AddSinkAndSourceL, exit" ) |
|
220 } |
|
221 |
|
222 // ----------------------------------------------------------------------------- |
|
223 // CMccSymUlStream::LoadCodecL |
|
224 // From CMccSymStreamBase |
|
225 // ----------------------------------------------------------------------------- |
|
226 // |
|
227 void CMccSymUlStream::LoadCodecL( const TMccCodecInfo& aCodecInfo, |
|
228 const TDesC8& aFmtp ) |
|
229 { |
|
230 __SUBCONTROLLER_INT1( "CMccSymUlStream::LoadCodecL, codec state:", |
|
231 CurrentCodecState() ) |
|
232 |
|
233 __ASSERT_ALWAYS( CurrentCodecState() == EStateCodecNone || |
|
234 iCodecInfo.iFourCC == aCodecInfo.iFourCC, |
|
235 User::Leave( KErrArgument ) ); |
|
236 |
|
237 iCodecInfo = aCodecInfo; |
|
238 |
|
239 if ( iDatasource && iDatasource->DataSourceType() == KUidMccFileSource ) |
|
240 { |
|
241 iCodecInfo.iSourceDefinedTimeStamps = ETrue; |
|
242 } |
|
243 |
|
244 if ( CurrentCodecState() == EStateCodecNone ) |
|
245 { |
|
246 delete iFmtpAttr; |
|
247 iFmtpAttr = NULL; |
|
248 |
|
249 iFmtpAttr = HBufC8::NewL( aFmtp.Length() ); |
|
250 iFmtpAttr->Des().Copy( aFmtp ); |
|
251 |
|
252 iCodecInfo.iFmtpLength = iFmtpAttr->Length(); |
|
253 |
|
254 CreatePayloadFormatEncoderL(); |
|
255 |
|
256 if ( iDatasink->DataSinkType() == KMccRtpSinkUid ) |
|
257 { |
|
258 CMccRtpDataSink* dataSink = static_cast<CMccRtpDataSink*>( iDatasink ); |
|
259 dataSink->SetMediaClock( *iRtpMediaClock ); |
|
260 } |
|
261 |
|
262 // Just negotiate the codec, load it later |
|
263 static_cast<CMccUlDataPath*>( iDatapath )->NegotiateL( *iFormatEncode ); |
|
264 |
|
265 SetCodecState( EStateCodecNegotiated ); |
|
266 } |
|
267 else if ( CurrentCodecState() == EStateCodecNegotiated ) |
|
268 { |
|
269 // Codec is not fully usable yet, do just formatter initialization |
|
270 MccCodecConfigurator::ConfigureCodecL( *iDatasource, |
|
271 *iFormatEncode, |
|
272 iCodecInfo, |
|
273 *iRtpMediaClock, |
|
274 CurrentCodecState(), |
|
275 iDatasink ); |
|
276 |
|
277 SetCodecState( EStateCodecPrepared ); |
|
278 } |
|
279 else if ( CurrentCodecState() == EStateCodecPrepared ) |
|
280 { |
|
281 if ( CodecLoadingAllowed() ) |
|
282 { |
|
283 // Load the codec |
|
284 static_cast<CMccUlDataPath*>( iDatapath )->LoadL( *iFormatEncode ); |
|
285 |
|
286 // Set state before updating as the state affects to update functionality |
|
287 SetCodecState( EStateCodecLoaded ); |
|
288 |
|
289 UpdateCodecInformationL( iCodecInfo ); |
|
290 } |
|
291 } |
|
292 else if ( CurrentCodecState() == EStateCodecLoaded || |
|
293 CurrentCodecState() == EStateCodecLoadedAndUpdating ) |
|
294 { |
|
295 if ( iDatasink->DataSinkType() == KMccRtpSinkUid ) |
|
296 { |
|
297 CMccRtpDataSink* dataSink = |
|
298 static_cast<CMccRtpDataSink*>( iDatasink ); |
|
299 |
|
300 // For updating keep alive parameters |
|
301 TMccCodecInfoBuffer infoBuffer( iCodecInfo ); |
|
302 dataSink->ConfigureL( infoBuffer ); |
|
303 } |
|
304 // Update codec info |
|
305 SetCodecState( EStateCodecLoadedAndUpdating ); |
|
306 UpdateCodecInformationL( iCodecInfo ); |
|
307 } |
|
308 else |
|
309 { |
|
310 User::Leave( KErrNotReady ); |
|
311 } |
|
312 |
|
313 __SUBCONTROLLER_INT1( "CMccSymUlStream::LoadCodecL, exit, new state:", |
|
314 CurrentCodecState() ) |
|
315 } |
|
316 |
|
317 // ----------------------------------------------------------------------------- |
|
318 // CMccSymUlStream::UpdateCodecInformationL |
|
319 // From CMccSymStreamBase |
|
320 // ----------------------------------------------------------------------------- |
|
321 // |
|
322 void CMccSymUlStream::UpdateCodecInformationL( TMccCodecInfo& /*aCodecInfo*/ ) |
|
323 { |
|
324 __SUBCONTROLLER( "CMccSymUlStream::UpdateCodecInformationL" ) |
|
325 User::LeaveIfNull( iDatasource ); |
|
326 User::LeaveIfNull( iFormatEncode ); |
|
327 |
|
328 HandleSpecialSinksAndSources(); |
|
329 |
|
330 iCodecInfo.iIsUpdate = ETrue; |
|
331 |
|
332 MccCodecConfigurator::ConfigureCodecL( *iDatasource, |
|
333 *iFormatEncode, |
|
334 iCodecInfo, |
|
335 *iRtpMediaClock, |
|
336 CurrentCodecState(), |
|
337 iDatasink ); |
|
338 |
|
339 __SUBCONTROLLER( "CMccSymUlStream::UpdateCodecInformationL, exit" ) |
|
340 } |
|
341 |
|
342 // ----------------------------------------------------------------------------- |
|
343 // CMccSymUlStream::CreatePayloadFormatEncoderL |
|
344 // Creates a payload format encoder for UL stream |
|
345 // ----------------------------------------------------------------------------- |
|
346 // |
|
347 void CMccSymUlStream::CreatePayloadFormatEncoderL() |
|
348 { |
|
349 __SUBCONTROLLER( "CMccSymUlStream::CreatePayloadFormatEncoderL" ) |
|
350 __ASSERT_ALWAYS( NULL == iFormatEncode, User::Leave( KErrAlreadyExists ) ); |
|
351 __ASSERT_ALWAYS( iDatasink, User::Leave( KErrNotReady ) ); |
|
352 |
|
353 TUid formatuid; |
|
354 formatuid.iUid = iCodecInfo.iPayloadFormatEncoder; |
|
355 |
|
356 if ( EGenRedUsed == iCodecInfo.iAlgoUsed ) |
|
357 { |
|
358 __ASSERT_ALWAYS( KMccPayloadTypeMax != iCodecInfo.iRedundantPayload, |
|
359 User::Leave( KErrArgument ) ); |
|
360 |
|
361 iRedFormatEncode = CMMFFormatEncode::NewL( |
|
362 TUid::Uid( KImplUidRedPayloadFormatEncode ), iDatasink ); |
|
363 |
|
364 iFormatEncode = CMMFFormatEncode::NewL( formatuid, iRedFormatEncode ); |
|
365 } |
|
366 else |
|
367 { |
|
368 iFormatEncode = CMMFFormatEncode::NewL( formatuid, iDatasink ); |
|
369 } |
|
370 |
|
371 User::LeaveIfError( iFormatEncode->SetSinkDataTypeCode( |
|
372 iCodecInfo.iFourCC, iCodecInfo.iType ) ); |
|
373 User::LeaveIfError( iFormatEncode->SinkThreadLogon( *this ) ); |
|
374 __SUBCONTROLLER( "CMccSymUlStream::CreatePayloadFormatEncoderL, exit" ) |
|
375 } |
|
376 |
|
377 // ----------------------------------------------------------------------------- |
|
378 // CMccSymUlStream::PrimeL |
|
379 // Primes the audio stream ready |
|
380 // ----------------------------------------------------------------------------- |
|
381 // |
|
382 void CMccSymUlStream::PrimeL( const TUint32 aEndpointId ) |
|
383 { |
|
384 __SUBCONTROLLER( "CMccSymUlStream::PrimeL" ) |
|
385 |
|
386 TBool controlNetworkResources = SetStateL( EStatePrepared, aEndpointId ); |
|
387 |
|
388 if ( controlNetworkResources && !LocalStream() ) |
|
389 { |
|
390 iRtpmanager->CreateTransmitStreamL( *iDatasink, iCodecInfo ); |
|
391 } |
|
392 |
|
393 LoadCodecL( iCodecInfo, KNullDesC8 ); |
|
394 |
|
395 DoPrimeL(); |
|
396 |
|
397 InformStreamStateChange( KMccStreamPrepared, aEndpointId ); |
|
398 |
|
399 __SUBCONTROLLER( "CMccSymUlStream::PrimeL, exit" ) |
|
400 } |
|
401 |
|
402 // ----------------------------------------------------------------------------- |
|
403 // CMccSymUlStream::PlayL |
|
404 // Starts audio streaming |
|
405 // ----------------------------------------------------------------------------- |
|
406 // |
|
407 void CMccSymUlStream::PlayL( TUint32 aEndpointId, |
|
408 TBool /*aStreamPaused*/, |
|
409 TBool aEnableRtcp ) |
|
410 { |
|
411 __SUBCONTROLLER( "CMccSymUlStream::PlayL" ) |
|
412 |
|
413 TBool controlNetworkResources = SetStateL( EStateStreaming, aEndpointId ); |
|
414 |
|
415 if ( !LocalStream() ) |
|
416 { |
|
417 if ( controlNetworkResources ) |
|
418 { |
|
419 iRtpmanager->StartSessionL(); |
|
420 } |
|
421 |
|
422 User::LeaveIfError( iRtpmanager->SetRTCPSendReceive( aEnableRtcp ) ); |
|
423 } |
|
424 |
|
425 UpdateCodecLoadingPermission( IsCodecOperationAllowed() ); |
|
426 |
|
427 LoadCodecL( iCodecInfo, KNullDesC8 ); |
|
428 |
|
429 DoPlayL(); |
|
430 |
|
431 InformStreamStateChange( KMccStreamStarted, aEndpointId ); |
|
432 |
|
433 __SUBCONTROLLER( "CMccSymUlStream::PlayL, exit" ) |
|
434 } |
|
435 |
|
436 // ----------------------------------------------------------------------------- |
|
437 // CMccSymUlStream::PauseL |
|
438 // Pauses audio streaming |
|
439 // ----------------------------------------------------------------------------- |
|
440 // |
|
441 void CMccSymUlStream::PauseL( const TUint32 aEndpointId, |
|
442 TBool aEnableRtcp ) |
|
443 { |
|
444 __SUBCONTROLLER( "CMccSymUlStream::PauseL" ) |
|
445 |
|
446 SetStateL( EStatePaused, aEndpointId ); |
|
447 |
|
448 if ( !LocalStream() ) |
|
449 { |
|
450 User::LeaveIfError( iRtpmanager->SetRTCPSendReceive( aEnableRtcp ) ); |
|
451 } |
|
452 |
|
453 DoPauseL(); |
|
454 |
|
455 InformStreamStateChange( KMccStreamPaused, aEndpointId ); |
|
456 } |
|
457 |
|
458 // ----------------------------------------------------------------------------- |
|
459 // CMccSymUlStream::ResumeL |
|
460 // Resumes paused audio streaming |
|
461 // ----------------------------------------------------------------------------- |
|
462 // |
|
463 void CMccSymUlStream::ResumeL( const TUint32 aEndpointId, |
|
464 TBool aEnableRtcp ) |
|
465 { |
|
466 __SUBCONTROLLER( "CMccSymUlStream::ResumeL" ) |
|
467 |
|
468 SetStateL( EStateStreaming, aEndpointId ); |
|
469 |
|
470 if ( !LocalStream() ) |
|
471 { |
|
472 User::LeaveIfError( iRtpmanager->SetRTCPSendReceive( aEnableRtcp ) ); |
|
473 } |
|
474 |
|
475 DoResumeL(); |
|
476 |
|
477 InformStreamStateChange( KMccStreamResumed, aEndpointId ); |
|
478 } |
|
479 |
|
480 // ----------------------------------------------------------------------------- |
|
481 // CMccSymUlStream::StopL |
|
482 // Stops the audio streaming |
|
483 // ----------------------------------------------------------------------------- |
|
484 // |
|
485 void CMccSymUlStream::StopL( const TUint32 aEndpointId ) |
|
486 { |
|
487 __SUBCONTROLLER( "CMccSymUlStream::StopL" ) |
|
488 |
|
489 SetStateL( EStateStopped, aEndpointId ); |
|
490 |
|
491 DoStopL(); |
|
492 |
|
493 InformStreamStateChange( KMccStreamStopped, aEndpointId ); |
|
494 } |
|
495 |
|
496 // ----------------------------------------------------------------------------- |
|
497 // CMccSymUlStream::SetBalanceL |
|
498 // Sets the current record balance |
|
499 // ----------------------------------------------------------------------------- |
|
500 // |
|
501 void CMccSymUlStream::SetBalanceL( TInt aLeftBal, TInt aRightBal ) |
|
502 { |
|
503 if( !iSoundDevice ) |
|
504 { |
|
505 User::Leave( KErrNotReady ); |
|
506 } |
|
507 else |
|
508 { |
|
509 iSoundDevice->SetRecordBalanceL( aLeftBal, aRightBal ); |
|
510 } |
|
511 } |
|
512 |
|
513 // ----------------------------------------------------------------------------- |
|
514 // CMccSymUlStream::GetBalanceL |
|
515 // Returns the current record balance |
|
516 // ----------------------------------------------------------------------------- |
|
517 // |
|
518 void CMccSymUlStream::GetBalanceL( TInt& aLeftbal, TInt& aRightbal ) |
|
519 { |
|
520 if( !iSoundDevice ) |
|
521 { |
|
522 User::Leave( KErrNotReady ); |
|
523 } |
|
524 else |
|
525 { |
|
526 iSoundDevice->GetRecordBalanceL( aLeftbal, aRightbal ); |
|
527 } |
|
528 } |
|
529 |
|
530 // ----------------------------------------------------------------------------- |
|
531 // CMccSymUlStream::GetSSRCL |
|
532 // Returns SSRC value |
|
533 // ----------------------------------------------------------------------------- |
|
534 // |
|
535 void CMccSymUlStream::GetSSRCL( TUint32& aSSRCValue ) |
|
536 { |
|
537 __ASSERT_ALWAYS( !LocalStream(), User::Leave( KErrArgument ) ); |
|
538 __ASSERT_ALWAYS( iDatasink, User::Leave( KErrNotReady ) ); |
|
539 |
|
540 CMccRtpDataSink* sink = static_cast<CMccRtpDataSink*>( iDatasink ); |
|
541 aSSRCValue = sink->GetSSRC(); |
|
542 } |
|
543 |
|
544 // ----------------------------------------------------------------------------- |
|
545 // CMccSymUlStream::ResetCountersL |
|
546 // |
|
547 // ----------------------------------------------------------------------------- |
|
548 // |
|
549 void CMccSymUlStream::ResetCountersL( ) |
|
550 { |
|
551 } |
|
552 |
|
553 // ----------------------------------------------------------------------------- |
|
554 // CMccSymUlStream::SendMediaSignalL |
|
555 // Uplink can send RTCP media signals |
|
556 // ----------------------------------------------------------------------------- |
|
557 // |
|
558 void CMccSymUlStream::SendMediaSignalL( const TMccEvent& aEvent ) |
|
559 { |
|
560 __ASSERT_ALWAYS( !LocalStream(), User::Leave( KErrArgument ) ); |
|
561 __ASSERT_ALWAYS( iDatasink, User::Leave( KErrNotReady ) ); |
|
562 |
|
563 CMccRtpDataSink* p = static_cast<CMccRtpDataSink*>( iDatasink ); |
|
564 p->SendMediaSignallingL( aEvent ); |
|
565 } |
|
566 |
|
567 // ----------------------------------------------------------------------------- |
|
568 // CMccSymUlStream::DoChangeBitrateL |
|
569 // Uplink can change bitrate during AMR streaming |
|
570 // ----------------------------------------------------------------------------- |
|
571 // |
|
572 void CMccSymUlStream::DoChangeBitrateL( TInt aBitrate ) |
|
573 { |
|
574 // This function is trapped inside ChangeBitrate() function |
|
575 __SUBCONTROLLER_INT1( "CMccSymUlStream::DoChangeBitrateL CURRENT:", iCodecInfo.iBitrate ); |
|
576 __SUBCONTROLLER_INT1( "CMccSymUlStream::DoChangeBitrateL NEW:", aBitrate ); |
|
577 |
|
578 // If using AMR codec and bitrate has changed for what it was set |
|
579 // then change it. |
|
580 const TUint32 fourCC = iCodecInfo.iFourCC.FourCC(); |
|
581 |
|
582 if ( ( KMccFourCCIdAMRNB == fourCC || KMccFourCCIdAMRWB == fourCC ) && |
|
583 iSoundDevice && iFormatEncode ) |
|
584 { |
|
585 // Change the bitrate only if it needs to be changed |
|
586 if( iCodecInfo.iBitrate != aBitrate ) |
|
587 { |
|
588 CAmrPayloadFormatWrite* write = |
|
589 static_cast<CAmrPayloadFormatWrite*>( iFormatEncode ); |
|
590 |
|
591 if ( write->IsBitrateChangeValid( aBitrate ) ) |
|
592 { |
|
593 MccCodecConfigurator::ChangeBitrateL( |
|
594 iCodecInfo, aBitrate, *iSoundDevice ); |
|
595 iCodecInfo.iBitrate = aBitrate; |
|
596 } |
|
597 } |
|
598 } |
|
599 else |
|
600 { |
|
601 // Other codec than AMR is in use and we cannot change the bitrate |
|
602 __SUBCONTROLLER( "CMccSymUlStream::DoChangeBitrateL KErrNotSupported" ); |
|
603 User::Leave( KErrNotSupported ); |
|
604 } |
|
605 } |
|
606 |
|
607 // ----------------------------------------------------------------------------- |
|
608 // CMccSymUlStream::SendRTCPSenderReportL |
|
609 // Sends a RTCP sender report |
|
610 // ----------------------------------------------------------------------------- |
|
611 // |
|
612 void CMccSymUlStream::SendRTCPSenderReportL() |
|
613 { |
|
614 __ASSERT_ALWAYS( !LocalStream(), User::Leave( KErrArgument ) ); |
|
615 __ASSERT_ALWAYS( iDatasink, User::Leave( KErrNotReady ) ); |
|
616 |
|
617 CMccRtpDataSink* dSink = static_cast<CMccRtpDataSink*>( iDatasink ); |
|
618 User::LeaveIfError( dSink->SendRTCPSenderReport() ); |
|
619 } |
|
620 |
|
621 // ----------------------------------------------------------------------------- |
|
622 // CMccSymUlStream::SendRTCPDataL |
|
623 // Sends Non-RTCP data |
|
624 // ----------------------------------------------------------------------------- |
|
625 // |
|
626 void CMccSymUlStream::SendRTCPDataL( const TDesC8& aData ) |
|
627 { |
|
628 __ASSERT_ALWAYS( !LocalStream(), User::Leave( KErrArgument ) ); |
|
629 __ASSERT_ALWAYS( iDatasink, User::Leave( KErrNotReady ) ); |
|
630 |
|
631 CMccRtpDataSink* dSink = static_cast<CMccRtpDataSink*>( iDatasink ); |
|
632 dSink->SendRTCPDataL( aData ); |
|
633 } |
|
634 |
|
635 // ----------------------------------------------------------------------------- |
|
636 // CMccSymUlStream::IsUplink |
|
637 // ----------------------------------------------------------------------------- |
|
638 // |
|
639 TBool CMccSymUlStream::IsUplink() |
|
640 { |
|
641 return ETrue; |
|
642 } |
|
643 |
|
644 // ----------------------------------------------------------------------------- |
|
645 // CMccSymUlStream::StandByL |
|
646 // ----------------------------------------------------------------------------- |
|
647 // |
|
648 void CMccSymUlStream::StandByL() |
|
649 { |
|
650 } |
|
651 |
|
652 // ----------------------------------------------------------------------------- |
|
653 // CMccSymUlStream::MultiplexerSink |
|
654 // ----------------------------------------------------------------------------- |
|
655 // |
|
656 MDataSink* CMccSymUlStream::MultiplexerSink() |
|
657 { |
|
658 return iDatapath; |
|
659 } |
|
660 |
|
661 // ----------------------------------------------------------------------------- |
|
662 // CMccSymDlStream::BindContextIntoStreamL |
|
663 // ----------------------------------------------------------------------------- |
|
664 // |
|
665 void CMccSymUlStream::BindContextIntoStreamL( TUint32 aEndpointId, |
|
666 const TMccCryptoContext& aContextParams ) |
|
667 { |
|
668 __ASSERT_ALWAYS( iDatasink, User::Leave( KErrNotReady ) ); |
|
669 |
|
670 if ( iDatasink->DataSinkType() == KMccRtpSinkUid && |
|
671 aEndpointId == MCC_ENDPOINT_ID( iDatasink ) ) |
|
672 { |
|
673 CMccRtpDataSink* dataSink = static_cast<CMccRtpDataSink*>( iDatasink ); |
|
674 dataSink->ApplyCryptoContextL( aContextParams ); |
|
675 } |
|
676 else |
|
677 { |
|
678 User::Leave( KErrNotFound ); |
|
679 } |
|
680 } |
|
681 |
|
682 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
683 |
|
684 // End of File |