|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef CMCERTPSOURCE_H |
|
22 #define CMCERTPSOURCE_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32std.h> |
|
26 #include <mcemediasource.h> |
|
27 |
|
28 // CONSTANTS |
|
29 const TMceSourceType KMceRTPSource = 1; |
|
30 const TInt KMceJitterBufferLength = 10; |
|
31 const TInt KMceJitterBufferTreshold = 5; |
|
32 |
|
33 //FORWARD DECLARATIONS |
|
34 class TMceIds; |
|
35 class TMceEvent; |
|
36 |
|
37 // CLASS DECLARATION |
|
38 |
|
39 /** |
|
40 * Class representing incoming RTP stream in MCE. |
|
41 * |
|
42 * CMceRtpSource can be used to receive media data from network. |
|
43 * It can be configured with stream specific values to avoid |
|
44 * jitter generated by network. It may also be configured to |
|
45 * recognize separate media bursts instead of just receiving |
|
46 * continuous flow of data. |
|
47 * |
|
48 * Events from this class can be received through class MMceRtpObserver. |
|
49 * |
|
50 * Enable and Disable operations to it are considered to be local, |
|
51 * so they are not signalled to remote terminal. |
|
52 * |
|
53 * One CMceRTPSource may contain several RTP streams which are identified with |
|
54 * synchronization source (SSRC) values. Disabling or enabling CMceRtpSource |
|
55 * will affect to all SSRCs but streaming from specific SSRC can be also |
|
56 * controlled with EnableSSRCL and Disable SSRCL methods. These are also |
|
57 * local operations, thus not signalled to remote terminal. |
|
58 * |
|
59 * @lib mceclient.lib |
|
60 */ |
|
61 class CMceRtpSource: public CMceMediaSource |
|
62 { |
|
63 |
|
64 public: // Constructors and destructor |
|
65 |
|
66 /** |
|
67 * Two-phased constructor. |
|
68 * @param aBufferLength Length in packets of jitter buffer |
|
69 * @param aBufferTreshold Treshold in packets of jitter buffer |
|
70 * @param aInactivityTimer Timer (ms) to detect network inactivity. |
|
71 * If 0, no activity detection, otherwise source is set to support |
|
72 * talk bursts and report inactivity. |
|
73 * @param aIdentity Identity of user placed in RTCP, ownership not transferred. |
|
74 */ |
|
75 IMPORT_C static CMceRtpSource* NewL( |
|
76 TUint aBufferLength = KMceJitterBufferLength, |
|
77 TUint aBufferTreshold = KMceJitterBufferTreshold, |
|
78 TUint32 aInactivityTimer = 0, |
|
79 HBufC8* aIdentity = 0 ); |
|
80 |
|
81 /** |
|
82 * Two-phased constructor. |
|
83 * @param aBufferLength Length in packets of jitter buffer |
|
84 * @param aBufferTreshold Treshold in packets of jitter buffer |
|
85 * @param aInactivityTimer Timer (ms) to detect network inactivity. |
|
86 * If 0, no activity detection, otherwise source is set to support |
|
87 * talk bursts and report inactivity. |
|
88 * @param aIdentity Identity of user placed in RTCP, ownership not transferred. |
|
89 */ |
|
90 IMPORT_C static CMceRtpSource* NewLC( |
|
91 TUint aBufferLength = KMceJitterBufferLength, |
|
92 TUint aBufferTreshold = KMceJitterBufferTreshold, |
|
93 TUint32 aInactivityTimer = 0, |
|
94 HBufC8* aIdentity = 0 ); |
|
95 |
|
96 /** |
|
97 * Destructor. |
|
98 */ |
|
99 IMPORT_C ~CMceRtpSource(); |
|
100 |
|
101 public: // From base class |
|
102 |
|
103 /** |
|
104 * Enables the source explicitly. |
|
105 */ |
|
106 IMPORT_C void EnableL(); |
|
107 |
|
108 /** |
|
109 * Disables the source explicitly. |
|
110 */ |
|
111 IMPORT_C void DisableL(); |
|
112 |
|
113 public: // Functions |
|
114 |
|
115 /** |
|
116 * Enables RTP inactivity timer. |
|
117 * @param aInactivityTimer Timer value (ms) that after inactivity |
|
118 * of media from network is reported to client. |
|
119 */ |
|
120 IMPORT_C void EnableInactivityTimerL( TUint32 aInactivityTimer ); |
|
121 |
|
122 /** |
|
123 * Disables RTP inactivity timer. |
|
124 */ |
|
125 IMPORT_C void DisableInactivityTimerL(); |
|
126 |
|
127 /** |
|
128 * Updates settings for incoming session. |
|
129 * @pre CMceSession::State() == CMceSession::EIncoming |
|
130 * @param aBufferLength Length in packets of jitter buffer |
|
131 * @param aBufferTreshold Treshold in packets of jitter buffer |
|
132 * @param aInactivityTimer Timer (ms) to detect network inactivity. |
|
133 * If 0, no activity detection, otherwise source is set to support |
|
134 * talk bursts and report inactivity. |
|
135 * @param aIdentity Identity of user placed in RTCP, ownership not transferred. |
|
136 */ |
|
137 IMPORT_C void UpdateL ( TUint aBufferLength = KMceJitterBufferLength, |
|
138 TUint aBufferTreshold = KMceJitterBufferTreshold, |
|
139 TUint32 aInactivityTimer = 0, |
|
140 HBufC8* aIdentity = 0 ); |
|
141 |
|
142 |
|
143 /** |
|
144 * Sends RTCP receiver report to recipient. |
|
145 */ |
|
146 IMPORT_C void SendRRL(); |
|
147 |
|
148 /** |
|
149 * Returns the last RTP stream source identifier |
|
150 * used in network (SSRC). |
|
151 * @pre CMceSession::State() == CMceSession::EEstablished |
|
152 * @return last source identifier used in network (SSRC). |
|
153 */ |
|
154 IMPORT_C TUint32 Ssrc() const; |
|
155 |
|
156 /** |
|
157 * Gets an array of RTP synchronization source (SSRC) identifiers. |
|
158 * Array includes all SSRC values this RtpSource has received RTP from. |
|
159 * Changes in array are notified using MMceRtpObserver interface. |
|
160 * @return array of synchronization source identifiers |
|
161 */ |
|
162 IMPORT_C const RArray<TUint>& Ssrcs() const; |
|
163 |
|
164 /** |
|
165 * Enables streaming from specified synchronization source (SSRC). |
|
166 * @param aSsrc synchronization source to be enabled |
|
167 */ |
|
168 IMPORT_C void EnableSsrcL( TUint aSsrc ); |
|
169 |
|
170 /** |
|
171 * Disables streaming from specified synchronization source (SSRC). |
|
172 * @param aSsrc synchronization source to be disabled |
|
173 */ |
|
174 IMPORT_C void DisableSsrcL( TUint aSsrc ); |
|
175 |
|
176 /** |
|
177 * Determines whether specific SSRC is enabled or not. |
|
178 * @param aSsrc the SSRC identifier |
|
179 * @return ETrue if specified SSRC is enabled; otherwise EFalse |
|
180 */ |
|
181 IMPORT_C TBool IsSsrcEnabledL( TUint aSsrc ); |
|
182 |
|
183 public: //from CMceMediaSource |
|
184 |
|
185 /** |
|
186 * Traversal event handler |
|
187 * @param aEvent the event |
|
188 * @return status, if event was consumed or not or object needs update |
|
189 */ |
|
190 TInt EventReceivedL( TMceEvent& aEvent ); |
|
191 |
|
192 private: |
|
193 |
|
194 /** |
|
195 * C++ default constructor. |
|
196 */ |
|
197 CMceRtpSource(); |
|
198 |
|
199 /** |
|
200 * second-phase constructor |
|
201 * @param aBufferLength Length in packets of jitter buffer |
|
202 * @param aBufferTreshold Treshold in packets of jitter buffer |
|
203 * @param aInactivityTimer Timer (ms) to detect network inactivity. |
|
204 * If 0, no activity detection, otherwise source is set to support |
|
205 * talk burts and report inactivity. |
|
206 * @param aMediaBurstIndicator Indicator sound to be played before |
|
207 * every new burst of media, if source in media burst mode. |
|
208 * @param aIdentity Identity of user placed in RTCP, ownership not transferred. |
|
209 */ |
|
210 void ConstructL( TUint aBufferLength, |
|
211 TUint aBufferTreshold, |
|
212 TUint32 aInactivityTimer, |
|
213 HBufC8* aMediaBurstIndicator, |
|
214 HBufC8* aIdentity ); |
|
215 |
|
216 /** |
|
217 * Handles event |
|
218 * @param aEvent the event |
|
219 * @return status, if event was consumed or not or object needs update |
|
220 */ |
|
221 TInt HandleEvent( TMceEvent& aEvent ); |
|
222 |
|
223 void DoITCSendL( TUint8 aITCFunction ); |
|
224 |
|
225 private: // NOT owned data |
|
226 |
|
227 //for testing |
|
228 |
|
229 MCE_UNIT_TEST_DEFS |
|
230 |
|
231 }; |
|
232 |
|
233 |
|
234 #endif |