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_PLAYER_ENGINE_TESTSET5_H_INCLUDED 19 #define TEST_PV_PLAYER_ENGINE_TESTSET5_H_INCLUDED 20 21 /** 22 * @file test_pv_player_engine_testset5.h 23 * @brief This file contains the class definitions for the fifth set of 24 * test cases for PVPlayerEngine - HTTP download tests (3GPP progressive and PV FastTrack) 25 * 26 */ 27 28 #ifndef TEST_PV_PLAYER_ENGINE_H_INCLUDED 29 #include "test_pv_player_engine.h" 30 #endif 31 32 #ifndef TEST_PV_PLAYER_ENGINE_CONFIG_H_INCLUDED 33 #include "test_pv_player_engine_config.h" 34 #endif 35 36 #if RUN_FASTTRACK_TESTCASES 37 #ifndef PVPVXPARSER_H_INCLUDED 38 #include "pvpvxparser.h" 39 #endif 40 #endif 41 42 #if !(JANUS_IS_LOADABLE_MODULE) 43 #ifndef PVMF_CPMPLUGIN_FACTORY_REGISTRY_H_INCLUDED 44 #include "pvmf_cpmplugin_factory_registry.h" 45 #endif 46 #endif 47 48 class PVPlayerDataSourceURL; 49 class PVPlayerDataSinkFilename; 50 class PVLogger; 51 class PVMFDownloadDataSourcePVX; 52 class PVMFDownloadDataSourceHTTP; 53 class PVMFSourceContextData; 54 class PvmiCapabilityAndConfig; 55 class PVMFJanusPluginFactory; 56 #if RUN_CPMJANUS_TESTCASES 57 class PVMFJanusPluginConfiguration; 58 #endif 59 class WmDrmDeviceInfoFactory; 60 class PVWmdrmDeviceSystemClockFactory; 61 62 class pvplayer_async_test_downloadbase : public pvplayer_async_test_base 63 { 64 public: pvplayer_async_test_downloadbase(PVPlayerAsyncTestParam aTestParam)65 pvplayer_async_test_downloadbase(PVPlayerAsyncTestParam aTestParam): 66 pvplayer_async_test_base(aTestParam) 67 , iPlayer(NULL) 68 , iDataSource(NULL) 69 , iDownloadContextData(NULL) 70 , iDataSinkVideo(NULL) 71 , iDataSinkAudio(NULL) 72 , iIONodeVideo(NULL) 73 , iIONodeAudio(NULL) 74 , iMIOFileOutVideo(NULL) 75 , iMIOFileOutAudio(NULL) 76 , iCurrentCmdId(0) 77 , iProtocolRollOver(false) 78 , iRepositionAfterDownloadComplete(false) 79 , iPauseAfterDownloadComplete(false) 80 , iPlayUntilEOS(false) 81 , iPauseResumeAfterUnderflow(false) 82 , iProgPlayback(false) 83 , iPlayStopPlay(false) 84 , iSessionDuration(0) 85 , iCancelAllCmdId(0) 86 { 87 iNumBufferingStart = iNumBufferingComplete = iNumUnderflow = iNumDataReady = iNumEOS = 0; 88 iDownloadOnly = iDownloadThenPlay = false; 89 iLastBufferingStatusVal = 0; 90 } 91 92 virtual ~pvplayer_async_test_downloadbase(); 93 94 void StartTest(); 95 void Run(); 96 97 virtual void CommandCompleted(const PVCmdResponse& aResponse); 98 virtual void HandleErrorEvent(const PVAsyncErrorEvent& aEvent); 99 virtual void HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent); 100 101 enum PVTestState 102 { 103 STATE_CREATE, 104 STATE_QUERYINTERFACE, 105 STATE_ADDDATASOURCE, 106 STATE_CONFIGPARAMS, 107 STATE_INIT, 108 STATE_GETMETADATAKEYLIST, 109 STATE_GETMETADATAVALUELIST, 110 STATE_ADDDATASINK_VIDEO, 111 STATE_ADDDATASINK_AUDIO, 112 STATE_PREPARE, 113 STATE_WAIT_FOR_DATAREADY, 114 STATE_WAIT_FOR_BUFFCOMPLETE, 115 STATE_CANCELALL, 116 STATE_WAIT_FOR_CANCELALL, 117 STATE_START, 118 STATE_SETPLAYBACKRANGE, 119 STATE_PAUSE, 120 STATE_RESUME, 121 STATE_EOSNOTREACHED, 122 STATE_STOP, 123 STATE_REMOVEDATASINK_VIDEO, 124 STATE_REMOVEDATASINK_AUDIO, 125 STATE_RESET, 126 STATE_REMOVEDATASOURCE, 127 STATE_CLEANUPANDCOMPLETE, 128 STATE_PREPARE2, 129 STATE_START2, 130 STATE_STOP2 131 }; 132 133 134 PVTestState iState; 135 136 PVPlayerInterface* iPlayer; 137 PVPlayerDataSourceURL* iDataSource; 138 PVMFSourceContextData* iDownloadContextData; 139 PVPlayerDataSink* iDataSinkVideo; 140 PVPlayerDataSink* iDataSinkAudio; 141 PVMFNodeInterface* iIONodeVideo; 142 PVMFNodeInterface* iIONodeAudio; 143 PvmiMIOControl* iMIOFileOutVideo; 144 PvmiMIOControl* iMIOFileOutAudio; 145 146 OSCL_wHeapString<OsclMemAllocator> iDownloadURL; 147 OSCL_wHeapString<OsclMemAllocator> iDownloadFilename; 148 OSCL_HeapString<OsclMemAllocator> iDownloadProxy; 149 OSCL_wHeapString<OsclMemAllocator> iDownloadConfigFilename; 150 151 PVCommandId iCurrentCmdId; 152 PVLogger* iLogger; 153 154 virtual void CreateDataSource() = 0; 155 virtual void CreateDataSinkVideo() = 0; 156 virtual void CreateDataSinkAudio() = 0; CleanupData()157 virtual void CleanupData() {} 158 159 void PrintMetadata(); 160 PVPMetadataList iMetadataKeyList; 161 Oscl_Vector<PvmiKvp, OsclMemAllocator> iMetadataValueList; 162 int32 iNumValues; 163 164 int32 iNumBufferingStart, iNumBufferingComplete, iNumUnderflow, iNumDataReady, iNumEOS; 165 bool iDownloadOnly, iDownloadThenPlay; 166 bool iContentTooLarge; 167 setProtocolRollOverMode()168 void setProtocolRollOverMode() 169 { 170 iProtocolRollOver = true; 171 } 172 bool iProtocolRollOver; 173 enableReposAfterDownloadComplete()174 void enableReposAfterDownloadComplete() 175 { 176 iRepositionAfterDownloadComplete = true; 177 } 178 bool iRepositionAfterDownloadComplete; 179 enablePauseAfterDownloadComplete()180 void enablePauseAfterDownloadComplete() 181 { 182 iPauseAfterDownloadComplete = true; 183 } 184 bool iPauseAfterDownloadComplete; 185 enablePlayUntilEOS()186 void enablePlayUntilEOS() 187 { 188 iPlayUntilEOS = true; 189 } 190 bool iPlayUntilEOS; 191 192 bool iPauseResumeAfterUnderflow; 193 194 bool iProgPlayback; 195 bool iPlayStopPlay; enablePlayStopPlay()196 void enablePlayStopPlay() 197 { 198 iPlayStopPlay = true; 199 iTestCaseName += " Play/Stop/Play"; 200 } 201 int32 iLastBufferingStatusVal; 202 203 //for janus drm. 204 void PrintJanusError(const PVCmdResponse& aResponse); 205 206 uint32 iSessionDuration; 207 protected: 208 PVCommandId iCancelAllCmdId; 209 private: 210 void HandleProtocolEngineNodeErrors(int32 aErr, OsclAny* aEventData); 211 void HandleSocketNodeErrors(int32 aErr); 212 private: 213 PvmiCapabilityAndConfig* iPlayerCapConfigIF; 214 PvmiKvp* iErrorKVP; 215 PvmiKvp iKVPSetAsync; 216 OSCL_StackString<256> iKeyStringSetAsync; 217 }; 218 219 #if RUN_FASTTRACK_TESTCASES 220 /*! 221 * A test case to test the normal FastTrack download and playback from a PVX file 222 * - Data Source: test.pvx 223 * - Data Sink(s): Video[FileOutputNode-test_player_ftdlnormal_video.dat]\n 224 * Audio[FileOutputNode-test_player_ftdlnormal_audio.dat] 225 * - Sequence: 226 * -# CreatePlayer() 227 * -# AddDataSource() 228 * -# Init() 229 * -# AddDataSink() (video) 230 * -# AddDataSink() (audio) 231 * -# Prepare() 232 * -# Wait for Data Ready event 233 * -# Start() 234 * -# Play until either EOS is reached or 10 seconds after download 235 * finishes. 236 * -# Stop() 237 * -# RemoveDataSink() (video) 238 * -# RemoveDataSink() (audio) 239 * -# Reset() 240 * -# RemoveDataSource() 241 * -# DeletePlayer() 242 * 243 */ 244 class pvplayer_async_test_ftdlnormal : public pvplayer_async_test_downloadbase 245 { 246 public: pvplayer_async_test_ftdlnormal(PVPlayerAsyncTestParam aTestParam)247 pvplayer_async_test_ftdlnormal(PVPlayerAsyncTestParam aTestParam) 248 : pvplayer_async_test_downloadbase(aTestParam) 249 { 250 iLogger = PVLogger::GetLoggerObject("pvplayer_async_test_ftdlnormal"); 251 iTestCaseName = _STRLIT_CHAR("FastTrack Download Normal"); 252 } 253 254 ~pvplayer_async_test_ftdlnormal(); 255 256 void CreateDataSource(); 257 void CreateDataSinkVideo(); 258 void CreateDataSinkAudio(); 259 260 uint8 iPVXFileBuf[4096]; 261 int32 iDownloadMaxfilesize; 262 CPVXInfo iDownloadPvxInfo; 263 }; 264 #endif 265 266 /*! 267 * A test case to test the normal 3GPP download and playback from an HTTP URL. 268 * - Data Source: http://0.0.0.0/test.3gp 269 * - Data Sink(s): Video[FileOutputNode-test_player_3gppdlnormal_video.dat]\n 270 * Audio[FileOutputNode-test_player_3gppdlnormal_audio.dat] 271 * - Sequence: 272 * -# CreatePlayer() 273 * -# AddDataSource() 274 * -# Init() 275 * -# AddDataSink() (video) 276 * -# AddDataSink() (audio) 277 * -# Prepare() 278 * -# Wait for Data Ready event 279 * -# Start() 280 * -# Play until either EOS is reached or 10 seconds after download 281 * finishes. 282 * -# Stop() 283 * -# RemoveDataSink() (video) 284 * -# RemoveDataSink() (audio) 285 * -# Reset() 286 * -# RemoveDataSource() 287 * -# DeletePlayer() 288 * 289 */ 290 class pvplayer_async_test_3gppdlnormal : public pvplayer_async_test_downloadbase 291 { 292 public: pvplayer_async_test_3gppdlnormal(PVPlayerAsyncTestParam aTestParam)293 pvplayer_async_test_3gppdlnormal(PVPlayerAsyncTestParam aTestParam): 294 pvplayer_async_test_downloadbase(aTestParam) 295 { 296 iLogger = PVLogger::GetLoggerObject("pvplayer_async_test_3gppdlnormal"); 297 iTestCaseName = _STRLIT_CHAR("3GPP Download Play ASAP"); 298 #if RUN_CPMJANUS_TESTCASES && !(JANUS_IS_LOADABLE_MODULE) 299 iPluginFactory = NULL; 300 iDrmDeviceInfoFactory = NULL; 301 iDrmSystemClockFactory = NULL; 302 #endif 303 } 304 305 ~pvplayer_async_test_3gppdlnormal(); 306 307 void CreateDataSource(); 308 void CreateDataSinkVideo(); 309 void CreateDataSinkAudio(); 310 311 //for janus DRM 312 #if RUN_CPMJANUS_TESTCASES && !(JANUS_IS_LOADABLE_MODULE) 313 PVMFCPMPluginFactoryRegistryClient iPluginRegistryClient; 314 PVMFJanusPluginFactory* iPluginFactory; 315 OSCL_HeapString<OsclMemAllocator> iPluginMimeType; 316 bool RegisterJanusPlugin(PVMFJanusPluginConfiguration& aConfig); 317 void CleanupJanusPlugin(); 318 WmDrmDeviceInfoFactory* iDrmDeviceInfoFactory; 319 PVWmdrmDeviceSystemClockFactory* iDrmSystemClockFactory; 320 #endif 321 void CleanupData(); 322 }; 323 324 /*! 325 * A test case to test the normal PPB from an HTTP URL. 326 * - Data Source: http://0.0.0.0/test.3gp 327 * - Data Sink(s): Video[FileOutputNode-test_player_3gppdlnormal_video.dat]\n 328 * Audio[FileOutputNode-test_player_3gppdlnormal_audio.dat] 329 * - Sequence: 330 * -# CreatePlayer() 331 * -# AddDataSource() 332 * -# Init() 333 * -# AddDataSink() (video) 334 * -# AddDataSink() (audio) 335 * -# Prepare() 336 * -# Wait for Data Ready event 337 * -# Start() 338 * -# Play until either EOS is reached or 10 seconds after download 339 * finishes. 340 * -# Stop() 341 * -# RemoveDataSink() (video) 342 * -# RemoveDataSink() (audio) 343 * -# Reset() 344 * -# RemoveDataSource() 345 * -# DeletePlayer() 346 * 347 */ 348 class pvplayer_async_test_ppbnormal : public pvplayer_async_test_downloadbase 349 { 350 public: pvplayer_async_test_ppbnormal(PVPlayerAsyncTestParam aTestParam)351 pvplayer_async_test_ppbnormal(PVPlayerAsyncTestParam aTestParam): 352 pvplayer_async_test_downloadbase(aTestParam) 353 { 354 iLogger = PVLogger::GetLoggerObject("pvplayer_async_test_ppbnormal"); 355 iTestCaseName = _STRLIT_CHAR("PPB Normal"); 356 iProgPlayback = true; 357 } 358 359 ~pvplayer_async_test_ppbnormal(); 360 361 void CreateDataSource(); 362 void CreateDataSinkVideo(); 363 void CreateDataSinkAudio(); 364 }; 365 366 class pvplayer_async_test_cnclall_prtcl_rllovr : public pvplayer_async_test_3gppdlnormal 367 { 368 public: pvplayer_async_test_cnclall_prtcl_rllovr(PVPlayerAsyncTestParam aTestParam)369 pvplayer_async_test_cnclall_prtcl_rllovr(PVPlayerAsyncTestParam aTestParam): 370 pvplayer_async_test_3gppdlnormal(aTestParam), iCancelCommandPending(true), iCancellationEventTime(Undetermined), iProtocolRolloverNotificationRecvd(false) 371 { 372 } CancelAllDuringProtocolRolloverWithNoGetReqAfterRolloverTest()373 void CancelAllDuringProtocolRolloverWithNoGetReqAfterRolloverTest() 374 { 375 iCancellationEventTime = NoGetReqAfterRollover; 376 } CancelAllDuringProtocolRolloverWithGetResponseRecvdAfterRolloverTest()377 void CancelAllDuringProtocolRolloverWithGetResponseRecvdAfterRolloverTest() 378 { 379 iCancellationEventTime = GetResponseRecvdAfterRollover; 380 } CancelAllDuringProtocolRolloverWithNoGetResponseRecvdAfterRolloverTest()381 void CancelAllDuringProtocolRolloverWithNoGetResponseRecvdAfterRolloverTest() 382 { 383 iCancellationEventTime = NoGetResponseRecvdAfterRollover; 384 } 385 protected: 386 virtual void CommandCompleted(const PVCmdResponse& aResponse); 387 virtual void HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent); 388 bool iCancelCommandPending; 389 390 private: 391 enum CancellationEventTime 392 { 393 Undetermined = 0, 394 NoGetReqAfterRollover = 1, 395 NoGetResponseRecvdAfterRollover = 2, 396 GetResponseRecvdAfterRollover = 3 397 }; 398 CancellationEventTime iCancellationEventTime; 399 bool iProtocolRolloverNotificationRecvd; 400 }; 401 402 class pvplayer_async_test_3gppdlnormal_dlthenplay : public pvplayer_async_test_downloadbase 403 { 404 public: pvplayer_async_test_3gppdlnormal_dlthenplay(PVPlayerAsyncTestParam aTestParam)405 pvplayer_async_test_3gppdlnormal_dlthenplay(PVPlayerAsyncTestParam aTestParam): 406 pvplayer_async_test_downloadbase(aTestParam) 407 { 408 iLogger = PVLogger::GetLoggerObject("pvplayer_async_test_3gppdlnormal_dlthenplay"); 409 iTestCaseName = _STRLIT_CHAR("3GPP Download Then Play"); 410 } 411 412 ~pvplayer_async_test_3gppdlnormal_dlthenplay(); 413 414 void CreateDataSource(); 415 void CreateDataSinkVideo(); 416 void CreateDataSinkAudio(); 417 418 }; 419 class pvplayer_async_test_3gppdlnormal_dlonly : public pvplayer_async_test_downloadbase 420 { 421 public: pvplayer_async_test_3gppdlnormal_dlonly(PVPlayerAsyncTestParam aTestParam)422 pvplayer_async_test_3gppdlnormal_dlonly(PVPlayerAsyncTestParam aTestParam): 423 pvplayer_async_test_downloadbase(aTestParam) 424 { 425 iLogger = PVLogger::GetLoggerObject("pvplayer_async_test_3gppdlnormal_dlonly"); 426 427 iTestCaseName = _STRLIT_CHAR("3GPP Download Only"); 428 } 429 430 ~pvplayer_async_test_3gppdlnormal_dlonly(); 431 432 void CreateDataSource(); 433 void CreateDataSinkVideo(); 434 void CreateDataSinkAudio(); 435 436 }; 437 438 439 /*! 440 * A test case to test cancel of invalid 3GPP download during init 441 * - Data Source: http://172.17.34.12/bogus.3gp 442 * - Data Sink(s): N/A 443 * - Sequence: 444 * -# CreatePlayer() 445 * -# AddDataSource() 446 * -# Init() 447 * -# WAIT 1 SEC 448 * -# CancelAll() 449 * -# WAIT 5 SEC 450 * -# DeletePlayer() 451 * 452 */ 453 class pvplayer_async_test_3gppdlcancelduringinit : public pvplayer_async_test_base 454 { 455 public: pvplayer_async_test_3gppdlcancelduringinit(PVPlayerAsyncTestParam aTestParam)456 pvplayer_async_test_3gppdlcancelduringinit(PVPlayerAsyncTestParam aTestParam): 457 pvplayer_async_test_base(aTestParam) 458 , iPlayer(NULL) 459 , iDataSource(NULL) 460 , iDownloadHttpContextData(NULL) 461 , iCancelCommandExecuted(false) 462 , iCurrentCmdId(0) 463 { 464 iLogger = PVLogger::GetLoggerObject("pvplayer_async_test_3gppdlcancelduringinit"); 465 iTestCaseName = _STRLIT_CHAR("3GPP Download Cancel During Init"); 466 } 467 ~pvplayer_async_test_3gppdlcancelduringinit()468 ~pvplayer_async_test_3gppdlcancelduringinit() {} 469 470 void StartTest(); 471 void Run(); 472 473 void CommandCompleted(const PVCmdResponse& aResponse); 474 void HandleErrorEvent(const PVAsyncErrorEvent& aEvent); 475 void HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent); 476 477 enum PVTestState 478 { 479 STATE_CREATE, 480 STATE_ADDDATASOURCE, 481 STATE_INIT, 482 STATE_CANCELALL, 483 STATE_WAIT_FOR_CANCELALL, 484 STATE_RESET, 485 STATE_REMOVEDATASOURCE, 486 STATE_CLEANUPANDCOMPLETE 487 }; 488 489 PVTestState iState; 490 491 PVPlayerInterface* iPlayer; 492 PVPlayerDataSourceURL* iDataSource; 493 PVMFDownloadDataSourceHTTP* iDownloadHttpContextData; 494 OSCL_wHeapString<OsclMemAllocator> iDownloadURL; 495 OSCL_wHeapString<OsclMemAllocator> iDownloadFilename; 496 OSCL_HeapString<OsclMemAllocator> iDownloadProxy; 497 OSCL_wHeapString<OsclMemAllocator> iConfigFileName; 498 bool iCancelCommandExecuted; 499 PVCommandId iCurrentCmdId; 500 PVLogger* iLogger; 501 }; 502 503 /*! 504 * A test case to test cancel of invalid 3GPP download during init. Cancel request is delayed 505 * - Data Source: http://172.17.34.12/bogus.3gp - should be low bandwidth or non-PDL 506 * - Data Sink(s): N/A 507 * - Sequence: 508 * -# CreatePlayer() 509 * -# AddDataSource() 510 * -# Init() 511 * -# WAIT FOR FIRST DOWNLOAD STATUS EVENT 512 * -# CancelAll() 513 * -# WAIT UP TO 15 SEC FOR CmdCompleted 514 * -# DeletePlayer() 515 * 516 */ 517 class pvplayer_async_test_3gppdlcancelduringinitdelay : public pvplayer_async_test_base 518 { 519 public: pvplayer_async_test_3gppdlcancelduringinitdelay(PVPlayerAsyncTestParam aTestParam)520 pvplayer_async_test_3gppdlcancelduringinitdelay(PVPlayerAsyncTestParam aTestParam): 521 pvplayer_async_test_base(aTestParam) 522 , iPlayer(NULL) 523 , iDataSource(NULL) 524 , iDownloadHttpContextData(NULL) 525 , iCancelCommandExecuted(false) 526 , iCurrentCmdId(0) 527 , iInitCmdId(-1) 528 { 529 iLogger = PVLogger::GetLoggerObject("pvplayer_async_test_3gppdlcancelduringinitdelay"); 530 iTestCaseName = _STRLIT_CHAR("3GPP Download Cancel During Init - delayed"); 531 } 532 ~pvplayer_async_test_3gppdlcancelduringinitdelay()533 ~pvplayer_async_test_3gppdlcancelduringinitdelay() {} 534 535 void StartTest(); 536 void Run(); 537 538 void CommandCompleted(const PVCmdResponse& aResponse); 539 void HandleErrorEvent(const PVAsyncErrorEvent& aEvent); 540 void HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent); 541 542 enum PVTestState 543 { 544 STATE_CREATE, 545 STATE_ADDDATASOURCE, 546 STATE_INIT, 547 STATE_CANCELALL, 548 STATE_WAIT_FOR_CANCELALL, 549 STATE_RESET, 550 STATE_REMOVEDATASOURCE, 551 STATE_CLEANUPANDCOMPLETE 552 }; 553 554 PVTestState iState; 555 556 PVPlayerInterface* iPlayer; 557 PVPlayerDataSourceURL* iDataSource; 558 PVMFDownloadDataSourceHTTP* iDownloadHttpContextData; 559 OSCL_wHeapString<OsclMemAllocator> iDownloadURL; 560 OSCL_wHeapString<OsclMemAllocator> iDownloadFilename; 561 OSCL_HeapString<OsclMemAllocator> iDownloadProxy; 562 OSCL_wHeapString<OsclMemAllocator> iConfigFileName; 563 bool iCancelCommandExecuted; 564 PVCommandId iCurrentCmdId; 565 PVCommandId iInitCmdId; 566 PVLogger* iLogger; 567 }; 568 569 /*! 570 * A test case to test the return of PVMFErrContentTooLarge from Init() 571 * when the iMaxFileSize is set to a lower number than the size of 572 * the downloading file. 573 * - Data Source: "http://pvwmsoha.pv.com:7070/MediaDownloadContent/UserUploads/av5.wmv" 574 * - Data Sink(s): N/A 575 * - Sequence: 576 * -# CreatePlayer() 577 * -# AddDataSource() 578 * -# Init() - command complete should return error PVMFErrContentTooLarge 579 * -# RemoveDataSource() 580 * -# DeletePlayer() 581 * 582 */ 583 class pvplayer_async_test_3gppdlcontenttoolarge : public pvplayer_async_test_downloadbase 584 { 585 public: pvplayer_async_test_3gppdlcontenttoolarge(PVPlayerAsyncTestParam aTestParam)586 pvplayer_async_test_3gppdlcontenttoolarge(PVPlayerAsyncTestParam aTestParam): 587 pvplayer_async_test_downloadbase(aTestParam) 588 { 589 iLogger = PVLogger::GetLoggerObject("pvplayer_async_test_3gppdlcontenttoolarge"); 590 iTestCaseName = _STRLIT_CHAR("3GPP PVMFErrContentTooLarge during Init"); 591 } 592 593 ~pvplayer_async_test_3gppdlcontenttoolarge(); 594 595 void CreateDataSource(); 596 void CreateDataSinkVideo(); 597 void CreateDataSinkAudio(); 598 599 }; 600 601 602 /*! 603 * A test case to test the PVMFInfoContentTruncated behavior 604 * - Data Source: "TBD" - we dont have download content that does not report its size as zero 605 * - Data Sink(s): N/A 606 * - Sequence: 607 * -# CreatePlayer() 608 * -# AddDataSource() 609 * -# Init() 610 * -# AddDataSink() (video) 611 * -# AddDataSink() (audio) 612 * -# Prepare() 613 * -# Wait for Data Ready event 614 * -# Start() 615 * -# Play until PVMFInfoContentTruncated or EOS 616 * -# Stop() 617 * -# RemoveDataSink() (video) 618 * -# RemoveDataSink() (audio) 619 * -# Reset() 620 * -# RemoveDataSource() 621 * -# DeletePlayer() 622 * 623 */ 624 class pvplayer_async_test_3gppdlContentTruncated : public pvplayer_async_test_downloadbase 625 { 626 public: pvplayer_async_test_3gppdlContentTruncated(PVPlayerAsyncTestParam aTestParam)627 pvplayer_async_test_3gppdlContentTruncated(PVPlayerAsyncTestParam aTestParam): 628 pvplayer_async_test_downloadbase(aTestParam) 629 { 630 iLogger = PVLogger::GetLoggerObject("pvplayer_async_test_3gppdlContentTruncated"); 631 iTestCaseName = _STRLIT_CHAR("3GPP PVMFInfoContentTruncated during download"); 632 } 633 634 ~pvplayer_async_test_3gppdlContentTruncated(); 635 636 void CreateDataSource(); 637 void CreateDataSinkVideo(); 638 void CreateDataSinkAudio(); 639 640 }; 641 642 643 /* 644 * Base class for progressive playback (aka progressive streaming) testing 645 * 646 */ 647 class pvplayer_async_test_ppb_base : public pvplayer_async_test_base 648 { 649 public: pvplayer_async_test_ppb_base(PVPlayerAsyncTestParam aTestParam)650 pvplayer_async_test_ppb_base(PVPlayerAsyncTestParam aTestParam): 651 pvplayer_async_test_base(aTestParam) 652 , iPlayer(NULL) 653 , iDataSource(NULL) 654 , iDataSinkVideo(NULL) 655 , iDataSinkAudio(NULL) 656 , iIONodeVideo(NULL) 657 , iIONodeAudio(NULL) 658 , iMIOFileOutVideo(NULL) 659 , iMIOFileOutAudio(NULL) 660 , iDownloadContextData(NULL) 661 , iCurrentCmdId(0) 662 , iRepositionAfterDownloadComplete(false) 663 , iPlayUntilEOS(false) 664 , iShortPauseResume(false) 665 , iLongPauseResume(false) 666 , iSeekAfterStart(false) 667 , iSeekBeforeStart(false) 668 , iTwice(false) 669 , iLoop(0) 670 , iLoopReq(0) 671 , iStepInterval(0) 672 , iBeginTime(0) 673 , iEndTime(0) 674 , iForwardStep(false) 675 , iForwardSeekStep(0) 676 , iForwardSeekTime(0) 677 , iBackwardStep(false) 678 , iBackwardSeekStep(0) 679 , iBackwardSeekTime(0) 680 , iSeekAfterDownloadComplete(false) 681 , iSeekToBOC(false) 682 , iSeekInCache(false) 683 , iEOSStopPlay(false) 684 , iShoutcastSession(false) 685 , iSCListenTime(0) 686 , iShoutcastPlayStopPlay(false) 687 , iSessionDuration(0) 688 { 689 iNumBufferingStart = iNumBufferingComplete = iNumUnderflow = iNumDataReady = iNumEOS = 0; 690 } 691 ~pvplayer_async_test_ppb_base()692 virtual ~pvplayer_async_test_ppb_base() {} 693 694 void StartTest(); 695 void Run(); 696 697 void CommandCompleted(const PVCmdResponse& aResponse); 698 void HandleErrorEvent(const PVAsyncErrorEvent& aEvent); 699 void HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent); 700 701 enum PVTestState 702 { 703 STATE_CREATE, 704 STATE_QUERYINTERFACE, 705 STATE_ADDDATASOURCE, 706 STATE_CONFIGPARAMS, 707 STATE_INIT, 708 STATE_ADDDATASINK_VIDEO, 709 STATE_ADDDATASINK_AUDIO, 710 STATE_SETPLAYBACKRANGE_BEFORESTART, 711 STATE_PREPARE, 712 STATE_PREPARE_AFTERSTOP, 713 STATE_GETMETADATAKEYLIST, 714 STATE_GETMETADATAVALUELIST, 715 STATE_WAIT_FOR_DATAREADY, 716 STATE_WAIT_FOR_BUFFCOMPLETE, 717 STATE_START, 718 STATE_START_AFTERSTOP, 719 STATE_SETPLAYBACKRANGE, 720 STATE_PAUSE, 721 STATE_SETPLAYBACKRANGE_AFTERSTART, 722 STATE_RESUME, 723 STATE_PAUSE_TWICE, 724 STATE_SETPLAYBACKRANGE_AFTERSTART_TWICE, 725 STATE_RESUME_TWICE, 726 STATE_PAUSE_AFTERDOWNLOADCOMPLETE, 727 STATE_SETPLAYBACKRANGE_AFTERDOWNLOADCOMPLETE, 728 STATE_RESUME_AFTERDOWNLOADCOMPLETE, 729 STATE_STOP, 730 STATE_STOP_TWICE, 731 STATE_REMOVEDATASINK_VIDEO, 732 STATE_REMOVEDATASINK_AUDIO, 733 STATE_RESET, 734 STATE_REMOVEDATASOURCE, 735 STATE_CLEANUPANDCOMPLETE 736 }; 737 738 PVTestState iState; 739 740 PVPlayerInterface* iPlayer; 741 PVPlayerDataSourceURL* iDataSource; 742 PVPlayerDataSink* iDataSinkVideo; 743 PVPlayerDataSink* iDataSinkAudio; 744 PVMFNodeInterface* iIONodeVideo; 745 PVMFNodeInterface* iIONodeAudio; 746 PvmiMIOControl* iMIOFileOutVideo; 747 PvmiMIOControl* iMIOFileOutAudio; 748 PVMFSourceContextData* iDownloadContextData; 749 750 OSCL_wHeapString<OsclMemAllocator> iDownloadURL; 751 OSCL_wHeapString<OsclMemAllocator> iDownloadFilename; 752 OSCL_HeapString<OsclMemAllocator> iDownloadProxy; 753 OSCL_wHeapString<OsclMemAllocator> iDownloadConfigFilename; 754 755 PVCommandId iCurrentCmdId; 756 PVLogger* iLogger; 757 758 virtual void CreateDataSource() = 0; 759 virtual void CreateDataSinkVideo() = 0; 760 virtual void CreateDataSinkAudio() = 0; CleanupData()761 virtual void CleanupData() {} 762 763 void PrintMetadata(); 764 PVPMetadataList iMetadataKeyList; 765 Oscl_Vector<PvmiKvp, OsclMemAllocator> iMetadataValueList; 766 int32 iNumValues; 767 768 int32 iNumBufferingStart; 769 int32 iNumBufferingComplete; 770 int32 iNumUnderflow; 771 int32 iNumDataReady; 772 int32 iNumEOS; 773 774 bool iContentTooLarge; 775 enableReposAfterDownloadComplete()776 void enableReposAfterDownloadComplete() 777 { 778 iRepositionAfterDownloadComplete = true; 779 } 780 bool iRepositionAfterDownloadComplete; 781 enablePlayUntilEOS()782 void enablePlayUntilEOS() 783 { 784 iPlayUntilEOS = true; 785 } 786 bool iPlayUntilEOS; 787 enableShortPauseResume()788 void enableShortPauseResume() 789 { 790 iShortPauseResume = true; 791 } 792 bool iShortPauseResume; 793 enableLongPauseResume()794 void enableLongPauseResume() 795 { 796 iLongPauseResume = true; 797 } 798 bool iLongPauseResume; 799 enableSeekAfterStart()800 void enableSeekAfterStart() 801 { 802 iSeekAfterStart = true; 803 } 804 bool iSeekAfterStart; 805 enableSeekBeforeStart()806 void enableSeekBeforeStart() 807 { 808 iSeekBeforeStart = true; 809 } 810 bool iSeekBeforeStart; 811 enableTwice()812 void enableTwice() 813 { 814 iTwice = true; 815 } 816 bool iTwice; 817 enableLoop()818 void enableLoop() 819 { 820 iLoop = iLoopReq = 10; 821 } 822 int32 iLoop; 823 int32 iLoopReq; 824 enableForwardStep()825 void enableForwardStep() 826 { 827 iForwardStep = true; 828 // the following value are in millisecs 829 iBeginTime = 0; 830 iEndTime = 250 * 1000; 831 iForwardSeekStep = 2 * 1000; 832 iForwardSeekTime = 60 * 1000; 833 iStepInterval = 5 * 1000; 834 } 835 int32 iStepInterval; 836 int32 iBeginTime; 837 int32 iEndTime; 838 bool iForwardStep; 839 int32 iForwardSeekStep; 840 int32 iForwardSeekTime; 841 bool iBackwardStep; 842 int32 iBackwardSeekStep; 843 int32 iBackwardSeekTime; 844 enableSeekAfterDownloadComplete()845 void enableSeekAfterDownloadComplete() 846 { 847 iSeekAfterDownloadComplete = true; 848 } 849 bool iSeekAfterDownloadComplete; 850 enableSeekToBOC()851 void enableSeekToBOC() 852 { 853 iSeekToBOC = true; 854 } 855 bool iSeekToBOC; 856 enableSeekInCache()857 void enableSeekInCache() 858 { 859 iSeekInCache = true; 860 } 861 bool iSeekInCache; 862 enableEOSStopPlay()863 void enableEOSStopPlay() 864 { 865 iEOSStopPlay = true; 866 } 867 bool iEOSStopPlay; 868 setShoutcastSessionDuration()869 void setShoutcastSessionDuration() 870 { 871 iSCListenTime = 5 * 60 * 1000 * 1000; 872 } 873 bool iShoutcastSession; 874 int32 iSCListenTime; 875 bool iShoutcastPlayStopPlay; 876 enableShoutcastPauseResume()877 void enableShoutcastPauseResume() 878 { 879 iSCListenTime = 1 * 60 * 1000 * 1000; 880 enableShortPauseResume(); 881 } 882 enableShoutcastPlayStopPlay()883 void enableShoutcastPlayStopPlay() 884 { 885 iSCListenTime = 30 * 1000 * 1000; 886 iShoutcastPlayStopPlay = true; 887 } 888 889 //for janus drm. 890 void PrintJanusError(const PVCmdResponse& aResponse); 891 892 uint32 iSessionDuration; 893 894 private: 895 void HandleProtocolEngineNodeErrors(int32 aErr); 896 void HandleSocketNodeErrors(int32 aErr); 897 private: 898 PvmiCapabilityAndConfig* iPlayerCapConfigIF; 899 PvmiKvp* iErrorKVP; 900 PvmiKvp iKVPSetAsync; 901 OSCL_StackString<256> iKeyStringSetAsync; 902 }; 903 904 905 class pvplayer_async_test_ppb_normal : public pvplayer_async_test_ppb_base 906 { 907 public: pvplayer_async_test_ppb_normal(PVPlayerAsyncTestParam aTestParam)908 pvplayer_async_test_ppb_normal(PVPlayerAsyncTestParam aTestParam): 909 pvplayer_async_test_ppb_base(aTestParam) 910 { 911 iDownloadContextData = NULL; 912 iLogger = PVLogger::GetLoggerObject("pvplayer_async_test_ppb_normal"); 913 iTestCaseName = _STRLIT_CHAR("Progressive Playback Normal"); 914 } 915 916 ~pvplayer_async_test_ppb_normal(); 917 918 void CreateDataSource(); 919 void CreateDataSinkVideo(); 920 void CreateDataSinkAudio(); 921 }; 922 923 /*! 924 * A test case to test the normal PDL Pause Resume After UnderFlow and playback from an HTTP URL. 925 * - Data Source: http://0.0.0.0/test.3gp 926 * - Data Sink(s): Video[FileOutputNode-test_player_3gppdlnormal_video.dat]\n 927 * Audio[FileOutputNode-test_player_3gppdlnormal_audio.dat] 928 * - Sequence: 929 * -# CreatePlayer() 930 * -# AddDataSource() 931 * -# Init() 932 * -# AddDataSink() (video) 933 * -# AddDataSink() (audio) 934 * -# Prepare() 935 * -# Wait for Data Ready event 936 * -# Start() 937 * -# After getting UnderFlow event 938 * -# Pause() 939 * -# Resume() 940 * -# Play until either EOS is reached or 10 seconds after download 941 * finishes. 942 * -# Stop() 943 * -# RemoveDataSink() (video) 944 * -# RemoveDataSink() (audio) 945 * -# Reset() 946 * -# RemoveDataSource() 947 * -# DeletePlayer() 948 * 949 */ 950 class pvplayer_async_test_PDLPauseResumeAfterUnderFlow : public pvplayer_async_test_downloadbase 951 { 952 public: pvplayer_async_test_PDLPauseResumeAfterUnderFlow(PVPlayerAsyncTestParam aTestParam)953 pvplayer_async_test_PDLPauseResumeAfterUnderFlow(PVPlayerAsyncTestParam aTestParam): 954 pvplayer_async_test_downloadbase(aTestParam) 955 { 956 iLogger = PVLogger::GetLoggerObject("pvplayer_async_test_PDLPauseResumeAfterUnderFlow"); 957 iTestCaseName = _STRLIT_CHAR("PDL Pause Resume After UnderFlow"); 958 } 959 960 ~pvplayer_async_test_PDLPauseResumeAfterUnderFlow(); 961 962 void CreateDataSource(); 963 void CreateDataSinkVideo(); 964 void CreateDataSinkAudio(); 965 void CleanupData(); 966 }; 967 968 #endif // TEST_PV_PLAYER_ENGINE_TESTSET5_H_INCLUDED 969 970