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 #ifndef TEST_PV_AUTHOR_ENGINE_TESTSET6_H_INCLUDED
19 #include "test_pv_author_engine_testset6.h"
20 #endif
21
22 #ifndef PVMF_COMPOSER_SIZE_AND_DURATION_H_INCLUDED
23 #include "pvmf_composer_size_and_duration.h"
24 #endif
25
26 #ifndef PVMF_FILEOUTPUT_CONFIG_H_INCLUDED
27 #include "pvmf_fileoutput_config.h"
28 #endif
29
30 #ifndef PVMP4FFCN_CLIPCONFIG_H_INCLUDED
31 #include "pvmp4ffcn_clipconfig.h"
32 #endif
33
34 #ifndef PV_MP4_H263_ENC_EXTENSION_H_INCLUDED
35 #include "pvmp4h263encextension.h"
36 #endif
37
38 #ifndef PVAETEST_NODE_CONFIG_H_INCLUDED
39 #include "pvaetest_node_config.h"
40 #endif
41
42 #include "pvmf_media_data.h"
43 #include "pvmf_media_msg_format_ids.h"
StartTest()44 void pv_mediainput_async_test_errorhandling::StartTest()
45 {
46 AddToScheduler();
47 iState = PVAE_CMD_CREATE;
48 RunIfNotReady();
49 }
50
51 ////////////////////////////////////////////////////////////////////////////
HandleErrorEvent(const PVAsyncErrorEvent & aEvent)52 void pv_mediainput_async_test_errorhandling::HandleErrorEvent(const PVAsyncErrorEvent& aEvent)
53 {
54 OSCL_UNUSED_ARG(aEvent);
55 PVLOGGER_LOGMSG(PVLOGMSG_INST_REL, iLogger, PVLOGMSG_ERR, (0, "pv_mediainput_async_test_errorhandling::HandleErrorEvent"));
56 iState = PVAE_CMD_RESET;
57 RunIfNotReady();
58 }
59
60 ////////////////////////////////////////////////////////////////////////////
HandleInformationalEvent(const PVAsyncInformationalEvent & aEvent)61 void pv_mediainput_async_test_errorhandling::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent)
62 {
63 PVLOGGER_LOGMSG(PVLOGMSG_INST_REL, iLogger, PVLOGMSG_STACK_TRACE,
64 (0, "pv_mediainput_async_test_errorhandling::HandleInformationalEvent"));
65
66 switch (aEvent.GetEventType())
67 {
68 case PVMF_COMPOSER_EOS_REACHED:
69 //Engine already stopped at EOS so send reset command.
70 iState = PVAE_CMD_RESET;
71 Cancel();
72 RunIfNotReady();
73 PVLOGGER_LOGMSG(PVLOGMSG_INST_REL, iLogger, PVLOGMSG_STACK_TRACE,
74 (0, "pv_mediainput_async_test_errorhandling::HandleInformationalEvent: EOS reached"));
75
76 break;
77
78 default:
79 break;
80 }
81
82 }
83
84 ////////////////////////////////////////////////////////////////////////////
CreateTestInputs()85 bool pv_mediainput_async_test_errorhandling::CreateTestInputs()
86 {
87 int32 status = 0;
88 int32 error = 0;
89 iFileParser = NULL;
90 iFileServer.Connect();
91 if (iMediaInputType == PVMF_MIME_AVIFF)
92 {
93
94 OSCL_TRY(error, iFileParser = PVAviFile::CreateAviFileParser(iInputFileName, error, &iFileServer););
95
96 if (error || (NULL == iFileParser))
97 {
98 if (PVMediaInput_ErrorHandling_Test_WrongIPFileName == iTestErrorType)
99 {
100 PVPATB_TEST_IS_TRUE(true);
101 }
102 else
103 {
104 PVPATB_TEST_IS_TRUE(false);
105
106 }
107 if (iFileParser)
108 {
109 goto ERROR_CODE;
110 }
111 else
112 {
113 return false;
114 }
115 }
116
117 uint32 numStreams = ((PVAviFile*)iFileParser)->GetNumStreams();
118
119 iAddAudioMediaTrack = false;
120 iAddVideoMediaTrack = false;
121
122 for (uint32 ii = 0; ii < numStreams; ii++)
123 {
124 if (oscl_strstr(((PVAviFile*)iFileParser)->GetStreamMimeType(ii).get_cstr(), "audio"))
125 {
126 iAddAudioMediaTrack = true;
127 }
128
129 if (oscl_strstr(((PVAviFile*)iFileParser)->GetStreamMimeType(ii).get_cstr(), "video"))
130 {
131 iAddVideoMediaTrack = true;
132 }
133
134 }
135
136 }
137 else if (iMediaInputType == PVMF_MIME_WAVFF)
138 {
139 OSCL_TRY(error, iFileParser = OSCL_NEW(PV_Wav_Parser, ()););
140 if (error || (NULL == iFileParser))
141 {
142 return false;
143 }
144 if (((PV_Wav_Parser*)iFileParser)->InitWavParser(iInputFileName, &iFileServer) != PVWAVPARSER_OK)
145 {
146 goto ERROR_CODE;
147 }
148
149 iAddAudioMediaTrack = true;
150 iAddVideoMediaTrack = false;
151 }
152
153 {
154
155 PVMIOControlComp MIOComp(iMediaInputType, (OsclAny*)iFileParser, 0);
156
157 status = MIOComp.CreateMIOInputNode(false, iMediaInputType, iInputFileName);
158 if (status != PVMFSuccess)
159 {
160 PVLOGGER_LOGMSG(PVLOGMSG_INST_REL, iLogger, PVLOGMSG_ERR,
161 (0, "pv_mediainput_async_test_opencomposestop::CreateTestInputs: Error - CreateMIOInputNode failed"));
162
163 if (PVMediaInput_ErrorHandling_Test_WrongFormat == iTestErrorType)
164 {
165 PVPATB_TEST_IS_TRUE(true);
166 }
167
168 goto ERROR_CODE;
169 }
170
171 if (PVMediaInput_ErrorHandling_Test_WrongFormat == iTestErrorType)
172 {
173
174 PVPATB_TEST_IS_TRUE(false);
175 }
176
177 iMIOComponent = MIOComp;
178 if (!AddDataSource())
179 {
180 //delete any MIO Comp created.
181 MIOComp.DeleteInputNode();
182 goto ERROR_CODE;
183 }
184
185 return true;
186 }
187
188 ERROR_CODE:
189 {
190
191 //remove file parser
192 if (iMediaInputType == PVMF_MIME_AVIFF)
193 {
194 PVAviFile* fileparser = OSCL_STATIC_CAST(PVAviFile*, iFileParser);
195 PVAviFile::DeleteAviFileParser(fileparser);
196 fileparser = NULL;
197 iFileParser = NULL;
198 }
199 else if (iMediaInputType == PVMF_MIME_WAVFF)
200 {
201 PV_Wav_Parser* fileparser = OSCL_STATIC_CAST(PV_Wav_Parser*, iFileParser);
202 delete(fileparser);
203 fileparser = NULL;
204 iFileParser = NULL;
205 }
206
207 return false;
208 }
209 }
210
211 ////////////////////////////////////////////////////////////////////////////
AddDataSource()212 bool pv_mediainput_async_test_errorhandling::AddDataSource()
213 {
214 int32 err = 0;
215 uint32 noOfNodes = iMIOComponent.iMIONode.size();
216 OSCL_TRY(err,
217 for (uint32 ii = 0; ii < noOfNodes; ii++)
218 {
219 AddEngineCommand();
220
221 //OSCL_TRY(err, iAuthor->AddDataSource(*(iMIOComponent.iMIONode[ii]), (OsclAny*)iAuthor););
222 iAuthor->AddDataSource(*(iMIOComponent.iMIONode[ii]), (OsclAny*)iAuthor);
223 }
224 );
225
226
227 if (err != OSCL_ERR_NONE)
228 {
229 PVLOGGER_LOGMSG(PVLOGMSG_INST_REL, iLogger, PVLOGMSG_ERR,
230 (0, "pvauthor_async_test_miscellaneous::AddDataSource: Error - iAuthor->AddDataSource failed. err=0x%x", err));
231
232 iMIOComponent.DeleteInputNode();
233 return false;
234 }
235
236 return true;
237 }
238
239 ////////////////////////////////////////////////////////////////////////////
ConfigComposer()240 bool pv_mediainput_async_test_errorhandling::ConfigComposer()
241 {
242 if (!ConfigOutputFile())
243 {
244 PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_ERR,
245 (0, "pv_mediainput_async_test_errorhandling::ConfigComposer: Error - ConfigOutputFile failed"));
246
247 return false;
248 }
249
250 if ((oscl_strstr(iComposerMimeType.get_str(), "mp4")) || (oscl_strstr(iComposerMimeType.get_str(), "3gp")))
251 {
252 if (!ConfigMp43gpComposer())
253 {
254 PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_ERR,
255 (0, "pv_mediainput_async_test_errorhandling::ConfigComposer: Error - ConfigMp43gpComposer failed"));
256
257 return false;
258 }
259 }
260
261 return true;
262 }
263
264 ////////////////////////////////////////////////////////////////////////////
ConfigOutputFile()265 bool pv_mediainput_async_test_errorhandling::ConfigOutputFile()
266 {
267
268 PvmfFileOutputNodeConfigInterface* clipConfig = OSCL_STATIC_CAST(PvmfFileOutputNodeConfigInterface*, iComposerConfig);
269 if (!clipConfig)
270 {
271 PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_ERR,
272 (0, "pv_mediainput_async_test_errorhandling::ConfigOutputFile: Error - Invalid iComposerConfig"));
273
274 return false;
275 }
276
277 if (clipConfig->SetOutputFileName(iOutputFileName) != PVMFSuccess)
278 {
279 PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_ERR,
280 (0, "pv_mediainput_async_test_errorhandling::ConfigOutputFile: Error - SetOutputFileName failed"));
281
282 return false;
283 }
284
285 return true;
286 }
287
288 ////////////////////////////////////////////////////////////////////////////
ConfigMp43gpComposer()289 bool pv_mediainput_async_test_errorhandling::ConfigMp43gpComposer()
290 {
291
292 PVMp4FFCNClipConfigInterface* clipConfig;
293 clipConfig = OSCL_STATIC_CAST(PVMp4FFCNClipConfigInterface*, iComposerConfig);
294 if (!clipConfig)
295 {
296 PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_ERR,
297 (0, "pv_mediainput_async_test_errorhandling::ConfigMp43gpComposer: Error - iComposerConfig==NULL"));
298
299 return false;
300 }
301
302 OSCL_wHeapString<OsclMemAllocator> versionString = _STRLIT("version");
303 OSCL_wHeapString<OsclMemAllocator> titleString = _STRLIT("title");
304 OSCL_wHeapString<OsclMemAllocator> authorString = _STRLIT("author");
305 OSCL_wHeapString<OsclMemAllocator> copyrightString = _STRLIT("copyright");
306 OSCL_wHeapString<OsclMemAllocator> descriptionString = _STRLIT("description");
307 OSCL_wHeapString<OsclMemAllocator> ratingString = _STRLIT("rating");
308 OSCL_wHeapString<OsclMemAllocator> iAlbumTitle = _STRLIT("albumtitle");
309 uint16 iRecordingYear = 2008;
310 OSCL_HeapString<OsclMemAllocator> lang_code = "eng";
311
312 clipConfig->SetOutputFileName(iOutputFileName);
313 clipConfig->SetPresentationTimescale(1000);
314 clipConfig->SetVersion(versionString, lang_code);
315 clipConfig->SetTitle(titleString, lang_code);
316 clipConfig->SetAuthor(authorString, lang_code);
317 clipConfig->SetCopyright(copyrightString, lang_code);
318 clipConfig->SetDescription(descriptionString, lang_code);
319 clipConfig->SetRating(ratingString, lang_code);
320 clipConfig->SetAlbumInfo(iAlbumTitle, lang_code);
321 clipConfig->SetRecordingYear(iRecordingYear);
322
323
324 return true;
325 }
326
327 ////////////////////////////////////////////////////////////////////////////
AddMediaTrack()328 bool pv_mediainput_async_test_errorhandling::AddMediaTrack()
329 {
330 PVMIOControlComp MIOComp;
331
332 if (iAddAudioMediaTrack)
333 {
334 if (iMediaInputType == PVMF_MIME_AVIFF)
335 {
336 Oscl_Vector<uint32, OsclMemAllocator> audioStrNum;
337
338 audioStrNum = (iMIOComponent.iPVAviFile)->GetAudioStreamCountList();
339
340 if (audioStrNum.size() == 0)
341 {
342 return false;
343 }
344
345 iAuthor->AddMediaTrack(*(iMIOComponent.iMIONode[audioStrNum[0]]), iAudioEncoderMimeType,
346 iComposer, iAudioEncoderConfig, (OsclAny*)iAuthor);
347
348 AddEngineCommand();
349
350 }
351 else if (iMediaInputType == PVMF_MIME_WAVFF)
352 {
353 PVWAVFileInfo wavFileInfo;
354 (iMIOComponent.iPVWavFile)->RetrieveFileInfo(wavFileInfo);
355
356
357 iAuthor->AddMediaTrack(*(iMIOComponent.iMIONode[0]), iAudioEncoderMimeType,
358 iComposer, iAudioEncoderConfig, (OsclAny*)iAuthor);
359
360 AddEngineCommand();
361
362
363 }
364
365 }
366
367 if (iAddVideoMediaTrack)
368 {
369 if (iMediaInputType == PVMF_MIME_AVIFF)
370 {
371 Oscl_Vector<uint32, OsclMemAllocator> vidStrNum;
372 vidStrNum = (iMIOComponent.iPVAviFile)->GetVideoStreamCountList();
373
374 if (vidStrNum.size() == 0)
375 {
376 return false;
377 }
378
379 iAuthor->AddMediaTrack(*(iMIOComponent.iMIONode[vidStrNum[0]]), iVideoEncoderMimeType,
380 iComposer, iVideoEncoderConfig, (OsclAny*)iAuthor);
381
382 AddEngineCommand();
383
384 }
385 else if (iMediaInputType == PVMF_MIME_WAVFF)
386 {
387 return false;
388 }
389
390 }
391
392 return true;
393 }
394
395 ////////////////////////////////////////////////////////////////////////////
ConfigureVideoEncoder()396 bool pv_mediainput_async_test_errorhandling::ConfigureVideoEncoder()
397 {
398
399 PVMp4H263EncExtensionInterface* config;
400 config = OSCL_STATIC_CAST(PVMp4H263EncExtensionInterface*, iVideoEncoderConfig);
401 if (!config)
402 {
403 PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG,
404 (0, "pv_mediainput_async_test_errorhandling::ConfigureVideoEncoder: No configuration needed"));
405
406 return true;
407 }
408
409 uint32 width = 0;
410 uint32 height = 0;
411 OsclFloat frameRate = 0;
412 uint32 frameInterval = 0;
413
414 if (iMediaInputType == PVMF_MIME_AVIFF)
415 {
416 Oscl_Vector<uint32, OsclMemAllocator> vidStrNum =
417 (iMIOComponent.iPVAviFile)->GetVideoStreamCountList();
418
419 width = (iMIOComponent.iPVAviFile)->GetWidth(vidStrNum[0]);
420 bool orient = false;
421 height = (iMIOComponent.iPVAviFile)->GetHeight(orient, vidStrNum[0]);
422 frameRate = (iMIOComponent.iPVAviFile)->GetFrameRate(vidStrNum[0]);
423 frameInterval = (iMIOComponent.iPVAviFile)->GetFrameDuration();
424
425 }
426
427 config->SetNumLayers(KNumLayers);
428 config->SetOutputBitRate(0, KVideoBitrate);
429 config->SetOutputFrameSize(0, width , height);
430 config->SetOutputFrameRate(0, frameRate);
431 config->SetIFrameInterval(KVideoIFrameInterval);
432 config->SetSceneDetection(true);
433
434 return true;
435 }
436
ConfigureAudioEncoder()437 bool pv_mediainput_async_test_errorhandling::ConfigureAudioEncoder()
438 {
439
440 PVAudioEncExtensionInterface* config;
441 config = OSCL_STATIC_CAST(PVAudioEncExtensionInterface*, iAudioEncoderConfig);
442 if (!config)
443 {
444 PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG,
445 (0, "pv_mediainput_async_test_errorhandling::Encoder: No configuration needed"));
446
447 return true;
448 }
449
450 if (!PVAETestNodeConfig::ConfigureAudioEncoder(iAudioEncoderConfig, iAudioEncoderMimeType))
451 {
452 return false;
453 }
454 return true;
455 }
456 ////////////////////////////////////////////////////////////////////////////
ResetAuthorConfig()457 void pv_mediainput_async_test_errorhandling::ResetAuthorConfig()
458 {
459 if (iComposerConfig)
460 {
461 iComposerConfig->removeRef();
462 iComposerConfig = NULL;
463 }
464 if (iAudioEncoderConfig)
465 {
466 iAudioEncoderConfig->removeRef();
467 iAudioEncoderConfig = NULL;
468 }
469 if (iVideoEncoderConfig)
470 {
471 iVideoEncoderConfig->removeRef();
472 iVideoEncoderConfig = NULL;
473 }
474 }
475
476 ////////////////////////////////////////////////////////////////////////////
Cleanup()477 void pv_mediainput_async_test_errorhandling::Cleanup()
478 {
479 PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "pv_mediainput_async_test_errorhandling::Cleanup"));
480
481 iComposer = NULL;
482
483 ResetAuthorConfig();
484
485 if (iAuthor)
486 {
487 PVAuthorEngineFactory::DeleteAuthor(iAuthor);
488 iAuthor = NULL;
489 }
490
491 // iMIOComponent.DeleteInputNode();
492 iOutputFileName = NULL;
493 iFileServer.Close();
494 }
495
496
497 ////////////////////////////////////////////////////////////////////////////
Run()498 void pv_mediainput_async_test_errorhandling::Run()
499 {
500 if (IsEngineCmdPending())
501 {
502 return;
503 }
504 iCheckState = iState;
505 switch (iState)
506 {
507 case PVAE_CMD_CREATE:
508 {
509 PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG,
510 (0, "******pv_mediainput_async_test_errorhandling::iTestCaseNum:%d******", iTestCaseNum));
511
512 iAuthor = PVAuthorEngineFactory::CreateAuthor(this, this, this);
513 if (!iAuthor)
514 {
515 PVPATB_TEST_IS_TRUE(false);
516 iState = PVAE_CMD_CLEANUPANDCOMPLETE;
517 RunIfNotReady();
518
519 }
520 else
521 {
522 iState = PVAE_CMD_OPEN;
523 RunIfNotReady();
524 }
525 }
526 break;
527
528 case PVAE_CMD_OPEN:
529 {
530 iAuthor->Open((OsclAny*)iAuthor);
531 }
532 break;
533
534 case PVAE_CMD_ADD_DATA_SOURCE:
535 {
536 bool aStatus = CreateTestInputs();
537 if (aStatus == 0) //Failed while creating test input
538 {
539 PVLOGGER_LOGMSG(PVLOGMSG_INST_REL, iLogger, PVLOGMSG_ERR,
540 (0, "pv_mediainput_async_test_errorhandling::CreateTestInputs: Error - failed"));
541
542 iState = PVAE_CMD_CLEANUPANDCOMPLETE;
543 RunIfNotReady();
544 }
545 }
546 break;
547
548 case PVAE_CMD_SELECT_COMPOSER:
549 {
550 iAuthor->SelectComposer(iComposerMimeType, iComposerConfig,
551 (OsclAny*)iAuthor);
552 }
553 break;
554
555 case PVAE_CMD_ADD_MEDIA_TRACK:
556 {
557 if (!AddMediaTrack())
558 {
559 PVLOGGER_LOGMSG(PVLOGMSG_INST_REL, iLogger, PVLOGMSG_ERR,
560 (0, "pv_mediainput_async_test_opencomposestop::AddMediaTrack Error - No track added"));
561 PVPATB_TEST_IS_TRUE(false);
562 iState = PVAE_CMD_REMOVE_DATA_SOURCE;
563 RunIfNotReady();
564 }
565 }
566 break;
567
568 case PVAE_CMD_INIT:
569 {
570 iAuthor->Init((OsclAny*)iAuthor);
571 }
572 break;
573
574 case PVAE_CMD_QUERY_INTERFACE1:
575 iAuthor->QueryInterface(PVMI_CAPABILITY_AND_CONFIG_PVUUID,
576 (PVInterface*&)iAuthorCapConfigIF,
577 (OsclAny*)iAuthor);
578 break;
579
580 case PVAE_CMD_CAPCONFIG_SYNC1:
581 CapConfigSync1();
582 iState = PVAE_CMD_START;
583 RunIfNotReady();
584 break;
585
586 case PVAE_CMD_QUERY_INTERFACE_COMP:
587 iAuthor->QueryInterface(PvmfComposerSizeAndDurationUuid,
588 iOutputSizeAndDurationConfig, (OsclAny*)iAuthor);
589 break;
590 case PVAE_CMD_START:
591 {
592 iAuthor->Start();
593 }
594 break;
595
596 case PVAE_CMD_STOP:
597 {
598 PVLOGGER_LOGMSG(PVLOGMSG_INST_REL, iLogger, PVLOGMSG_ERR,
599 (0, "pv_mediainput_async_test_errorhandling::Run: Command Stop"));
600
601 fprintf(iFile, "Error: Recording timeout, stop engine please wait *******\n");
602 iAuthor->Stop((OsclAny*)iAuthor);
603 PVLOGGER_LOGMSG(PVLOGMSG_INST_REL, iLogger, PVLOGMSG_ERR,
604 (0, "pv_mediainput_async_test_errorhandling::Run: Error: Recording timeout, stop engine please wait *******\n"));
605 }
606 break;
607
608 case PVAE_CMD_RESET:
609 {
610 ResetAuthorConfig();
611 if (iAuthor->GetPVAuthorState() != PVAE_STATE_IDLE)
612 {
613 iAuthor->Reset((OsclAny*)iAuthor);
614 }
615 }
616 break;
617
618 case PVAE_CMD_REMOVE_DATA_SOURCE:
619 {
620 for (uint32 ii = 0; ii < iMIOComponent.iMIONode.size(); ii++)
621 {
622 iAuthor->RemoveDataSource(*(iMIOComponent.iMIONode[ii]), (OsclAny*)iAuthor);
623 AddEngineCommand();
624 }
625 }
626 break;
627
628 case PVAE_CMD_CLOSE:
629 {
630 iAuthor->Close((OsclAny*)iAuthor);
631 }
632 break;
633
634 case PVAE_CMD_PAUSE:
635 {
636 iAuthor->Pause((OsclAny*)iAuthor);
637 }
638 break;
639
640 case PVAE_CMD_RESUME:
641 {
642 iAuthor->Resume((OsclAny*)iAuthor);
643 }
644 break;
645
646 case PVAE_CMD_CLEANUPANDCOMPLETE:
647 {
648 Cleanup();
649 iObserver->CompleteTest(*iTestCase);
650 }
651 break;
652
653
654 case PVAE_CMD_ADD_DATA_SINK:
655 case PVAE_CMD_REMOVE_DATA_SINK:
656 break;
657
658 case PVAE_CMD_RECORDING:
659 {
660 iState = PVAE_CMD_RESET;
661 RunIfNotReady(iTestDuration);
662 }
663 break;
664
665 default:
666 break;
667 } //end switch
668 }
669
670 ////////////////////////////////////////////////////////////////////////////
CommandCompleted(const PVCmdResponse & aResponse)671 void pv_mediainput_async_test_errorhandling::CommandCompleted(const PVCmdResponse& aResponse)
672 {
673 PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
674 (0, "pv_mediainput_async_test_errorhandling::CommandCompleted iState:%d", iState));
675
676 if (aResponse.GetCmdStatus() != PVMFSuccess)
677 {
678 PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
679 (0, "pv_mediainput_async_test_errorhandling::CommandCompleted iState:%d FAILED", iState));
680 }
681
682 /* This check is done in order to verify that the response from the engine
683 is for the current command or for any other previously issued asynchronous command
684 */
685 if (iCheckState != iState) // Current command and the response state doesn't match
686 {
687 // fprintf(iFile, "ERROR: The current state and the response's state doesn't match *******\n");
688 return;
689 }
690 switch (iState)
691 {
692 case PVAE_CMD_OPEN:
693 {
694 if (aResponse.GetCmdStatus() == PVMFSuccess)
695 {
696 iState = PVAE_CMD_ADD_DATA_SOURCE;
697 RunIfNotReady();
698 }
699 else
700 {
701 // Open failed
702 PVPATB_TEST_IS_TRUE(false);
703 iState = PVAE_CMD_RESET;
704 RunIfNotReady();
705 }
706 }
707 break;
708
709 case PVAE_CMD_ADD_DATA_SOURCE:
710 {
711 if (EngineCmdComplete())
712 {
713 iState = PVAE_CMD_SELECT_COMPOSER;
714 }
715
716 if (aResponse.GetCmdStatus() == PVMFSuccess)
717 {
718 RunIfNotReady();
719 }
720 else
721 {
722 // AddDataSource failed
723 PVPATB_TEST_IS_TRUE(false);
724 iState = PVAE_CMD_RESET;
725 RunIfNotReady();
726 }
727 }
728 break;
729
730 case PVAE_CMD_SELECT_COMPOSER:
731 {
732 if (aResponse.GetCmdStatus() == PVMFSuccess)
733 {
734 iComposer = aResponse.GetResponseData();
735 if (!ConfigComposer())
736 {
737 PVLOGGER_LOGMSG(PVLOGMSG_INST_REL, iLogger, PVLOGMSG_ERR,
738 (0, "pv_mediainput_async_test_errorhandling::CommandCompleted: Error - ConfigComposer failed"));
739
740 PVPATB_TEST_IS_TRUE(true);
741 iState = PVAE_CMD_RESET;
742 RunIfNotReady();
743 }
744 else
745 {
746 iState = PVAE_CMD_ADD_MEDIA_TRACK;
747 RunIfNotReady();
748 }
749 }
750 else
751 {
752 // SelectComposer failed
753 PVPATB_TEST_IS_TRUE(false);
754 iState = PVAE_CMD_RESET;
755 RunIfNotReady();
756 }
757 }
758 break;
759
760 case PVAE_CMD_ADD_MEDIA_TRACK:
761 {
762 if (EngineCmdComplete())
763 {
764 if (iAddVideoMediaTrack)
765 {
766 ConfigureVideoEncoder();
767 }
768 if (iAddAudioMediaTrack)
769 {
770 ConfigureAudioEncoder();
771 }
772 iState = PVAE_CMD_INIT;
773 }
774
775 if (aResponse.GetCmdStatus() == PVMFSuccess)
776 {
777 RunIfNotReady();
778 }
779 else
780 {
781 // AddMediaTrack failed
782 PVPATB_TEST_IS_TRUE(false);
783 iState = PVAE_CMD_RESET;
784 RunIfNotReady();
785 }
786 }
787 break;
788
789 case PVAE_CMD_INIT:
790 {
791 if (aResponse.GetCmdStatus() == PVMFSuccess)
792 {
793 iState = PVAE_CMD_QUERY_INTERFACE_COMP;
794 RunIfNotReady();
795 }
796 else
797 {
798 // Init failed
799 PVPATB_TEST_IS_TRUE(true);
800 iState = PVAE_CMD_RESET;
801 RunIfNotReady();
802 }
803 }
804 break;
805 case PVAE_CMD_QUERY_INTERFACE_COMP:
806 {
807 if (aResponse.GetCmdStatus() == PVMFSuccess)
808 {
809 ConfigMp4Composer();
810 iState = PVAE_CMD_QUERY_INTERFACE1;
811 RunIfNotReady();
812 }
813 else
814 {
815 PVPATB_TEST_IS_TRUE(false);
816 iState = PVAE_CMD_RESET;
817 RunIfNotReady();
818 }
819 }
820 break;
821 case PVAE_CMD_QUERY_INTERFACE1:
822 {
823 if (aResponse.GetCmdStatus() == PVMFSuccess)
824 {
825 iState = PVAE_CMD_CAPCONFIG_SYNC1;
826 RunIfNotReady();
827 }
828 else
829 {
830 PVPATB_TEST_IS_TRUE(false);
831 iState = PVAE_CMD_RESET;
832 RunIfNotReady();
833 }
834 }
835 break;
836
837 case PVAE_CMD_START:
838 {
839 if (aResponse.GetCmdStatus() == PVMFSuccess)
840 {
841 if (iPauseResumeEnable)
842 {
843 iState = PVAE_CMD_PAUSE;
844 RunIfNotReady();
845 }
846 else
847 {
848 iState = PVAE_CMD_RECORDING;
849 RunIfNotReady();
850 }
851 }
852 else
853 {
854 // Start failed
855 if (ErrorHandling_MediaInputNodeStopFailed != iTestErrorType)
856 {
857 PVPATB_TEST_IS_TRUE(true);
858 }
859 else
860 {
861 PVPATB_TEST_IS_TRUE(false);
862 }
863
864 iState = PVAE_CMD_RESET;
865 RunIfNotReady();
866 }
867 }
868 break;
869
870 case PVAE_CMD_PAUSE:
871 {
872 if (aResponse.GetCmdStatus() == PVMFSuccess)
873 {
874 iState = PVAE_CMD_RESUME;
875 /* Stay paused for 10 seconds */
876 RunIfNotReady(10*1000*1000);
877 }
878 else
879 {
880 // Pause failed
881 if ((ErrorHandling_MediaInputNode_StateFailure_EPause_SendMIORequest == iTestErrorType) ||
882 (ErrorHandling_MediaInputNode_Node_Cmd_Pause == iTestErrorType) ||
883 (ErrorHandling_MP4Composer_Node_Cmd_Pause == iTestErrorType) ||
884 (ErrorHandling_VideoEncodeNode_Node_Cmd_Pause == iTestErrorType) ||
885 (ErrorHandling_AudioEncodeNode_Node_Cmd_Pause == iTestErrorType) ||
886 (ErrorHandling_AVCEncodeNode_Node_Cmd_Pause == iTestErrorType))
887 {
888 PVPATB_TEST_IS_TRUE(true);
889 }
890 else
891 {
892 //Pause failed
893 PVPATB_TEST_IS_TRUE(false);
894 }
895 iState = PVAE_CMD_RESET;
896 RunIfNotReady();
897 }
898 }
899 break;
900
901 case PVAE_CMD_RESUME:
902 {
903 if (aResponse.GetCmdStatus() == PVMFSuccess)
904 {
905 iState = PVAE_CMD_STOP;
906
907 //Run for another 10 sec before stopping
908 RunIfNotReady(10*1000*1000);
909 }
910 else
911 {
912 //Resume failed
913 Cancel();
914 PVPATB_TEST_IS_TRUE(false);
915 iState = PVAE_CMD_RESET;
916 RunIfNotReady();
917 }
918 }
919 break;
920
921 case PVAE_CMD_STOP:
922 {
923 if (aResponse.GetCmdStatus() == PVMFSuccess)
924 {
925 iOutputFileName = NULL;
926 iState = PVAE_CMD_RESET;
927 RunIfNotReady();
928 }
929 else
930 {
931 // Stop failed
932 if (ErrorHandling_MediaInputNodeStopFailed == iTestErrorType)
933
934 {
935 PVPATB_TEST_IS_TRUE(true);
936 }
937 else
938 {
939 PVPATB_TEST_IS_TRUE(false);
940 }
941
942 iState = PVAE_CMD_RESET;
943 RunIfNotReady();
944 }
945 }
946 break;
947
948 case PVAE_CMD_RESET:
949 {
950 if (aResponse.GetCmdStatus() == PVMFSuccess)
951 {
952 if ((iMIOComponent.iMediaInput.size() == 0) || (iMIOComponent.iMIONode.size() == 0))
953 {
954 if (aResponse.GetCmdStatus() == PVMFSuccess)
955 {
956 PVPATB_TEST_IS_TRUE(true);
957 }
958 else
959 {
960 PVPATB_TEST_IS_TRUE(false);
961
962 }
963 //Since there are no MIO Components/Nodes, we end here
964 //No need to call RemoveDataSource
965 iObserver->CompleteTest(*iTestCase);
966 break;
967 }
968
969 iState = PVAE_CMD_REMOVE_DATA_SOURCE;
970 RunIfNotReady();
971
972 }
973 else
974 {
975 if ((ErrorHandling_VideoEncodeNode_Node_Cmd_Stop == iTestErrorType) ||
976 (ErrorHandling_AudioEncodeNode_Node_Cmd_Stop == iTestErrorType) ||
977 (ErrorHandling_AVCEncodeNode_Node_Cmd_Stop == iTestErrorType) ||
978 (ErrorHandling_MediaInputNode_Node_Cmd_Stop == iTestErrorType) ||
979 (ErrorHandling_MediaInputNodeStopFailed == iTestErrorType))
980 {
981 PVPATB_TEST_IS_TRUE(true);
982 }
983 else
984 {
985 // Reset failed
986 PVPATB_TEST_IS_TRUE(false);
987 OSCL_ASSERT("ERROR -- Response failure for CMD_RESET");
988 iState = PVAE_CMD_REMOVE_DATA_SOURCE;
989 RunIfNotReady();
990 }
991 }
992 }
993 break;
994
995 case PVAE_CMD_REMOVE_DATA_SOURCE:
996 {
997 if (aResponse.GetCmdStatus() == PVMFSuccess)
998 {
999 if (EngineCmdComplete())
1000 {
1001 RemoveMIOComp();
1002 iState = PVAE_CMD_CLOSE;
1003 RunIfNotReady();
1004
1005 }
1006 else
1007 {
1008 return; //wait for completion of all RemoveDataSource calls.
1009 }
1010 }
1011 else
1012 {
1013 // RemoveDataSource failed
1014 PVPATB_TEST_IS_TRUE(false);
1015 RemoveMIOComp();
1016 iObserver->CompleteTest(*iTestCase);
1017 }
1018 }
1019 break;
1020
1021 case PVAE_CMD_CLOSE:
1022 {
1023 if (aResponse.GetCmdStatus() == PVMFSuccess)
1024 {
1025 PVPATB_TEST_IS_TRUE(true);
1026 }
1027 else
1028 {
1029 PVPATB_TEST_IS_TRUE(false);
1030 }
1031 iObserver->CompleteTest(*iTestCase);
1032 }
1033 break;
1034
1035 default:
1036 {
1037 // Testing error if this is reached
1038 PVPATB_TEST_IS_TRUE(false);
1039 iObserver->CompleteTest(*iTestCase);
1040 }
1041 break;
1042 } //end switch
1043 }
1044
RemoveMIOComp()1045 void pv_mediainput_async_test_errorhandling::RemoveMIOComp()
1046 {
1047 iOutputFileName = NULL;
1048 iMIOComponent.DeleteInputNode();
1049 if (iMediaInputType == PVMF_MIME_AVIFF)
1050 {
1051 PVAviFile* fileparser = OSCL_STATIC_CAST(PVAviFile*, iFileParser);
1052 PVAviFile::DeleteAviFileParser(fileparser);
1053 fileparser = NULL;
1054 iFileParser = NULL;
1055 }
1056 else if (iMediaInputType == PVMF_MIME_WAVFF)
1057 {
1058 PV_Wav_Parser* fileparser = OSCL_STATIC_CAST(PV_Wav_Parser*, iFileParser);
1059 delete(fileparser);
1060 fileparser = NULL;
1061 iFileParser = NULL;
1062 }
1063
1064 iFileParser = NULL;
1065 }
1066
CapConfigSync1()1067 bool pv_mediainput_async_test_errorhandling::CapConfigSync1()
1068 {
1069 // set the mime strings here
1070 // capabilty and configuration feature implemented here
1071 // set the config parameters using MIME strings here
1072
1073 OSCL_StackString<64> paramkey;
1074 // KVP array
1075 PvmiKvp paramkvp;
1076 paramkvp.value.bool_value = true;
1077 key_type* key = NULL;
1078 key = (key_type*)oscl_malloc(sizeof(key_type));
1079 if (ErrorHandling_VideoInitFailed == iTestErrorType) //To fail VideoEncNode Initialize
1080 {
1081 paramkey = _STRLIT_CHAR("x-pvmf/encoder/video/error_start_init;valtype=bool");
1082 }
1083 else if (ErrorHandling_ComposerAddFragFailed == iTestErrorType) //To fail Mp4ComposerNode on AddMemFragToTrack
1084 {
1085 paramkey = _STRLIT_CHAR("x-pvmf/composer/mp4/error_start_addmemfrag;valtype=bool");
1086 }
1087 else if (ErrorHandling_ComposerAddTrackFailed == iTestErrorType) //To fail Mp4ComposerNode on AddTrack
1088 {
1089 paramkey = _STRLIT_CHAR("x-pvmf/composer/mp4/error_start_addtrack;valtype=bool");
1090 }
1091 else if (ErrorHandling_MediaInputNodeStartFailed == iTestErrorType) //To fail MediaInputNode on Start
1092 {
1093 paramkey = _STRLIT_CHAR("x-pvmf/datasource/error_adddatasource_start;valtype=bool");
1094 }
1095 else if (ErrorHandling_MediaInputNodeStopFailed == iTestErrorType) //To fail MediaInputNode on Stop
1096 {
1097 paramkey = _STRLIT_CHAR("x-pvmf/datasource/error_adddatasource_stop;valtype=bool");
1098 }
1099 else if (ErrorHandling_AudioInitFailed == iTestErrorType)
1100 {
1101 paramkey = _STRLIT_CHAR("x-pvmf/encoder/audio/error_start_init;valtype=bool");
1102 }
1103 else if ((ErrorHandling_AVCVideoEncodeFailed == iTestErrorType)) //To fail AVCEncNode on Encode
1104 {
1105 paramkey = _STRLIT_CHAR("x-pvmf/encoder/video/error-encode;mode=frames;valtype=uint32");
1106 paramkvp.value.uint32_value = 1;
1107
1108 }
1109 else if (ErrorHandling_VideoEncodeFailed == iTestErrorType)
1110 {
1111 paramkey = _STRLIT_CHAR("x-pvmf/encoder/video/error-encode;mode=frames;valtype=uint32");
1112 paramkvp.value.uint32_value = 1;
1113
1114 }
1115 else if (ErrorHandling_AudioEncodeFailed == iTestErrorType)
1116 {
1117 paramkey = _STRLIT_CHAR("x-pvmf/encoder/audio/error-encode;mode=frames;valtype=uint32");
1118 paramkvp.value.uint32_value = 1;
1119
1120 }
1121 else if ((ErrorHandling_AVCVideoEncode5FramesFailed == iTestErrorType)) //To fail AVCEncNode on Encode 5 frames
1122
1123 {
1124 paramkey = _STRLIT_CHAR("x-pvmf/encoder/video/error-encode;mode=frames;valtype=uint32");
1125 paramkvp.value.uint32_value = 5;
1126 }
1127 else if (ErrorHandling_VideoEncode5FramesFailed == iTestErrorType)
1128 {
1129 paramkey = _STRLIT_CHAR("x-pvmf/encoder/video/error-encode;mode=frames;valtype=uint32");
1130 paramkvp.value.uint32_value = 5;
1131
1132 }
1133 else if (ErrorHandling_MediaInputNode_NoMemBuffer == iTestErrorType)
1134 {
1135 paramkey = _STRLIT_CHAR("x-pvmf/datasource/error_no_memorybuffer_avaliable;valtype=bool");
1136 }
1137 else if (ErrorHandling_MediaInputNode_Out_Queue_busy == iTestErrorType)
1138 {
1139 paramkey = _STRLIT_CHAR("x-pvmf/datasource/error_out_queue_busy;valtype=bool");
1140 }
1141 else if (ErrorHandling_MediaInputNode_large_time_stamp == iTestErrorType)
1142 {
1143
1144 paramkey = _STRLIT_CHAR("x-pvmf/datasource/error-time-stamp;valtype=ksv");
1145
1146 uint32 numStreams = ((PVAviFile*)iFileParser)->GetNumStreams();
1147
1148 key->mode = 1;
1149 key->duration = 0;
1150 key->track_no = numStreams - 1;
1151
1152 paramkvp.value.key_specific_value = OSCL_DYNAMIC_CAST(void*, key);
1153 }
1154 else if (ErrorHandling_MediaInputNode_wrong_time_stamp_after_duration == iTestErrorType)
1155 {
1156
1157 paramkey = _STRLIT_CHAR("x-pvmf/datasource/error-time-stamp;valtype=ksv");
1158
1159 uint32 numStreams = ((PVAviFile*)iFileParser)->GetNumStreams();
1160
1161 key->mode = 2;
1162 key->duration = 60;
1163 key->track_no = numStreams - 1;
1164
1165 paramkvp.value.key_specific_value = OSCL_DYNAMIC_CAST(void*, key);
1166 }
1167
1168 else if (ErrorHandling_MediaInputNode_zero_time_stamp == iTestErrorType)
1169 {
1170
1171 paramkey = _STRLIT_CHAR("x-pvmf/datasource/error-time-stamp;valtype=ksv");
1172
1173 uint32 numStreams = ((PVAviFile*)iFileParser)->GetNumStreams();
1174
1175 key->mode = 3;
1176 key->duration = 0;
1177 key->track_no = numStreams - 1;
1178
1179 paramkvp.value.key_specific_value = OSCL_DYNAMIC_CAST(void*, key);
1180 }
1181
1182 else if (ErrorHandling_MediaInputNode_StateFailure_EPause_SendMIORequest == iTestErrorType)
1183 {
1184 paramkey = _STRLIT_CHAR("x-pvmf/datasource/error-sendmiorequest;valtype=uint32");
1185 paramkvp.value.uint32_value = 2;
1186 iPauseResumeEnable = true;
1187 }
1188 else if (ErrorHandling_MediaInputNode_StateFailure_CancelMIORequest == iTestErrorType)
1189 {
1190 paramkey = _STRLIT_CHAR("x-pvmf/datasource/error-cancelmiorequest;valtype=bool");
1191 }
1192 else if (ErrorHandling_MediaInputNode_Corrupt_Video_InputData == iTestErrorType)
1193 {
1194 paramkey = _STRLIT_CHAR("x-pvmf/datasource/error-corruptinputdata;index=0;valtype=uint32");
1195 paramkvp.value.uint32_value = 100;
1196 }
1197 else if (ErrorHandling_MediaInputNode_Corrupt_Audio_InputData == iTestErrorType)
1198 {
1199 paramkey = _STRLIT_CHAR("x-pvmf/datasource/error-corruptinputdata;index=1;valtype=uint32");
1200 paramkvp.value.uint32_value = 100;
1201 }
1202 else if (ErrorHandling_MediaInputNode_Node_Cmd_Start == iTestErrorType)
1203 {
1204 paramkey = _STRLIT_CHAR("x-pvmf/datasource/error-node-cmd;index=2;valtype=uint32");
1205 paramkvp.value.uint32_value = 2;
1206 }
1207 else if (ErrorHandling_MediaInputNode_Node_Cmd_Stop == iTestErrorType)
1208 {
1209 paramkey = _STRLIT_CHAR("x-pvmf/datasource/error-node-cmd;index=2;valtype=uint32");
1210 paramkvp.value.uint32_value = 3;
1211 }
1212 else if (ErrorHandling_MediaInputNode_Node_Cmd_Flush == iTestErrorType)
1213 {
1214 paramkey = _STRLIT_CHAR("x-pvmf/datasource/error-node-cmd;index=2;valtype=uint32");
1215 paramkvp.value.uint32_value = 4;
1216 }
1217 else if (ErrorHandling_MediaInputNode_Node_Cmd_Pause == iTestErrorType)
1218 {
1219 paramkey = _STRLIT_CHAR("x-pvmf/datasource/error-node-cmd;index=2;valtype=uint32");
1220 paramkvp.value.uint32_value = 5;
1221 iPauseResumeEnable = true;
1222 }
1223 else if (ErrorHandling_MediaInputNode_Node_Cmd_ReleasePort == iTestErrorType)
1224 {
1225 paramkey = _STRLIT_CHAR("x-pvmf/datasource/error-node-cmd;index=2;valtype=uint32");
1226 paramkvp.value.uint32_value = 7;
1227 }
1228 else if (ErrorHandling_MediaInputNode_DataPath_Stall == iTestErrorType)
1229 {
1230 uint32 numStreams = ((PVAviFile*)iFileParser)->GetNumStreams();
1231 paramkey = _STRLIT_CHAR("x-pvmf/datasource/error-data-path-stall;valtype=uint32");
1232 if (numStreams > 0)
1233 {
1234 paramkvp.value.uint32_value = numStreams - 1;
1235 }
1236 else
1237 {
1238 paramkvp.value.uint32_value = numStreams;
1239 }
1240
1241 }
1242 else if (ErrorHandling_MP4Composer_AddTrack_PVMF_AMR_IETF == iTestErrorType)
1243 {
1244 paramkey = _STRLIT_CHAR("x-pvmf/composer/mp4/error-addtrack;valtype=char*");
1245 OSCL_HeapString<OsclMemAllocator> mode1 = "PVMF_AMR_IETF";
1246 paramkvp.value.pChar_value = mode1.get_str();
1247 }
1248 else if (ErrorHandling_MP4Composer_AddTrack_PVMF_3GPP_TIMEDTEXT == iTestErrorType)
1249 {
1250 paramkey = _STRLIT_CHAR("x-pvmf/composer/mp4/error-addtrack;valtype=char*");
1251 OSCL_HeapString<OsclMemAllocator> mode2 = "PVMF_3GPP_TIMEDTEXT";
1252 paramkvp.value.pChar_value = mode2.get_str();
1253 }
1254
1255 else if (ErrorHandling_MP4Composer_AddTrack_PVMF_M4V == iTestErrorType)
1256 {
1257 paramkey = _STRLIT_CHAR("x-pvmf/composer/mp4/error-addtrack;valtype=char*");
1258 OSCL_HeapString<OsclMemAllocator> mode3 = "PVMF_M4V";
1259 paramkvp.value.pChar_value = mode3.get_str();
1260 }
1261
1262 else if (ErrorHandling_MP4Composer_AddTrack_PVMF_H263 == iTestErrorType)
1263 {
1264 paramkey = _STRLIT_CHAR("x-pvmf/composer/mp4/error-addtrack;valtype=char*");
1265 OSCL_HeapString<OsclMemAllocator> mode4 = "PVMF_H263";
1266 paramkvp.value.pChar_value = mode4.get_str();
1267 }
1268 else if (ErrorHandling_MP4Composer_AddTrack_PVMF_H264_MP4 == iTestErrorType)
1269 {
1270 paramkey = _STRLIT_CHAR("x-pvmf/composer/mp4/error-addtrack;valtype=char*");
1271 OSCL_HeapString<OsclMemAllocator> mode5 = "PVMF_H264_MP4";
1272 paramkvp.value.pChar_value = mode5.get_str();
1273 }
1274 else if (ErrorHandling_MP4Composer_Node_Cmd_Start == iTestErrorType)
1275 {
1276 paramkey = _STRLIT_CHAR("x-pvmf/composer/mp4/error-node-cmd;index=2;valtype=uint32");
1277 paramkvp.value.uint32_value = 2;
1278 }
1279 else if (ErrorHandling_MP4Composer_Node_Cmd_Stop == iTestErrorType)
1280 {
1281 paramkey = _STRLIT_CHAR("x-pvmf/composer/mp4/error-node-cmd;index=2;valtype=uint32");
1282 paramkvp.value.uint32_value = 3;
1283 }
1284 else if (ErrorHandling_MP4Composer_Node_Cmd_Flush == iTestErrorType)
1285 {
1286 paramkey = _STRLIT_CHAR("x-pvmf/composer/mp4/error-node-cmd;index=2;valtype=uint32");
1287 paramkvp.value.uint32_value = 4;
1288 }
1289 else if (ErrorHandling_MP4Composer_Node_Cmd_Pause == iTestErrorType)
1290 {
1291 paramkey = _STRLIT_CHAR("x-pvmf/composer/mp4/error-node-cmd;index=2;valtype=uint32");
1292 paramkvp.value.uint32_value = 5;
1293 iPauseResumeEnable = true;
1294 }
1295 else if (ErrorHandling_MP4Composer_Node_Cmd_ReleasePort == iTestErrorType)
1296 {
1297 paramkey = _STRLIT_CHAR("x-pvmf/composer/mp4/error-node-cmd;index=2;valtype=uint32");
1298 paramkvp.value.uint32_value = 7;
1299 }
1300
1301 else if (ErrorHandling_MP4Composer_Create_FileParser == iTestErrorType)
1302 {
1303 paramkey = _STRLIT_CHAR("x-pvmf/composer/mp4/error-create-composer;valtype=bool");
1304 }
1305 else if (ErrorHandling_MP4Composer_RenderToFile == iTestErrorType)
1306 {
1307 paramkey = _STRLIT_CHAR("x-pvmf/composer/mp4/error-render-to-file;valtype=bool");
1308 }
1309 else if (ErrorHandling_MP4Composer_FailAfter_FileSize == iTestErrorType)
1310 {
1311 paramkey = _STRLIT_CHAR("x-pvmf/composer/mp4/error-addsample;mode=filesize;valtype=uint32"); //shorten the key to fit in buffer
1312 paramkvp.value.uint32_value = 5000;
1313 }
1314 else if (ErrorHandling_MP4Composer_FailAfter_Duration == iTestErrorType)
1315 {
1316 paramkey = _STRLIT_CHAR("x-pvmf/composer/mp4/error-addsample;mode=duration;valtype=uint32");
1317 paramkvp.value.uint32_value = 500;
1318 }
1319 else if (ErrorHandling_MP4Composer_DataPathStall == iTestErrorType)
1320 {
1321 paramkey = _STRLIT_CHAR("x-pvmf/composer/mp4/data-path-stall;valtype=uint32");
1322 paramkvp.value.uint32_value = 1;
1323 }
1324 else if (ErrorHandling_VideoEncodeNode_Node_Cmd_Start == iTestErrorType)
1325 {
1326 paramkey = _STRLIT_CHAR("x-pvmf/encoder/video/error-node-cmd;index=2;valtype=uint32");
1327 paramkvp.value.uint32_value = 2;
1328 }
1329 else if (ErrorHandling_VideoEncodeNode_Node_Cmd_Stop == iTestErrorType)
1330 {
1331 paramkey = _STRLIT_CHAR("x-pvmf/encoder/video/error-node-cmd;index=2;valtype=uint32");
1332 paramkvp.value.uint32_value = 3;
1333 }
1334 else if (ErrorHandling_VideoEncodeNode_Node_Cmd_Flush == iTestErrorType)
1335 {
1336 paramkey = _STRLIT_CHAR("x-pvmf/encoder/video/error-node-cmd;index=2;valtype=uint32");
1337 paramkvp.value.uint32_value = 4;
1338 }
1339 else if (ErrorHandling_VideoEncodeNode_Node_Cmd_Pause == iTestErrorType)
1340 {
1341 paramkey = _STRLIT_CHAR("x-pvmf/encoder/video/error-node-cmd;index=2;valtype=uint32");
1342 paramkvp.value.uint32_value = 5;
1343 iPauseResumeEnable = true;
1344 }
1345 else if (ErrorHandling_VideoEncodeNode_Node_Cmd_ReleasePort == iTestErrorType)
1346 {
1347 paramkey = _STRLIT_CHAR("x-pvmf/encoder/video/error-node-cmd;index=2;valtype=uint32;");
1348 paramkvp.value.uint32_value = 7;
1349 }
1350 else if (ErrorHandling_VideoEncodeNode_ConfigHeader == iTestErrorType)
1351 {
1352 paramkey = _STRLIT_CHAR("x-pvmf/encoder/video/error-config-header;valtype=bool");
1353 }
1354 else if (ErrorHandling_VideoEncodeNode_DataPathStall_Before_ProcessingData == iTestErrorType)
1355 {
1356 paramkey = _STRLIT_CHAR("x-pvmf/encoder/video/data-path-stall;valtype=uint32");
1357 paramkvp.value.uint32_value = 1;
1358 }
1359 else if (ErrorHandling_VideoEncodeNode_DataPathStall_After_ProcessingData == iTestErrorType)
1360 {
1361 paramkey = _STRLIT_CHAR("x-pvmf/encoder/video/data-path-stall;valtype=uint32");
1362 paramkvp.value.uint32_value = 2;
1363 }
1364 else if (ErrorHandling_VideoEncodeNode_FailEncode_AfterDuration == iTestErrorType)
1365 {
1366 paramkey = _STRLIT_CHAR("x-pvmf/encoder/video/error-encode;mode=duration;valtype=uint32");
1367 paramkvp.value.uint32_value = 300;
1368 }
1369 else if (ErrorHandling_AudioEncodeNode_Node_Cmd_Start == iTestErrorType)
1370 {
1371 paramkey = _STRLIT_CHAR("x-pvmf/encoder/audio/error-node-cmd;index=2;valtype=uint32");
1372 paramkvp.value.uint32_value = 2;
1373
1374 }
1375 else if (ErrorHandling_AudioEncodeNode_Node_Cmd_Stop == iTestErrorType)
1376 {
1377 paramkey = _STRLIT_CHAR("x-pvmf/encoder/audio/error-node-cmd;index=2;valtype=uint32");
1378 paramkvp.value.uint32_value = 3;
1379
1380 }
1381 else if (ErrorHandling_AudioEncodeNode_Node_Cmd_Flush == iTestErrorType)
1382 {
1383 paramkey = _STRLIT_CHAR("x-pvmf/encoder/audio/error-node-cmd;index=2;valtype=uint32");
1384 paramkvp.value.uint32_value = 4;
1385
1386 }
1387 else if (ErrorHandling_AudioEncodeNode_Node_Cmd_Pause == iTestErrorType)
1388 {
1389 paramkey = _STRLIT_CHAR("x-pvmf/encoder/audio/error-node-cmd;index=2;valtype=uint32");
1390 paramkvp.value.uint32_value = 5;
1391 iPauseResumeEnable = true;
1392
1393 }
1394 else if (ErrorHandling_AudioEncodeNode_Node_Cmd_ReleasePort == iTestErrorType)
1395 {
1396 paramkey = _STRLIT_CHAR("x-pvmf/encoder/audio/error-node-cmd;index=2;valtype=uint32");
1397 paramkvp.value.uint32_value = 7;
1398
1399 }
1400
1401 else if (ErrorHandling_AudioEncodeNode_FailEncode_AfterDuration == iTestErrorType)
1402 {
1403 paramkey = _STRLIT_CHAR("x-pvmf/encoder/audio/error-encode;mode=duration;valtype=uint32");
1404 paramkvp.value.uint32_value = 700;
1405 }
1406 else if (ErrorHandling_AudioEncodeNode_DataPathStall_Before_ProcessingData == iTestErrorType)
1407 {
1408 paramkey = _STRLIT_CHAR("x-pvmf/encoder/audio/data-path-stall;valtype=uint32");
1409 paramkvp.value.uint32_value = 1;
1410 }
1411
1412 else if (ErrorHandling_AudioEncodeNode_DataPathStall_After_ProcessingData == iTestErrorType)
1413 {
1414 paramkey = _STRLIT_CHAR("x-pvmf/encoder/audio/data-path-stall;valtype=uint32");
1415 paramkvp.value.uint32_value = 2;
1416 }
1417 else if (ErrorHandling_AVCEncodeNode_Node_Cmd_Start == iTestErrorType)
1418 {
1419 paramkey = _STRLIT_CHAR("x-pvmf/encoder/video/error-node-cmd;index=2;valtype=uint32");
1420 paramkvp.value.uint32_value = 2;
1421
1422 }
1423 else if (ErrorHandling_AVCEncodeNode_Node_Cmd_Stop == iTestErrorType)
1424 {
1425 paramkey = _STRLIT_CHAR("x-pvmf/encoder/video/error-node-cmd;index=2;valtype=uint32");
1426 paramkvp.value.uint32_value = 3;
1427
1428 }
1429 else if (ErrorHandling_AVCEncodeNode_Node_Cmd_Flush == iTestErrorType)
1430 {
1431 paramkey = _STRLIT_CHAR("x-pvmf/encoder/video/error-node-cmd;index=2;valtype=uint32");
1432 paramkvp.value.uint32_value = 4;
1433
1434 }
1435 else if (ErrorHandling_AVCEncodeNode_Node_Cmd_Pause == iTestErrorType)
1436 {
1437 paramkey = _STRLIT_CHAR("x-pvmf/encoder/video/error-node-cmd;index=2;valtype=uint32");
1438 paramkvp.value.uint32_value = 5;
1439 iPauseResumeEnable = true;
1440
1441 }
1442 else if (ErrorHandling_AVCEncodeNode_Node_Cmd_ReleasePort == iTestErrorType)
1443 {
1444 paramkey = _STRLIT_CHAR("x-pvmf/encoder/video/error-node-cmd;index=2;valtype=uint32");
1445 paramkvp.value.uint32_value = 7;
1446
1447 }
1448 else if (ErrorHandling_AVCEncodeNode_ConfigHeader == iTestErrorType)
1449 {
1450 paramkey = _STRLIT_CHAR("x-pvmf/encoder/video/error-config-header;valtype=bool");
1451 }
1452 else if (ErrorHandling_AVCEncodeNode_DataPathStall_Before_ProcessingData == iTestErrorType)
1453 {
1454 paramkey = _STRLIT_CHAR("x-pvmf/encoder/video/data-path-stall;valtype=uint32");
1455 paramkvp.value.uint32_value = 1;
1456 }
1457 else if (ErrorHandling_AVCEncodeNode_DataPathStall_After_ProcessingData == iTestErrorType)
1458 {
1459 paramkey = _STRLIT_CHAR("x-pvmf/encoder/video/data-path-stall;valtype=uint32");
1460 paramkvp.value.uint32_value = 2;
1461 }
1462 else if (ErrorHandling_AVCEncodeNode_FailEncode_AfterDuration == iTestErrorType)
1463 {
1464 paramkey = _STRLIT_CHAR("x-pvmf/encoder/video/error-encode;mode=duration;valtype=uint32");
1465 paramkvp.value.uint32_value = 100;
1466 }
1467 paramkvp.key = paramkey.get_str();
1468
1469 // set the value in node using SetParameterSync f(n) here
1470 iAuthorCapConfigIF->setParametersSync(NULL, ¶mkvp, 1, iErrorKVP);
1471 oscl_free(key);
1472 return true;
1473 }
1474
ConfigMp4Composer()1475 void pv_mediainput_async_test_errorhandling::ConfigMp4Composer()
1476 {
1477 PvmfComposerSizeAndDurationInterface* config =
1478 OSCL_REINTERPRET_CAST(PvmfComposerSizeAndDurationInterface*, iOutputSizeAndDurationConfig);
1479
1480 config->SetFileSizeProgressReport(true, KFileSizeProgressFreq);
1481
1482 }
1483