|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // RTP Pint Implementation |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalComponent |
|
21 */ |
|
22 |
|
23 |
|
24 #include <e32std.h> |
|
25 #include <ecom/ecom.h> |
|
26 #include <ecom/implementationproxy.h> |
|
27 #include "rtppint.h" |
|
28 #include "rtpflow.h" |
|
29 #include "rtcpflow.h" |
|
30 |
|
31 |
|
32 using namespace ESock; |
|
33 |
|
34 class CRtpController; |
|
35 // RTP Protocol-Interface |
|
36 |
|
37 CRtpProtocolIntf::CRtpProtocolIntf(CProtocolIntfFactoryBase& aFactory,const Messages::TNodeId& aId) |
|
38 : CProtocolIntfBase(aFactory,aId) |
|
39 { |
|
40 } |
|
41 |
|
42 void CRtpProtocolIntf::DoFlowCreated(CSubConnectionFlowBase& ) |
|
43 { |
|
44 /* nothing to Do Here */ |
|
45 return; |
|
46 } |
|
47 |
|
48 void CRtpProtocolIntf::DoFlowBeingDeleted(CSubConnectionFlowBase& aFlow) |
|
49 { |
|
50 /* The flows shud be removed from the Hash Table */ |
|
51 TInt sz = iFlowArray.Count(); |
|
52 for(TInt i=0; i < sz; i++) |
|
53 { |
|
54 /* When RTP Flow is removed. We remove the entry from the hash table. |
|
55 * When RTCP Flow is removed this entry is still maintained */ |
|
56 if(iFlowArray[i].GetRtpFlow() == &aFlow) |
|
57 { |
|
58 iFlowArray.Remove(i); |
|
59 return; |
|
60 } |
|
61 } |
|
62 return; |
|
63 } |
|
64 |
|
65 void CRtpProtocolIntf::RegisterSubConnProvIDL(CRtpBaseFlow* aRtpBaseflow, const Messages::TNodeId& aScprId) |
|
66 { |
|
67 TRtpFlowHolder *pFlowHolder; |
|
68 |
|
69 /* Query if the flow Created was RTP or RTCP */ |
|
70 /* Verify the flow Creation Order is Correct */ |
|
71 /* Initialise RTP and RTCP flows with proper params */ |
|
72 pFlowHolder = FindInFlowArray(aScprId); |
|
73 if(!pFlowHolder) |
|
74 { |
|
75 /* This flow is an RTP Flow */ |
|
76 TRtpFlowHolder flowHolder(aScprId); |
|
77 flowHolder.SetRtpFlow(static_cast<CRtpFlow*>(aRtpBaseflow)); |
|
78 iFlowArray.AppendL(flowHolder); |
|
79 } |
|
80 else |
|
81 { |
|
82 /* This flow is RTCP. The fact that pHolder exists means |
|
83 an RTP Socket was already opened */ |
|
84 pFlowHolder->SetRtcpFlow(static_cast<CRtcpFlow*>(aRtpBaseflow)); |
|
85 /* Here ask the RTP Flow to create an RTCP Sender. |
|
86 Pass on the Parameters to RTCP Flow */ |
|
87 CRtpFlow *pRtpFlow = pFlowHolder->GetRtpFlow(); |
|
88 CRtcpFlow *pRtcpFlow = pFlowHolder->GetRtcpFlow(); |
|
89 pRtcpFlow->SetRtpSession(pRtpFlow->GetRtpSession()); |
|
90 } |
|
91 } |
|
92 |
|
93 |
|
94 //Tries to find a FlowHolder belonging to the supplied SCPR. Will return a |
|
95 //pointer to the flowholder or NULL if cannot be found |
|
96 TRtpFlowHolder* CRtpProtocolIntf::FindInFlowArray(const Messages::TNodeId& aScprId) |
|
97 { |
|
98 TInt sz = iFlowArray.Count(); |
|
99 for(TInt i=0; i < sz; i++) |
|
100 { |
|
101 if(iFlowArray[i].ScprId() == aScprId) |
|
102 { |
|
103 return &iFlowArray[i]; |
|
104 } |
|
105 } |
|
106 return 0; |
|
107 } |
|
108 |
|
109 CRtpProtocolIntf::~CRtpProtocolIntf() |
|
110 { |
|
111 iFlowArray.Close(); |
|
112 } |
|
113 |