• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* ------------------------------------------------------------------
2  * Copyright (C) 1998-2009 PacketVideo
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13  * express or implied.
14  * See the License for the specific language governing permissions
15  * and limitations under the License.
16  * -------------------------------------------------------------------
17  */
18 
19 #include "connect_test.h"
20 #include "tsc_h324m_config_interface.h"
21 #include "pvmp4h263encextension.h"
22 
23 
test()24 void connect_test::test()
25 {
26     fprintf(fileoutput, "Start %s test, num runs %d, proxy %d.\n", iRunTimerTest ? "timer configuration and encoder extension IF" : "connect", iMaxRuns, iUseProxy);
27     int error = 0;
28 
29     scheduler = OsclExecScheduler::Current();
30 
31     this->AddToScheduler();
32 
33     if (start_async_test())
34     {
35         OSCL_TRY(error, scheduler->StartScheduler());
36         if (error != 0)
37         {
38             OSCL_LEAVE(error);
39         }
40     }
41 
42     this->RemoveFromScheduler();
43 }
44 
45 
Run()46 void connect_test::Run()
47 {
48     if (terminal)
49     {
50         if (iUseProxy)
51         {
52             CPV2WayProxyFactory::DeleteTerminal(terminal);
53         }
54         else
55         {
56             CPV2WayEngineFactory::DeleteTerminal(terminal);
57         }
58         terminal = NULL;
59     }
60 
61     scheduler->StopScheduler();
62 }
63 
DoCancel()64 void connect_test::DoCancel()
65 {
66 }
67 
68 
HandleInformationalEvent(const PVAsyncInformationalEvent & aEvent)69 void connect_test::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent)
70 {
71 
72     switch (aEvent.GetEventType())
73     {
74         case PVT_INDICATION_DISCONNECT:
75             iAudioSourceAdded = false;
76             iVideoSourceAdded = false;
77             iAudioSinkAdded = false;
78             iVideoSinkAdded = false;
79             break;
80 
81         case PVT_INDICATION_INTERNAL_ERROR:
82             break;
83 
84         case PVT_INDICATION_INCOMING_TRACK:
85             printf("Incoming Indication\n");
86             break;
87 
88         default:
89             break;
90     }
91 }
92 
InitSucceeded()93 void connect_test::InitSucceeded()
94 {
95     i324mConfigInterface = iH324MConfig;
96     //OSCL_TRY(error, i324mIFCommandId = terminal->QueryInterface(h324mUuid, i324mConfigInterface,NULL));
97     if (i324mConfigInterface == NULL)
98     {
99         test_is_true(false);
100         reset();
101         return;
102 
103     }
104     // set some timers via the interface
105     H324MConfigInterface * i324Interface = (H324MConfigInterface *)i324mConfigInterface;
106     if (iRunTimerTest)
107     {
108         i324Interface->SetTimerCounter(EH324Timer, 1, 1, 10, NULL);
109         i324Interface->SetTimerCounter(EH324Counter, 4, 1, 10, NULL);
110     }
111     i324Interface->removeRef();
112     iStackIFSet = true;
113     int error;
114     PVUuid mp4h263EncUuid = PVMp4H263EncExtensionUUID;
115     OSCL_TRY(error, iEncoderIFCommandId = terminal->QueryInterface(mp4h263EncUuid, iMP4H263EncoderInterface, NULL));
116     if (error)
117     {
118         test_is_true(false);
119         reset();
120     }
121 }
122 
InitFailed()123 void connect_test::InitFailed()
124 {
125     test_is_true(false);
126     test_base::InitFailed();
127 }
128 
EncoderIFSucceeded()129 void connect_test::EncoderIFSucceeded()
130 {
131     PVUuid mp4h263EncUuid = PVMp4H263EncExtensionUUID;
132     PVMp4H263EncExtensionInterface *ptr = (PVMp4H263EncExtensionInterface *) iMP4H263EncoderInterface;
133     // Default frame rate is 5
134     ptr->SetOutputFrameRate(0, 4);
135     iMP4H263EncoderInterface->removeRef();
136     iEncoderIFSet = true;
137     connect();
138 }
139 
EncoderIFFailed()140 void connect_test::EncoderIFFailed()
141 {
142 //  test_is_true(false);
143     reset();
144 }
145 
ConnectFailed()146 void connect_test::ConnectFailed()
147 {
148     test_base::ConnectFailed();
149     disconnect();
150 }
151 
ConnectCancelled()152 void connect_test::ConnectCancelled()
153 {
154     ConnectFailed();
155 }
156 
DisCmdSucceeded()157 void connect_test::DisCmdSucceeded()
158 {
159     if (++iCurrentRun < iMaxRuns)
160     {
161         connect();
162     }
163     else
164     {
165         reset();
166     }
167     destroy_sink_source();
168 }
169 
DisCmdFailed()170 void connect_test::DisCmdFailed()
171 {
172     test_is_true(false);
173     reset();
174     // yep- this is how the code was.
175     if (++iCurrentRun < iMaxRuns)
176     {
177         connect();
178     }
179     else
180     {
181         reset();
182     }
183     destroy_sink_source();
184 }
185 
186 
187 
188 
189 
190 
191