Home | History | Annotate | Download | only in src
      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_TESTSET_CPMDLAPASSTHRU_H_INCLUDED
     19 #include "test_pv_player_engine_testset_cpmdlapassthru.h"
     20 #endif
     21 
     22 #ifndef OSCL_ERROR_CODES_H_INCLUDED
     23 #include "oscl_error_codes.h"
     24 #endif
     25 
     26 #ifndef OSCL_TICKCOUNT_H_INCLUDED
     27 #include "oscl_tickcount.h"
     28 #endif
     29 
     30 #ifndef OSCL_UTF8CONV_H
     31 #include "oscl_utf8conv.h"
     32 #endif
     33 
     34 #ifndef PV_PLAYER_DATASOURCEURL_H_INCLUDED
     35 #include "pv_player_datasourceurl.h"
     36 #endif
     37 
     38 #ifndef PV_PLAYER_DATASINKFILENAME_H_INCLUDED
     39 #include "pv_player_datasinkfilename.h"
     40 #endif
     41 
     42 #ifndef PV_PLAYER_DATASINKPVMFNODE_H_INCLUDED
     43 #include "pv_player_datasinkpvmfnode.h"
     44 #endif
     45 
     46 #ifndef PVMI_MEDIA_IO_FILEOUTPUT_H_INCLUDED
     47 #include "pvmi_media_io_fileoutput.h"
     48 #endif
     49 
     50 #ifndef PV_MEDIA_OUTPUT_NODE_FACTORY_H_INCLUDED
     51 #include "pv_media_output_node_factory.h"
     52 #endif
     53 
     54 #ifndef PVMF_ERRORINFOMESSAGE_EXTENSION_H_INCLUDED
     55 #include "pvmf_errorinfomessage_extension.h"
     56 #endif
     57 
     58 #ifndef PVMF_SOCKET_NODE_EVENTS_H_INCLUDED
     59 #include "pvmf_socket_node_events.h"
     60 #endif
     61 
     62 #ifndef PVMF_SM_NODE_EVENTS_H_INCLUDED
     63 #include "pvmf_sm_node_events.h"
     64 #endif
     65 
     66 #ifndef PVMI_KVP_H_INCLUDED
     67 #include "pvmi_kvp.h"
     68 #endif
     69 
     70 #ifndef PVMI_KVP_UTIL_H_INCLUDED
     71 #include "pvmi_kvp_util.h"
     72 #endif
     73 
     74 #ifndef PVMF_NODE_INTERFACE_H_INCLUDED
     75 #include "pvmf_node_interface.h"
     76 #endif
     77 
     78 #ifndef PVMF_PROTOCOL_ENGINE_NODE_EVENTS_H_INCLUDED
     79 #include "pvmf_protocol_engine_node_events.h"
     80 #endif
     81 
     82 #ifndef PVMF_LOCAL_DATA_SOURCE_H_INCLUDED
     83 #include "pvmf_local_data_source.h"
     84 #endif
     85 
     86 #ifndef PVMF_CPMPLUGIN_PASSTHRU_OMA1_FACTORY_H_INCLUDED
     87 #include "pvmf_cpmplugin_passthru_oma1_factory.h"
     88 #endif
     89 
     90 #ifndef PVMF_CPMPLUGIN_PASSTHRU_OMA1_TYPES_H_INCLUDED
     91 #include "pvmf_cpmplugin_passthru_oma1_types.h"
     92 #endif
     93 
     94 #include "pvmi_media_io_fileoutput.h"
     95 #include "pv_media_output_node_factory.h"
     96 
     97 #ifndef PV_PLAYER_LICENSE_ACQUISITION_INTERFACE_H_INCLUDED
     98 #include "pv_player_license_acquisition_interface.h"
     99 #endif
    100 
    101 //Default Fast-track download file
    102 #define DEFAULT_FASTTRACK_DL_FILE "test.pvx"
    103 #undef USE_NEW_PVMF_COMMONSOURCE_CONTEXT_DATA
    104 #define USE_NEW_PVMF_COMMONSOURCE_CONTEXT_DATA 1
    105 #define USE_NEW_PVMF_SOURCE_CONTEXT_DATA    1
    106 #define DLA_TIMEOUT_MSEC (30*1000)
    107 //
    108 // pvplayer_async_test_cpmdlapassthru section
    109 //
    110 void pvplayer_async_test_cpmdlapassthru::CreateDownloadDataSource()
    111 {
    112 #if RUN_FASTTRACK_TESTCASES
    113     if (iFileType == PVMF_MIME_DATA_SOURCE_PVX_FILE)
    114     {
    115         //fasttrack download using PVX.
    116         //read the pvx file into a memory fragment.
    117         OsclMemoryFragment pvxmemfrag;
    118         {
    119             Oscl_FileServer fs;
    120             fs.Connect();
    121             Oscl_File file;
    122             OSCL_StackString<64> filename;
    123 
    124             if (oscl_strstr(iFileName, DEFAULTSOURCEFILENAME) != NULL)
    125             {
    126                 filename = SOURCENAME_PREPEND_STRING;
    127                 filename += DEFAULT_FASTTRACK_DL_FILE;
    128             }
    129             else
    130             {
    131                 filename = iFileName;
    132             }
    133 
    134             if (file.Open(filename.get_str(), Oscl_File::MODE_READ | Oscl_File::MODE_TEXT, fs))
    135             {
    136                 PVPATB_TEST_IS_TRUE(false);
    137                 iObserver->TestCompleted(*iTestCase);
    138                 return;
    139             }
    140 
    141             int32 size = file.Read(iPVXFileBuf, 1, 4096);
    142             pvxmemfrag.len = size;
    143             pvxmemfrag.ptr = iPVXFileBuf;
    144             file.Close();
    145             fs.Close();
    146         }
    147 
    148         //Parse, extracting iDownloadPvxInfo and url8.
    149         OSCL_HeapString<OsclMemAllocator> url8;
    150         {
    151             CPVXParser* parser = NULL;
    152             parser = new CPVXParser;
    153             if (parser == NULL)
    154             {
    155                 PVPATB_TEST_IS_TRUE(false);
    156                 iObserver->TestCompleted(*iTestCase);
    157                 return;
    158             }
    159             CPVXParser::CPVXParserStatus status = parser->ParsePVX(pvxmemfrag, url8, iDownloadPvxInfo);
    160             delete parser;
    161             if (status != CPVXParser::CPVXParser_Success)
    162             {
    163                 PVPATB_TEST_IS_TRUE(false);
    164                 iObserver->TestCompleted(*iTestCase);
    165                 return;
    166             }
    167             //set the playback mode in the test case base class to match
    168             //the PVX setting.
    169             switch (iDownloadPvxInfo.iPlaybackControl)
    170             {
    171                 case CPVXInfo::ENoPlayback:
    172                     iDownloadOnly = true;
    173                     break;
    174                 case CPVXInfo::EAfterDownload:
    175                     iDownloadThenPlay = true;
    176                     break;
    177                 case CPVXInfo::EAsap:
    178                     break;
    179                 default:
    180                     break;
    181             }
    182         }
    183 
    184         //convert the url8 to unicode iDownloadURL
    185         {
    186             oscl_wchar* wtemp = new oscl_wchar[url8.get_size()+1];
    187             if (wtemp == NULL)
    188             {
    189                 // Memory allocation failure
    190                 PVPATB_TEST_IS_TRUE(false);
    191                 iObserver->TestCompleted(*iTestCase);
    192                 return;
    193             }
    194             int32 wtemplen = oscl_UTF8ToUnicode(url8.get_cstr(), url8.get_size(), wtemp, url8.get_size() + 1);
    195             //iDownloadURL.set(wtemp, wtemplen);
    196             wFileName.set(wtemp, wtemplen);
    197             delete [] wtemp;
    198         }
    199     }
    200 #endif
    201 
    202     //create the opaque data
    203     iDownloadProxy = _STRLIT_CHAR("");
    204 
    205     iDownloadConfigFilename = OUTPUTNAME_PREPEND_WSTRING;
    206     iDownloadConfigFilename += _STRLIT_WCHAR("mydlconfig");
    207 
    208     iDownloadMaxfilesize = 0x7FFFFFFF;
    209 
    210     iDownloadFilename = OUTPUTNAME_PREPEND_WSTRING;
    211     iDownloadFilename += _STRLIT_WCHAR("test_ftdownload.dl");
    212     iContentTooLarge = false;
    213 
    214 #if RUN_FASTTRACK_TESTCASES
    215     int32 iDownloadProxyPort = 0;
    216     bool aIsNewSession = true;
    217 
    218     if (iFileType == PVMF_MIME_DATA_SOURCE_PVX_FILE)
    219     {
    220         iDownloadContextDataPVX = new PVMFDownloadDataSourcePVX(aIsNewSession, iDownloadConfigFilename, iDownloadFilename, \
    221                 iDownloadMaxfilesize,
    222                 iDownloadProxy,
    223                 iDownloadProxyPort,
    224                 iDownloadPvxInfo);
    225     }
    226 #endif
    227 }
    228 
    229 void pvplayer_async_test_cpmdlapassthru::StartTest()
    230 {
    231     AddToScheduler();
    232     iState = STATE_CREATE;
    233     RunIfNotReady();
    234 }
    235 
    236 
    237 void pvplayer_async_test_cpmdlapassthru::Run()
    238 {
    239     int error = 0;
    240 
    241     switch (iState)
    242     {
    243         case STATE_CREATE:
    244         {
    245             iPlayer = NULL;
    246             fprintf(iTestMsgOutputFile, "***Creating Player Engine...\n");
    247             OSCL_TRY(error, iPlayer = PVPlayerFactory::CreatePlayer(this, this, this));
    248             if (error)
    249             {
    250                 PVPATB_TEST_IS_TRUE(false);
    251                 iObserver->TestCompleted(*iTestCase);
    252             }
    253             else
    254             {
    255                 iState = STATE_QUERYINTERFACE;
    256                 RunIfNotReady();
    257             }
    258         }
    259         break;
    260 
    261         case STATE_QUERYINTERFACE:
    262         {
    263             fprintf(iTestMsgOutputFile, "***Query Interface...\n");
    264             PVUuid capconfigifuuid = PVMI_CAPABILITY_AND_CONFIG_PVUUID;
    265             OSCL_TRY(error, iCurrentCmdId = iPlayer->QueryInterface(capconfigifuuid, (PVInterface*&)iPlayerCapConfigIF, (OsclAny*) & iContextObject));
    266             OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady());
    267         }
    268         break;
    269 
    270         case STATE_ADDDATASOURCE:
    271         {
    272             fprintf(iTestMsgOutputFile, "***Adding Data Source...\n");
    273             PVMFFormatType fileType = iFileType;
    274 
    275             iDataSource = new PVPlayerDataSourceURL;
    276             OSCL_HeapString<OsclMemAllocator> filename;
    277 
    278             filename = iFileName;
    279             oscl_UTF8ToUnicode(filename.get_str(), filename.get_size(), output, 256);
    280             wFileName.set(output, oscl_strlen(output));
    281 
    282             if (iFileType == PVMF_MIME_DATA_SOURCE_HTTP_URL)
    283             {
    284                 fileType = PVMF_MIME_DATA_SOURCE_MS_HTTP_STREAMING_URL;
    285                 //We will change the iFileType if we need to do ProtocolRollover
    286                 //iFileType = fileType;
    287                 if (iProtocolRollOverWithUnknownURLType == false)
    288                 {
    289 #ifdef USE_NEW_PVMF_COMMONSOURCE_CONTEXT_DATA
    290                     iSourceContextData = new PVMFSourceContextData();
    291                     iSourceContextData->EnableCommonSourceContext();
    292 
    293                     PVInterface* sourceContextStream = NULL;
    294 
    295                     iSourceContextData->EnableStreamingSourceContext();
    296                     PVUuid streamingContextUuid(PVMF_SOURCE_CONTEXT_DATA_STREAMING_UUID);
    297                     if (iSourceContextData->queryInterface(streamingContextUuid, sourceContextStream))
    298                     {
    299                         PVMFSourceContextDataStreaming* streamingContext =
    300                             OSCL_STATIC_CAST(PVMFSourceContextDataStreaming*, sourceContextStream);
    301                         streamingContext->iStreamStatsLoggingURL = wFileName;
    302                     }
    303 
    304                     PVInterface* sourceContextDownload = NULL;
    305                     iSourceContextData->EnableDownloadHTTPSourceContext();
    306                     PVUuid downloadContextUuid(PVMF_SOURCE_CONTEXT_DATA_DOWNLOAD_HTTP_UUID);
    307                     if (iSourceContextData->queryInterface(downloadContextUuid, sourceContextDownload))
    308                     {
    309                         //create the opaque data
    310                         iDownloadProxy = _STRLIT_CHAR("");
    311                         int32 iDownloadProxyPort = 0;
    312                         iDownloadConfigFilename = OUTPUTNAME_PREPEND_WSTRING;
    313                         iDownloadConfigFilename += _STRLIT_WCHAR("mydlconfig");
    314                         iDownloadMaxfilesize = 0x7FFFFFFF;
    315                         iDownloadFilename = OUTPUTNAME_PREPEND_WSTRING;
    316                         iDownloadFilename += _STRLIT_WCHAR("test_ftdownload.dl");
    317                         bool aIsNewSession = true;
    318 
    319                         iSourceContextData->DownloadHTTPData()->bIsNewSession = aIsNewSession;
    320                         iSourceContextData->DownloadHTTPData()->iConfigFileName = iDownloadConfigFilename;
    321                         iSourceContextData->DownloadHTTPData()->iDownloadFileName = iDownloadFilename;
    322                         iSourceContextData->DownloadHTTPData()->iMaxFileSize = iDownloadMaxfilesize;
    323                         iSourceContextData->DownloadHTTPData()->iPlaybackControl = PVMFSourceContextDataDownloadHTTP::EAsap;
    324                         iSourceContextData->DownloadHTTPData()->iProxyName = iDownloadProxy;
    325                         iSourceContextData->DownloadHTTPData()->iProxyPort = iDownloadProxyPort;
    326 
    327                     }
    328                     iDataSource->SetDataSourceContextData((OsclAny*)iSourceContextData);
    329 #else
    330                     //set logging url
    331                     iStreamDataSource = new PVMFStreamingDataSource();
    332                     iStreamDataSource->iStreamStatsLoggingURL = wFileName;
    333                     iDataSource->SetDataSourceContextData((OsclAny*)iStreamDataSource);
    334 #endif
    335                 }
    336             }
    337             else if (iFileType == PVMF_MIME_DATA_SOURCE_PVX_FILE)
    338             {
    339                 CreateDownloadDataSource();
    340                 fileType = PVMF_MIME_DATA_SOURCE_PVX_FILE;
    341                 iDataSource->SetDataSourceContextData((OsclAny*)iDownloadContextDataPVX);
    342             }
    343             else if ((iFileType == PVMF_MIME_DATA_SOURCE_RTSP_URL)
    344                      || (iFileType == PVMF_MIME_DATA_SOURCE_SDP_FILE))
    345             {
    346 #ifdef USE_NEW_PVMF_SOURCE_CONTEXT_DATA
    347                 iSourceContextData = new PVMFSourceContextData();
    348                 iSourceContextData->EnableStreamingSourceContext();
    349 
    350                 PVInterface* sourceContext = NULL;
    351                 PVUuid streamingContextUuid(PVMF_SOURCE_CONTEXT_DATA_STREAMING_UUID);
    352                 if (iSourceContextData->queryInterface(streamingContextUuid, sourceContext))
    353                 {
    354                     PVMFSourceContextDataStreaming* streamingContext =
    355                         OSCL_STATIC_CAST(PVMFSourceContextDataStreaming*, sourceContext);
    356                     streamingContext->iStreamStatsLoggingURL = wFileName;
    357                 }
    358                 iDataSource->SetDataSourceContextData((OsclAny*)iSourceContextData);
    359 #endif
    360             }
    361             else
    362             {
    363                 //Create a data source
    364                 iLocalDataSource = new PVMFLocalDataSource();
    365                 iDataSource->SetDataSourceContextData((OsclAny*)iLocalDataSource);
    366             }
    367 
    368             if (iProtocolRollOver)
    369             {
    370                 if (fileType == PVMF_MIME_DATA_SOURCE_MS_HTTP_STREAMING_URL)
    371                 {
    372                     fileType = PVMF_MIME_DATA_SOURCE_HTTP_URL;
    373                     iDataSource->SetAlternateSourceFormatType(PVMF_MIME_DATA_SOURCE_MS_HTTP_STREAMING_URL);
    374                 }
    375                 else if (fileType == PVMF_MIME_DATA_SOURCE_REAL_HTTP_CLOAKING_URL)
    376                 {
    377                     fileType = PVMF_MIME_DATA_SOURCE_RTSP_URL;
    378 #if RUN_RTSP_CLOAKING_TESTCASES
    379                     iDataSource->SetAlternateSourceFormatType(PVMF_MIME_DATA_SOURCE_REAL_HTTP_CLOAKING_URL);
    380 #endif
    381                 }
    382                 else if (fileType == PVMF_MIME_DATA_SOURCE_RTSP_URL)
    383                 {
    384                     fileType = PVMF_MIME_DATA_SOURCE_HTTP_URL;
    385                     iDataSource->SetAlternateSourceFormatType(PVMF_MIME_DATA_SOURCE_RTSP_URL);
    386                 }
    387             }
    388             else if (iProtocolRollOverWithUnknownURLType)
    389             {
    390                 fileType = PVMF_MIME_DATA_SOURCE_UNKNOWN_URL;
    391             }
    392 
    393             //This illustrates the use of CPM with a file source.
    394 
    395             //Connect to plugin registry
    396             PVMFStatus status;
    397             status = iPluginRegistryClient.Connect();
    398             if (status != PVMFSuccess)
    399             {
    400                 PVPATB_TEST_IS_TRUE(false);
    401                 iState = STATE_CLEANUPANDCOMPLETE;
    402                 RunIfNotReady();
    403                 break;
    404             }
    405             bool aAuthorizeFail = false;
    406             bool aCancelAcquireLicense = false;
    407             bool aSourceInitDataNotSupported = false;
    408             PVMFCPMContentType aCPMContentType = PVMF_CPM_FORMAT_AUTHORIZE_BEFORE_ACCESS;
    409             switch (iTestMode)
    410             {
    411                 case OMA1_DLA_FAIL:
    412                 {
    413                     aAuthorizeFail = true;
    414                 }
    415                 break;
    416 
    417                 case OMA1_DLA_NORMAL:
    418                 {
    419                     aAuthorizeFail = false;
    420                 }
    421                 break;
    422 
    423                 case OMA1_DLA_UNKNOWN_CPM_CONTENTTYPE:
    424                 {
    425                     //not relevant as we do not do RequestUsage
    426                     aAuthorizeFail = false;
    427                     aCPMContentType = PVMF_CPM_CONTENT_FORMAT_UNKNOWN;
    428                 }
    429                 break;
    430 
    431                 case OMA1_DLA_CANCEL_ACQUIRE_LICENSE_FAILS:
    432                 {
    433                     aAuthorizeFail = true;
    434                 }
    435                 break;
    436 
    437                 case OMA1_DLA_CANCEL_ACQUIRE_LICENSE_SUCCEEDS:
    438                 {
    439                     aAuthorizeFail = true;
    440                     aCancelAcquireLicense = true;
    441                 }
    442                 break;
    443 
    444                 case OMA1_DLA_CONTENT_NOTSUPPORTED:
    445                 {
    446                     aSourceInitDataNotSupported = true;
    447                 }
    448                 break;
    449                 //Default case shud not arise so error out
    450                 default:
    451                 {
    452                     PVPATB_TEST_IS_TRUE(false);
    453                     iState = STATE_CLEANUPANDCOMPLETE;
    454                     return;
    455                 }
    456             }
    457 
    458             iPluginFactory = new PVMFOma1PassthruPluginFactory(aAuthorizeFail, aCancelAcquireLicense,
    459                     aSourceInitDataNotSupported, aCPMContentType);
    460             if (!iPluginFactory)
    461             {
    462                 PVPATB_TEST_IS_TRUE(false);
    463                 iState = STATE_CLEANUPANDCOMPLETE;
    464                 RunIfNotReady();
    465                 break;
    466             }
    467             //Register the passthru plugin factory.
    468             iPluginMimeType = PVMF_CPM_MIME_PASSTHRU_OMA1;
    469             if (iPluginRegistryClient.RegisterPlugin(iPluginMimeType, *iPluginFactory) != PVMFSuccess)
    470             {
    471                 PVPATB_TEST_IS_TRUE(false);
    472                 iState = STATE_CLEANUPANDCOMPLETE;
    473                 RunIfNotReady();
    474                 break;
    475             }
    476 
    477             iDataSource->SetDataSourceURL(wFileName);
    478 
    479             iDataSource->SetDataSourceFormatType(fileType);
    480             OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject));
    481             OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady());
    482             iNumPlay++;
    483         }
    484         break;
    485 
    486         case STATE_CONFIGPARAMS:
    487         {
    488             fprintf(iTestMsgOutputFile, "***Configuring Params...\n");
    489             iKeyStringSetAsync = _STRLIT_CHAR("x-pvmf/net/user-agent;valtype=wchar*");
    490             iKVPSetAsync.key = iKeyStringSetAsync.get_str();
    491             OSCL_wHeapString<OsclMemAllocator> userAgent;
    492             if (iFileType == PVMF_MIME_DATA_SOURCE_PVX_FILE)
    493             {
    494                 userAgent = _STRLIT_WCHAR("PVPLAYER 18.07.00.02");
    495             }
    496             else
    497             {
    498                 userAgent = _STRLIT_WCHAR("NSPlayer/9.0 PVPlayerCoreEngineTestUserAgent");
    499             }
    500             iKVPSetAsync.value.pWChar_value = userAgent.get_str();
    501             iErrorKVP = NULL;
    502             OSCL_TRY(error, iPlayerCapConfigIF->setParametersSync(NULL, &iKVPSetAsync, 1, iErrorKVP));
    503             OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); return);
    504 
    505             iKeyStringSetAsync = _STRLIT_CHAR("x-pvmf/net/protocol-extension-header;valtype=char*");
    506             iKVPSetAsync.key = iKeyStringSetAsync.get_str();
    507             OSCL_HeapString<OsclMemAllocator> protocolExtensionHeader(_STRLIT_CHAR("key=PVPlayerCoreEngineTest;value=Test;method=GET,POST"));
    508             iKVPSetAsync.value.pChar_value = protocolExtensionHeader.get_str();
    509             iKVPSetAsync.capacity = protocolExtensionHeader.get_size();
    510             iErrorKVP = NULL;
    511             OSCL_TRY(error, iPlayerCapConfigIF->setParametersSync(NULL, &iKVPSetAsync, 1, iErrorKVP));
    512             OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); return);
    513 
    514             iKeyStringSetAsync = _STRLIT_CHAR("x-pvmf/net/protocol-extension-header;valtype=char*;mode=streaming;purge-on-redirect");
    515             iKVPSetAsync.key = iKeyStringSetAsync.get_str();
    516             OSCL_HeapString<OsclMemAllocator> protocolExtensionHeaderGet(_STRLIT_CHAR("key=PVPlayerCoreEngineTest;value=GetHeader;method=GET"));
    517             iKVPSetAsync.value.pChar_value = protocolExtensionHeaderGet.get_str();
    518             iKVPSetAsync.capacity = protocolExtensionHeaderGet.get_size();
    519             iErrorKVP = NULL;
    520             OSCL_TRY(error, iPlayerCapConfigIF->setParametersSync(NULL, &iKVPSetAsync, 1, iErrorKVP));
    521             OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); return);
    522 
    523             iKeyStringSetAsync = _STRLIT_CHAR("x-pvmf/net/protocol-extension-header;valtype=char*;purge-on-redirect");
    524             iKVPSetAsync.key = iKeyStringSetAsync.get_str();
    525             OSCL_HeapString<OsclMemAllocator> protocolExtensionHeaderGet1(_STRLIT_CHAR("key=PVPlayerCoreEngineTest;value=GetHeader1;method=GET"));
    526             iKVPSetAsync.value.pChar_value = protocolExtensionHeaderGet1.get_str();
    527             iKVPSetAsync.capacity = protocolExtensionHeaderGet1.get_size();
    528             iErrorKVP = NULL;
    529             OSCL_TRY(error, iPlayerCapConfigIF->setParametersSync(NULL, &iKVPSetAsync, 1, iErrorKVP));
    530             OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); return);
    531 
    532             // should not display
    533             iKeyStringSetAsync = _STRLIT_CHAR("x-pvmf/net/protocol-extension-header;valtype=char*;mode=download");
    534             iKVPSetAsync.key = iKeyStringSetAsync.get_str();
    535             OSCL_HeapString<OsclMemAllocator> protocolExtensionHeaderGet2(_STRLIT_CHAR("key=PVPlayerCoreEngineTest;value=GetHeader2;method=GET"));
    536             iKVPSetAsync.value.pChar_value = protocolExtensionHeaderGet2.get_str();
    537             iKVPSetAsync.capacity = protocolExtensionHeaderGet2.get_size();
    538             iErrorKVP = NULL;
    539             OSCL_TRY(error, iPlayerCapConfigIF->setParametersSync(NULL, &iKVPSetAsync, 1, iErrorKVP));
    540             OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); return);
    541 
    542 
    543 
    544             iKeyStringSetAsync = _STRLIT_CHAR("x-pvmf/net/protocol-extension-header;valtype=char*");
    545             iKVPSetAsync.key = iKeyStringSetAsync.get_str();
    546             OSCL_HeapString<OsclMemAllocator> protocolExtensionHeaderPost(_STRLIT_CHAR("key=PVPlayerCoreEngineTest;value=PostHeader;method=POST"));
    547             iKVPSetAsync.value.pChar_value = protocolExtensionHeaderPost.get_str();
    548             iKVPSetAsync.capacity = protocolExtensionHeaderPost.get_size();
    549             iErrorKVP = NULL;
    550             OSCL_TRY(error, iPlayerCapConfigIF->setParametersSync(NULL, &iKVPSetAsync, 1, iErrorKVP));
    551             OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); return);
    552 
    553             // Unnecessary Header should not display
    554             iKeyStringSetAsync = _STRLIT_CHAR("x-pvmf/net/protocol-extension-header;valtype=char*");
    555             iKVPSetAsync.key = iKeyStringSetAsync.get_str();
    556             OSCL_HeapString<OsclMemAllocator> protocolExtensionHeaderHead(_STRLIT_CHAR("key=PVPlayerCoreEngineTest;value=HeadHeader;method=HEAD"));
    557             iKVPSetAsync.value.pChar_value = protocolExtensionHeaderHead.get_str();
    558             iKVPSetAsync.capacity = protocolExtensionHeaderHead.get_size();
    559             iErrorKVP = NULL;
    560             OSCL_TRY(error, iPlayerCapConfigIF->setParametersSync(NULL, &iKVPSetAsync, 1, iErrorKVP));
    561             OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); return);
    562 
    563 
    564 
    565             iKeyStringSetAsync = _STRLIT_CHAR("x-pvmf/net/num-redirect-attempts;valtype=uint32");
    566             iKVPSetAsync.key = iKeyStringSetAsync.get_str();
    567             iKVPSetAsync.value.uint32_value = 2;
    568             iErrorKVP = NULL;
    569             OSCL_TRY(error, iPlayerCapConfigIF->setParametersSync(NULL, &iKVPSetAsync, 1, iErrorKVP));
    570             OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); return);
    571 
    572             iKeyStringSetAsync = _STRLIT_CHAR("x-pvmf/net/http-timeout;valtype=uint32");
    573             iKVPSetAsync.key = iKeyStringSetAsync.get_str();
    574             iKVPSetAsync.value.uint32_value = 20;
    575             iErrorKVP = NULL;
    576             OSCL_TRY(error, iPlayerCapConfigIF->setParametersSync(NULL, &iKVPSetAsync, 1, iErrorKVP));
    577             OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); return);
    578 
    579 
    580             iKeyStringSetAsync = _STRLIT_CHAR("x-pvmf/net/keep-alive-interval;valtype=uint32");
    581             iKVPSetAsync.key = iKeyStringSetAsync.get_str();
    582             iKVPSetAsync.value.uint32_value = 4; //0xffffffff;
    583             iErrorKVP = NULL;
    584             OSCL_TRY(error, iPlayerCapConfigIF->setParametersSync(NULL, &iKVPSetAsync, 1, iErrorKVP));
    585             OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); return);
    586             iState = STATE_INIT;
    587             RunIfNotReady();
    588         }
    589         break;
    590 
    591         case STATE_INIT:
    592         {
    593             fprintf(iTestMsgOutputFile, "***Initializing...\n");
    594             OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject));
    595             OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady());
    596         }
    597         break;
    598         case STATE_QUERYLICENSEACQIF:
    599         {
    600             // Request the license acquisition interface.
    601             PVUuid uuid(PVPlayerLicenseAcquisitionInterfaceUuid);
    602             OSCL_TRY(error, iCurrentCmdId = iPlayer->QueryInterface(uuid, (PVInterface*&)iLicenseIF, (OsclAny*) & iContextObject));
    603             OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady());
    604         }
    605         break;
    606 
    607         case STATE_ACQUIRELICENSE:
    608         {
    609             fprintf(iTestMsgOutputFile, "Acquiring License...");
    610             OSCL_TRY(error, iAcquireLicenseCmdId = iLicenseIF->AcquireLicense(
    611                                                        NULL , 0 //DLA data
    612                                                        , (oscl_wchar*)wFileName.get_cstr() //content name
    613                                                        , DLA_TIMEOUT_MSEC););
    614             OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); fprintf(iTestMsgOutputFile, "... Failed\n"); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady());
    615             //Fire CancelAcquireLic only for this testcase
    616             if (iTestMode == OMA1_DLA_CANCEL_ACQUIRE_LICENSE_SUCCEEDS)
    617             {
    618                 iState = STATE_CANCEL_ACQUIRELICENSE;
    619                 RunIfNotReady(600*1000);
    620             }
    621         }
    622         break;
    623 
    624         case STATE_CANCEL_ACQUIRELICENSE:
    625         {
    626             fprintf(iTestMsgOutputFile, "\nCancel Acquiring License...");
    627             OSCL_TRY(error, iCancelCmdId = iLicenseIF->CancelAcquireLicense(iAcquireLicenseCmdId););
    628             OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); fprintf(iTestMsgOutputFile, "... Failed\n"); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady());
    629         }
    630         break;
    631 
    632         case STATE_INIT2:
    633         {
    634             fprintf(iTestMsgOutputFile, "***Initializing2...\n");
    635             OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject));
    636             OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady());
    637         }
    638         break;
    639 
    640         case STATE_GETMETADATAKEYLIST:
    641         {
    642             iMetadataKeyList.clear();
    643             OSCL_TRY(error, iCurrentCmdId = iPlayer->GetMetadataKeys(iMetadataKeyList, 0, 100, NULL, (OsclAny*) & iContextObject));
    644             OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady());
    645         }
    646         break;
    647 
    648         case STATE_GETMETADATAVALUELIST:
    649         {
    650             iMetadataValueList.clear();
    651             iNumValues = 0;
    652             OSCL_TRY(error, iCurrentCmdId = iPlayer->GetMetadataValues(iMetadataKeyList, 0, 100, iNumValues, iMetadataValueList, (OsclAny*) & iContextObject));
    653             OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady());
    654         }
    655         break;
    656 
    657         case STATE_ADDDATASINK_VIDEO:
    658         {
    659             fprintf(iTestMsgOutputFile, "***Adding Video Data Sink...\n");
    660             OSCL_wHeapString<OsclMemAllocator> videoSinkFileName = OUTPUTNAME_PREPEND_WSTRING;
    661             if (iFileType == PVMF_MIME_DATA_SOURCE_RTSP_URL)
    662             {
    663                 videoSinkFileName += _STRLIT_WCHAR("test_player_rtspurl_cpmdlapassthru_video.dat");
    664             }
    665             else if ((iFileType == PVMF_MIME_DATA_SOURCE_HTTP_URL) || (iFileType == PVMF_MIME_DATA_SOURCE_MS_HTTP_STREAMING_URL))
    666             {
    667                 videoSinkFileName += _STRLIT_WCHAR("test_player_httpurl_cpmdlapassthru_video.dat");
    668             }
    669             else if (iFileType == PVMF_MIME_DATA_SOURCE_PVX_FILE)
    670             {
    671                 videoSinkFileName += _STRLIT_WCHAR("test_player_pvx_cpmdlapassthru_video.dat");
    672             }
    673             else
    674             {
    675                 videoSinkFileName += _STRLIT_WCHAR("test_player_cpmdlapassthru_");
    676                 OSCL_wHeapString<OsclMemAllocator> inputfilename;
    677                 RetrieveFilename(wFileName.get_str(), inputfilename);
    678                 videoSinkFileName += inputfilename;
    679                 videoSinkFileName += _STRLIT_WCHAR("_video.dat");
    680             }
    681 
    682             iMIOFileOutVideo = iMioFactory->CreateVideoOutput((OsclAny*) & videoSinkFileName, MEDIATYPE_VIDEO, iCompressedVideo);
    683             iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutVideo);
    684             iDataSinkVideo = new PVPlayerDataSinkPVMFNode;
    685             ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo);
    686 
    687             OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject));
    688             OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady());
    689         }
    690         break;
    691 
    692         case STATE_ADDDATASINK_AUDIO:
    693         {
    694             fprintf(iTestMsgOutputFile, "***Adding Audio Data Sink...\n");
    695             OSCL_wHeapString<OsclMemAllocator> audioSinkFileName = OUTPUTNAME_PREPEND_WSTRING;
    696             if (iFileType == PVMF_MIME_DATA_SOURCE_RTSP_URL)
    697             {
    698                 audioSinkFileName += _STRLIT_WCHAR("test_player_rtspurl_cpmdlapassthru_audio.dat");
    699             }
    700             else if ((iFileType == PVMF_MIME_DATA_SOURCE_HTTP_URL) || (iFileType == PVMF_MIME_DATA_SOURCE_MS_HTTP_STREAMING_URL))
    701             {
    702                 audioSinkFileName += _STRLIT_WCHAR("test_player_httpurl_cpmdlapassthru_audio.dat");
    703             }
    704             else if (iFileType == PVMF_MIME_DATA_SOURCE_PVX_FILE)
    705             {
    706                 audioSinkFileName += _STRLIT_WCHAR("test_player_pvx_cpmdlapassthru_audio.dat");
    707             }
    708             else
    709             {
    710                 audioSinkFileName += _STRLIT_WCHAR("test_cpmdlapassthru_");
    711                 OSCL_wHeapString<OsclMemAllocator> inputfilename;
    712                 RetrieveFilename(wFileName.get_str(), inputfilename);
    713                 audioSinkFileName += inputfilename;
    714                 audioSinkFileName += _STRLIT_WCHAR("_audio.dat");
    715             }
    716 
    717             iMIOFileOutAudio = iMioFactory->CreateAudioOutput((OsclAny*) & audioSinkFileName, MEDIATYPE_AUDIO, iCompressedAudio);
    718             iIONodeAudio = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutAudio);
    719             iDataSinkAudio = new PVPlayerDataSinkPVMFNode;
    720             ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkNode(iIONodeAudio);
    721 
    722             OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject));
    723             OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady());
    724         }
    725         break;
    726 
    727         case STATE_PREPARE:
    728         {
    729             fprintf(iTestMsgOutputFile, "***Preparing...\n");
    730             OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject));
    731             OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady());
    732         }
    733         break;
    734 
    735         case STATE_START:
    736         {
    737             fprintf(iTestMsgOutputFile, "***Starting...\n");
    738             OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject));
    739             OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady());
    740         }
    741         break;
    742         case STATE_WAIT_FOR_DATAREADY:
    743         {
    744             if (iNumDataReady > 0)
    745             {
    746                 //playback cases wait on data ready, then start engine.
    747                 iState = STATE_START;
    748                 RunIfNotReady();
    749             }
    750             else
    751             {
    752                 //timed out while waiting.
    753                 PVPATB_TEST_IS_TRUE(false);
    754                 iState = STATE_CLEANUPANDCOMPLETE;
    755                 RunIfNotReady();
    756             }
    757         }
    758         break;
    759 
    760         case STATE_WAIT_FOR_BUFFCOMPLETE:
    761             if (iNumBufferingComplete > 0)
    762             {
    763                 //Download is complete!
    764                 if (iDownloadOnly)
    765                 {
    766                     //download-only cases can finish now.
    767                     iState = STATE_RESET;
    768                     RunIfNotReady();
    769                 }
    770                 else
    771                 {
    772                     //playback cases play 10 more seconds then stop.
    773                     iState = STATE_STOP;
    774                     RunIfNotReady(10*1000*1000);
    775                 }
    776             }
    777             else
    778             {
    779                 //timed out while waiting.
    780                 PVPATB_TEST_IS_TRUE(false);
    781                 iState = STATE_CLEANUPANDCOMPLETE;
    782                 RunIfNotReady();
    783             }
    784             break;
    785 
    786         case STATE_SETPLAYBACKRANGE:
    787         {
    788             if (oLiveSession == false)
    789             {
    790                 fprintf(iTestMsgOutputFile, "***Repositioning...\n");
    791                 {
    792                     PVPPlaybackPosition start, end;
    793                     start.iIndeterminate = false;
    794                     start.iPosUnit = PVPPBPOSUNIT_MILLISEC;
    795                     start.iMode = PVPPBPOS_MODE_NOW;
    796                     if (iSessionDuration)
    797                         start.iPosValue.millisec_value = iSessionDuration / 4;
    798                     else
    799                         start.iPosValue.millisec_value = 4000;
    800 
    801                     end.iIndeterminate = true;
    802                     OSCL_TRY(error, iCurrentCmdId = iPlayer->SetPlaybackRange(start, end, false, (OsclAny*) & iContextObject));
    803                 }
    804                 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady());
    805             }
    806             else
    807             {
    808                 fprintf(iTestMsgOutputFile, "***Setting PlayBack Range Not Supported for Live Sessions...\n");
    809             }
    810         }
    811         break;
    812 
    813         case STATE_PAUSE:
    814         {
    815             fprintf(iTestMsgOutputFile, "***Pausing...\n");
    816             OSCL_TRY(error, iCurrentCmdId = iPlayer->Pause((OsclAny*) & iContextObject));
    817             OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady());
    818         }
    819         break;
    820 
    821         case STATE_RESUME:
    822         {
    823             fprintf(iTestMsgOutputFile, "***Resuming...\n");
    824             OSCL_TRY(error, iCurrentCmdId = iPlayer->Resume((OsclAny*) & iContextObject));
    825             OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady());
    826         }
    827         break;
    828 
    829         case STATE_EOSNOTREACHED:
    830         {
    831             // EOS event not received so initiate stop
    832             PVPATB_TEST_IS_TRUE(false);
    833             iState = STATE_STOP;
    834             RunIfNotReady();
    835         }
    836         break;
    837 
    838         case STATE_STOP:
    839         {
    840             fprintf(iTestMsgOutputFile, "***Stopping...\n");
    841             OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject));
    842             OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady());
    843         }
    844         break;
    845 
    846         case STATE_REMOVEDATASINK_VIDEO:
    847         {
    848             fprintf(iTestMsgOutputFile, "***Removing Video Data Sink...\n");
    849             OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject));
    850             OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady());
    851         }
    852         break;
    853 
    854         case STATE_REMOVEDATASINK_AUDIO:
    855         {
    856             fprintf(iTestMsgOutputFile, "***Removing Audio Data Sink...\n");
    857             OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject));
    858             OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady());
    859         }
    860         break;
    861 
    862         case STATE_RESET:
    863         {
    864             fprintf(iTestMsgOutputFile, "***Resetting...\n");
    865             OSCL_TRY(error, iCurrentCmdId = iPlayer->Reset((OsclAny*) & iContextObject));
    866             OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady());
    867         }
    868         break;
    869 
    870         case STATE_REMOVEDATASOURCE:
    871         {
    872             fprintf(iTestMsgOutputFile, "***Removing Data Source...\n");
    873             OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSource(*iDataSource, (OsclAny*) & iContextObject));
    874             OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady());
    875         }
    876         break;
    877 
    878         case STATE_CLEANUPANDCOMPLETE:
    879         {
    880             fprintf(iTestMsgOutputFile, "***Deleting Player Engine...\n");
    881             PVPATB_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(iPlayer));
    882             iPlayer = NULL;
    883 
    884             delete iSourceContextData;
    885             iSourceContextData = NULL;
    886 
    887             delete iStreamDataSource;
    888             iStreamDataSource = NULL;
    889 
    890             delete iDownloadContextDataPVX;
    891             iDownloadContextDataPVX = NULL;
    892 
    893             delete iDataSource;
    894             iDataSource = NULL;
    895 
    896             delete iDataSinkVideo;
    897             iDataSinkVideo = NULL;
    898 
    899             delete iDataSinkAudio;
    900             iDataSinkAudio = NULL;
    901 
    902             PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo);
    903             iIONodeVideo = NULL;
    904 
    905             PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio);
    906             iIONodeAudio = NULL;
    907 
    908             iMioFactory->DestroyVideoOutput(iMIOFileOutVideo);
    909             iMIOFileOutVideo = NULL;
    910 
    911             iMioFactory->DestroyAudioOutput(iMIOFileOutAudio);
    912             iMIOFileOutAudio = NULL;
    913 
    914             //close and cleanup the CPM plugin registry.
    915             iPluginRegistryClient.Close();
    916 
    917             //delete the plugin factory.
    918             if (iPluginFactory)
    919             {
    920                 delete iPluginFactory;
    921                 iPluginFactory = NULL;
    922             }
    923 
    924             delete iLocalDataSource;
    925             iLocalDataSource = NULL;
    926             iObserver->TestCompleted(*iTestCase);
    927         }
    928         break;
    929 
    930         case STATE_CANCELALL:
    931         {
    932             OSCL_TRY(error, iCancelAllCmdId = iPlayer->CancelAllCommands((OsclAny*) & iContextObject));
    933             OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady());
    934 
    935             iState = STATE_WAIT_FOR_CANCELALL;
    936             RunIfNotReady(15000000);
    937         }
    938         break;
    939 
    940         case STATE_WAIT_FOR_CANCELALL:
    941         {
    942             // Cancel did not complete in time
    943             PVPATB_TEST_IS_TRUE(false);
    944             iState = STATE_CLEANUPANDCOMPLETE;
    945             RunIfNotReady();
    946         }
    947         break;
    948 
    949         default:
    950             break;
    951 
    952     }
    953 }
    954 
    955 void pvplayer_async_test_cpmdlapassthru::CommandCompleted(const PVCmdResponse& aResponse)
    956 {
    957     if (aResponse.GetCmdId() != iCurrentCmdId && aResponse.GetCmdId() != iCancelCmdId
    958             && aResponse.GetCmdId() != iAcquireLicenseCmdId)
    959     {
    960         // Wrong command ID.
    961         PVPATB_TEST_IS_TRUE(false);
    962         iState = STATE_CLEANUPANDCOMPLETE;
    963         RunIfNotReady();
    964         return;
    965     }
    966 
    967     if (aResponse.GetContext() != NULL)
    968     {
    969         if (aResponse.GetContext() == (OsclAny*)&iContextObject)
    970         {
    971             if (iContextObject != iContextObjectRefValue)
    972             {
    973                 // Context data value was corrupted
    974                 PVPATB_TEST_IS_TRUE(false);
    975                 iState = STATE_CLEANUPANDCOMPLETE;
    976                 RunIfNotReady();
    977                 return;
    978             }
    979         }
    980         else
    981         {
    982             // Context data pointer was corrupted
    983             PVPATB_TEST_IS_TRUE(false);
    984             iState = STATE_CLEANUPANDCOMPLETE;
    985             RunIfNotReady();
    986             return;
    987         }
    988     }
    989 
    990     //Handling for STATE_ACQUIRELICENSE, we might have overwritten iState variable for "Cancel" TestCase
    991     //So cannot depend on iState to know which Command's command has completed now
    992     if ((aResponse.GetCmdId() == iAcquireLicenseCmdId) &&
    993             ((iState == STATE_ACQUIRELICENSE) || (iState == STATE_CANCEL_ACQUIRELICENSE)))//If this is AcquireLic commandCompleted
    994     {
    995         if (aResponse.GetCmdStatus() == PVMFSuccess)
    996         {
    997             // Got the license.
    998             fprintf(iTestMsgOutputFile, "\nAcquire License...Success\n");
    999             if (!oCancelAcquireLicense)
   1000             {
   1001                 // Call Init again to start playback
   1002                 iState = STATE_INIT2;
   1003                 RunIfNotReady();
   1004             }
   1005             else
   1006             {
   1007                 //Now fire cancelAcquireLic, it shud fail
   1008                 if (iTestMode == OMA1_DLA_CANCEL_ACQUIRE_LICENSE_FAILS)
   1009                 {
   1010                     iState = STATE_CANCEL_ACQUIRELICENSE;
   1011                     RunIfNotReady();
   1012                 }
   1013             }
   1014         }
   1015         else if (aResponse.GetCmdStatus() == PVMFErrCancelled)
   1016         {
   1017             fprintf(iTestMsgOutputFile, "\nAcquire License...Cancelled\n");
   1018         }
   1019         else
   1020         {
   1021             // AcquireLicense failed
   1022             fprintf(iTestMsgOutputFile, "\nAcquire License...Failed!\n");
   1023             PVPATB_TEST_IS_TRUE(false);
   1024             iState = STATE_CLEANUPANDCOMPLETE;
   1025             RunIfNotReady();
   1026         }
   1027         return;
   1028     }
   1029 
   1030     switch (iState)
   1031     {
   1032         case STATE_QUERYINTERFACE:
   1033             if (aResponse.GetCmdStatus() == PVMFSuccess)
   1034             {
   1035                 iState = STATE_ADDDATASOURCE;
   1036                 RunIfNotReady();
   1037             }
   1038             else
   1039             {
   1040                 // QueryInterface failed
   1041                 PVPATB_TEST_IS_TRUE(false);
   1042                 iState = STATE_CLEANUPANDCOMPLETE;
   1043                 RunIfNotReady();
   1044             }
   1045             break;
   1046 
   1047         case STATE_ADDDATASOURCE:
   1048             if (aResponse.GetCmdStatus() == PVMFSuccess)
   1049             {
   1050                 iState = STATE_CONFIGPARAMS;
   1051                 RunIfNotReady();
   1052             }
   1053             else
   1054             {
   1055                 // AddDataSource failed
   1056                 PVPATB_TEST_IS_TRUE(false);
   1057                 iState = STATE_CLEANUPANDCOMPLETE;
   1058                 RunIfNotReady();
   1059             }
   1060             break;
   1061 
   1062         case STATE_CONFIGPARAMS:
   1063             iState = STATE_INIT;
   1064             RunIfNotReady();
   1065             break;
   1066 
   1067         case STATE_INIT:
   1068             if (aResponse.GetCmdStatus() == PVMFSuccess)
   1069             {
   1070                 if (iDownloadOnly)
   1071                 {
   1072                     //For download-only, just wait on the buffering complete event
   1073                     //and then reset engine.
   1074                     if (iNumBufferingComplete > 0)
   1075                     {
   1076                         //If the clip is really short it's possible it may
   1077                         //already be downloaded by now.
   1078                         iState = STATE_RESET;
   1079                         RunIfNotReady();
   1080                     }
   1081                     else
   1082                     {
   1083                         //wait on download to complete.
   1084                         iState = STATE_WAIT_FOR_BUFFCOMPLETE;
   1085                         //5 minute error timeout
   1086                         RunIfNotReady(5*60*1000*1000);
   1087                     }
   1088                 }
   1089                 else
   1090                 {
   1091                     iState = STATE_ADDDATASINK_VIDEO;
   1092                     RunIfNotReady();
   1093                 }
   1094             }
   1095             else
   1096             {
   1097                 if ((iContentTooLarge) &&
   1098                         (aResponse.GetCmdStatus() == PVMFErrContentTooLarge))
   1099                 {
   1100                     // Test success in this case
   1101                     fprintf(iTestMsgOutputFile, "   INIT returned PVMFErrContentTooLarge\n");
   1102                     PVPATB_TEST_IS_TRUE(true);
   1103                     iState = STATE_REMOVEDATASOURCE;
   1104                     RunIfNotReady();
   1105                 }
   1106                 else if (aResponse.GetCmdStatus() == PVMFErrLicenseRequired)
   1107                 {
   1108                     fprintf(iTestMsgOutputFile, " ...PVMFErrLicenseRequired\n");
   1109                     // Try to acquire the license.
   1110                     iState = STATE_QUERYLICENSEACQIF;
   1111                     RunIfNotReady();
   1112                 }
   1113                 else
   1114                 {
   1115                     // Init failed
   1116                     PVPATB_TEST_IS_TRUE(false);
   1117                     iState = STATE_CLEANUPANDCOMPLETE;
   1118                     RunIfNotReady();
   1119                 }
   1120             }
   1121             break;
   1122         case STATE_QUERYLICENSEACQIF:
   1123             if (aResponse.GetCmdStatus() == PVMFSuccess)
   1124             {
   1125                 iState = STATE_ACQUIRELICENSE;
   1126                 RunIfNotReady();
   1127             }
   1128             else
   1129             {
   1130                 // QueryInterface failed.
   1131                 PVPATB_TEST_IS_TRUE(false);
   1132                 iState = STATE_CLEANUPANDCOMPLETE;
   1133                 RunIfNotReady();
   1134             }
   1135             break;
   1136 
   1137 
   1138         case STATE_CANCEL_ACQUIRELICENSE:
   1139             if (aResponse.GetCmdStatus() == PVMFSuccess)
   1140             {
   1141                 // AcquireLicense is canceled
   1142                 fprintf(iTestMsgOutputFile, "...Cancel AcquireLicense Success\n");
   1143                 iState = STATE_CLEANUPANDCOMPLETE;
   1144                 RunIfNotReady();
   1145             }
   1146             else if (aResponse.GetCmdStatus() == PVMFErrCancelled)
   1147             {
   1148                 fprintf(iTestMsgOutputFile, "Command %d Cancelled...\n", iAcquireLicenseCmdId);
   1149                 iState = STATE_REMOVEDATASOURCE;
   1150                 RunIfNotReady();
   1151             }
   1152             else
   1153             {
   1154                 // AcquireLicense or CancelAcquireLicense failed
   1155                 fprintf(iTestMsgOutputFile, "Cancel AcquireLicense ...Failed!\n");
   1156                 //Means CPM_DLA_PASSTRHU_CancelAcquireLicenseTooLate_CancelFails
   1157                 if (iTestMode == OMA1_DLA_CANCEL_ACQUIRE_LICENSE_FAILS)
   1158                 {
   1159                     //This is not a failure, Cancel was fired too late, AcqLic has already succeeded
   1160                     iState = STATE_INIT2;
   1161                     RunIfNotReady();
   1162                 }
   1163                 else
   1164                 {
   1165                     PVPATB_TEST_IS_TRUE(false);
   1166                     iState = STATE_CLEANUPANDCOMPLETE;
   1167                     RunIfNotReady();
   1168                 }
   1169             }
   1170             break;
   1171 
   1172         case STATE_INIT2:
   1173             if (aResponse.GetCmdStatus() == PVMFSuccess)
   1174             {
   1175                 iState = STATE_ADDDATASINK_VIDEO;
   1176                 RunIfNotReady();
   1177             }
   1178             else
   1179             {
   1180                 // Init2 failed
   1181                 PVPATB_TEST_IS_TRUE(false);
   1182                 iState = STATE_CLEANUPANDCOMPLETE;
   1183                 RunIfNotReady();
   1184             }
   1185             break;
   1186 
   1187 
   1188         case STATE_GETMETADATAKEYLIST:
   1189             if (aResponse.GetCmdStatus() == PVMFSuccess)
   1190             {
   1191                 iState = STATE_GETMETADATAVALUELIST;
   1192                 RunIfNotReady();
   1193             }
   1194             else
   1195             {
   1196                 // GetMetadataKeys failed
   1197                 PVPATB_TEST_IS_TRUE(false);
   1198                 iState = STATE_CLEANUPANDCOMPLETE;
   1199                 RunIfNotReady();
   1200             }
   1201             break;
   1202 
   1203         case STATE_GETMETADATAVALUELIST:
   1204             if (aResponse.GetCmdStatus() == PVMFSuccess)
   1205             {
   1206                 PrintMetadataInfo();
   1207                 if ((iFileType == PVMF_MIME_DATA_SOURCE_PVX_FILE) || (iFileType == PVMF_MIME_DATA_SOURCE_HTTP_URL))
   1208                 {
   1209                     //wait for data ready, unless we already got it.
   1210                     if (iNumDataReady > 0)
   1211                     {
   1212                         iState = STATE_START;
   1213                         RunIfNotReady();
   1214                     }
   1215                     else
   1216                     {
   1217                         iState = STATE_WAIT_FOR_DATAREADY;
   1218                         //5 minute error timeout
   1219                         RunIfNotReady(5*60*1000*1000);
   1220                     }
   1221                 }
   1222                 else
   1223                 {
   1224                     iState = STATE_START;
   1225                     RunIfNotReady();
   1226                 }
   1227 
   1228             }
   1229             else
   1230             {
   1231                 // GetMetadataValue failed
   1232                 PVPATB_TEST_IS_TRUE(false);
   1233                 iState = STATE_CLEANUPANDCOMPLETE;
   1234                 RunIfNotReady();
   1235             }
   1236             break;
   1237 
   1238         case STATE_ADDDATASINK_VIDEO:
   1239             if (aResponse.GetCmdStatus() == PVMFSuccess)
   1240             {
   1241                 iState = STATE_ADDDATASINK_AUDIO;
   1242                 RunIfNotReady();
   1243             }
   1244             else
   1245             {
   1246                 // Init failed
   1247                 PVPATB_TEST_IS_TRUE(false);
   1248                 iState = STATE_CLEANUPANDCOMPLETE;
   1249                 RunIfNotReady();
   1250             }
   1251             break;
   1252 
   1253         case STATE_ADDDATASINK_AUDIO:
   1254             if (aResponse.GetCmdStatus() == PVMFSuccess)
   1255             {
   1256                 iState = STATE_PREPARE;
   1257                 RunIfNotReady();
   1258             }
   1259             else
   1260             {
   1261                 // AddDataSink failed
   1262                 PVPATB_TEST_IS_TRUE(false);
   1263                 iState = STATE_CLEANUPANDCOMPLETE;
   1264                 RunIfNotReady();
   1265             }
   1266             break;
   1267 
   1268         case STATE_PREPARE:
   1269             if (aResponse.GetCmdStatus() == PVMFSuccess)
   1270             {
   1271                 iState = STATE_GETMETADATAKEYLIST;
   1272                 RunIfNotReady();
   1273             }
   1274             else
   1275             {
   1276                 // Prepare failed
   1277                 PVPATB_TEST_IS_TRUE(false);
   1278                 iState = STATE_CLEANUPANDCOMPLETE;
   1279                 RunIfNotReady();
   1280             }
   1281             break;
   1282 
   1283         case STATE_START:
   1284             if (aResponse.GetCmdStatus() == PVMFSuccess)
   1285             {
   1286                 if (oLiveSession == false)
   1287                 {
   1288                     if (oSeekEnable == true)
   1289                     {
   1290                         iState = STATE_SETPLAYBACKRANGE;
   1291                         RunIfNotReady(10*1000*1000);
   1292                     }
   1293                     else if (oPauseResumeEnable == true)
   1294                     {
   1295                         iState = STATE_PAUSE;
   1296                         RunIfNotReady(20*1000*1000);
   1297                     }
   1298                     else
   1299                     {
   1300                         if (oWaitForEOS == false)
   1301                         {
   1302                             iState = STATE_STOP;
   1303                             //play for 1 min
   1304                             RunIfNotReady(1*60*1000*1000);
   1305                         }
   1306                     }
   1307                 }
   1308                 else
   1309                 {
   1310                     //run for 1 mins and stop
   1311                     iState = STATE_STOP;
   1312                     RunIfNotReady(1*60*1000*1000);
   1313                 }
   1314             }
   1315             else
   1316             {
   1317                 // Start failed
   1318                 PVPATB_TEST_IS_TRUE(false);
   1319                 iState = STATE_CLEANUPANDCOMPLETE;
   1320                 RunIfNotReady();
   1321             }
   1322             break;
   1323         case STATE_WAIT_FOR_DATAREADY:
   1324         case STATE_WAIT_FOR_BUFFCOMPLETE:
   1325             //shouldn't get here-- there are no engine commands active in this state.
   1326             PVPATB_TEST_IS_TRUE(false);
   1327             break;
   1328 
   1329         case STATE_SETPLAYBACKRANGE:
   1330             if ((aResponse.GetCmdStatus() == PVMFSuccess) ||
   1331                     (aResponse.GetCmdStatus() == PVMFErrNotSupported))
   1332             {
   1333                 if (iPlayListURL == true)
   1334                 {
   1335                     if (iFileType != PVMF_MIME_DATA_SOURCE_HTTP_URL)
   1336                     {
   1337                         int32 error;
   1338                         iKeyStringSetAsync = _STRLIT_CHAR("x-pvmf/net/delay;valtype=uint32");
   1339                         iKVPSetAsync.key = iKeyStringSetAsync.get_str();
   1340                         iKVPSetAsync.value.uint32_value = 4000;
   1341                         iErrorKVP = NULL;
   1342                         fprintf(iTestMsgOutputFile, "***Resetting Jitter Buffer Duration to = %d ms\n", iKVPSetAsync.value.uint32_value);
   1343                         OSCL_TRY(error, iPlayerCapConfigIF->setParametersSync(NULL, &iKVPSetAsync, 1, iErrorKVP));
   1344                         OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); return);
   1345                     }
   1346                 }
   1347 
   1348                 if (oWaitForEOS == false)
   1349                 {
   1350                     iState = STATE_EOSNOTREACHED;
   1351                     RunIfNotReady(180000000);
   1352                 }
   1353             }
   1354             else
   1355             {
   1356                 // SetPlaybackRange failed
   1357                 PVPATB_TEST_IS_TRUE(false);
   1358                 iState = STATE_CLEANUPANDCOMPLETE;
   1359                 RunIfNotReady();
   1360             }
   1361             break;
   1362 
   1363         case STATE_PAUSE:
   1364             if (aResponse.GetCmdStatus() == PVMFSuccess)
   1365             {
   1366                 iState = STATE_RESUME;
   1367                 /* Stay paused for 10 seconds */
   1368                 RunIfNotReady(10*1000*1000);
   1369             }
   1370             else
   1371             {
   1372                 // Pause failed
   1373                 PVPATB_TEST_IS_TRUE(false);
   1374                 iState = STATE_CLEANUPANDCOMPLETE;
   1375                 RunIfNotReady();
   1376             }
   1377             break;
   1378 
   1379         case STATE_RESUME:
   1380             if (aResponse.GetCmdStatus() == PVMFSuccess)
   1381             {
   1382                 if (oWaitForEOS == false)
   1383                 {
   1384                     iState = STATE_EOSNOTREACHED;
   1385                     RunIfNotReady(180000000);
   1386                 }
   1387             }
   1388             else
   1389             {
   1390                 // Resume failed
   1391                 PVPATB_TEST_IS_TRUE(false);
   1392                 iState = STATE_CLEANUPANDCOMPLETE;
   1393                 RunIfNotReady();
   1394             }
   1395             break;
   1396 
   1397         case STATE_STOP:
   1398             if (aResponse.GetCmdStatus() == PVMFSuccess)
   1399             {
   1400                 iState = STATE_REMOVEDATASINK_AUDIO;
   1401                 RunIfNotReady();
   1402             }
   1403             else
   1404             {
   1405                 // Stop failed
   1406                 PVPATB_TEST_IS_TRUE(false);
   1407                 iState = STATE_CLEANUPANDCOMPLETE;
   1408                 RunIfNotReady();
   1409             }
   1410             break;
   1411 
   1412         case STATE_REMOVEDATASINK_AUDIO:
   1413             if (aResponse.GetCmdStatus() == PVMFSuccess)
   1414             {
   1415                 iState = STATE_REMOVEDATASINK_VIDEO;
   1416                 RunIfNotReady();
   1417             }
   1418             else
   1419             {
   1420                 // RemoveDataSink failed
   1421                 PVPATB_TEST_IS_TRUE(false);
   1422                 iState = STATE_CLEANUPANDCOMPLETE;
   1423                 RunIfNotReady();
   1424             }
   1425             break;
   1426 
   1427         case STATE_REMOVEDATASINK_VIDEO:
   1428             if (aResponse.GetCmdStatus() == PVMFSuccess)
   1429             {
   1430                 iState = STATE_RESET;
   1431                 RunIfNotReady();
   1432             }
   1433             else
   1434             {
   1435                 // RemoveDataSink failed
   1436                 PVPATB_TEST_IS_TRUE(false);
   1437                 iState = STATE_CLEANUPANDCOMPLETE;
   1438                 RunIfNotReady();
   1439             }
   1440             break;
   1441 
   1442         case STATE_RESET:
   1443             if (aResponse.GetCmdStatus() == PVMFSuccess)
   1444             {
   1445                 iState = STATE_REMOVEDATASOURCE;
   1446                 RunIfNotReady();
   1447             }
   1448             else
   1449             {
   1450                 // Reset failed
   1451                 PVPATB_TEST_IS_TRUE(false);
   1452                 iState = STATE_CLEANUPANDCOMPLETE;
   1453                 RunIfNotReady();
   1454             }
   1455             break;
   1456 
   1457         case STATE_REMOVEDATASOURCE:
   1458             if (aResponse.GetCmdStatus() == PVMFSuccess)
   1459             {
   1460                 PVPATB_TEST_IS_TRUE(true);
   1461                 if (iNumPlay == iTargetNumPlay)
   1462                 {
   1463                     iState = STATE_CLEANUPANDCOMPLETE;
   1464                 }
   1465                 else
   1466                 {
   1467                     delete iSourceContextData;
   1468                     iSourceContextData = NULL;
   1469 
   1470                     delete iStreamDataSource;
   1471                     iStreamDataSource = NULL;
   1472 
   1473                     delete iDataSource;
   1474                     iDataSource = NULL;
   1475 
   1476                     delete iDataSinkVideo;
   1477                     iDataSinkVideo = NULL;
   1478 
   1479                     delete iDataSinkAudio;
   1480                     iDataSinkAudio = NULL;
   1481 
   1482                     PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo);
   1483                     iIONodeVideo = NULL;
   1484 
   1485                     PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio);
   1486                     iIONodeAudio = NULL;
   1487 
   1488                     iMioFactory->DestroyVideoOutput(iMIOFileOutVideo);
   1489                     iMIOFileOutVideo = NULL;
   1490 
   1491                     iMioFactory->DestroyAudioOutput(iMIOFileOutAudio);
   1492                     iMIOFileOutAudio = NULL;
   1493 
   1494                     iState = STATE_ADDDATASOURCE;
   1495                 }
   1496                 RunIfNotReady();
   1497             }
   1498             else
   1499             {
   1500                 // RemoveDataSource failed
   1501                 PVPATB_TEST_IS_TRUE(false);
   1502                 iState = STATE_CLEANUPANDCOMPLETE;
   1503                 RunIfNotReady();
   1504             }
   1505             break;
   1506 
   1507         case STATE_CANCELALL:
   1508             if (aResponse.GetCmdStatus() == PVMFSuccess)
   1509             {
   1510                 // Prepare should not complete
   1511                 PVPATB_TEST_IS_TRUE(false);
   1512                 iState = STATE_CLEANUPANDCOMPLETE;
   1513                 RunIfNotReady();
   1514             }
   1515             else
   1516             {
   1517                 // Prepare failed
   1518                 PVPATB_TEST_IS_TRUE(false);
   1519                 iState = STATE_CLEANUPANDCOMPLETE;
   1520                 RunIfNotReady();
   1521             }
   1522             break;
   1523 
   1524         case STATE_WAIT_FOR_CANCELALL:
   1525             if (aResponse.GetCmdStatus() == PVMFSuccess)
   1526             {
   1527                 // Cancel succeeded so test passed
   1528                 PVPATB_TEST_IS_TRUE(true);
   1529                 iState = STATE_CLEANUPANDCOMPLETE;
   1530                 if (IsBusy())
   1531                 {
   1532                     Cancel();
   1533                 }
   1534                 RunIfNotReady();
   1535             }
   1536             else if (aResponse.GetCmdStatus() == PVMFErrCancelled)
   1537             {
   1538                 // Prepare being cancelled. Ignore.
   1539                 fprintf(iTestMsgOutputFile, "Command %d Cancelled...\n", iCurrentCmdId);
   1540             }
   1541             else
   1542             {
   1543                 // Cancel failed
   1544                 PVPATB_TEST_IS_TRUE(false);
   1545                 iState = STATE_CLEANUPANDCOMPLETE;
   1546                 RunIfNotReady();
   1547             }
   1548             break;
   1549 
   1550         default:
   1551         {
   1552             // Testing error if this is reached
   1553             //PVPATB_TEST_IS_TRUE(false);
   1554             iState = STATE_CLEANUPANDCOMPLETE;
   1555             RunIfNotReady();
   1556         }
   1557         break;
   1558     }
   1559 
   1560     if (aResponse.GetCmdStatus() != PVMFSuccess)
   1561     {
   1562         PVInterface* iface = (PVInterface*)(aResponse.GetEventExtensionInterface());
   1563         if (iface != NULL)
   1564         {
   1565             PVUuid infomsguuid = PVMFErrorInfoMessageInterfaceUUID;
   1566             PVMFErrorInfoMessageInterface* infomsgiface = NULL;
   1567             if (iface->queryInterface(infomsguuid, (PVInterface*&)infomsgiface) == true)
   1568             {
   1569                 PVUuid engerruuid;
   1570                 int32 errCodeEng;
   1571                 infomsgiface->GetCodeUUID(errCodeEng, engerruuid);
   1572 
   1573                 if (engerruuid == PVPlayerErrorInfoEventTypesUUID)
   1574                 {
   1575                     PVMFErrorInfoMessageInterface* sourceNodeErrorIF =
   1576                         infomsgiface->GetNextMessage();
   1577 
   1578                     if (sourceNodeErrorIF != NULL)
   1579                     {
   1580                         PVUuid eventuuid;
   1581                         int32 srcErrCode;
   1582                         sourceNodeErrorIF->GetCodeUUID(srcErrCode, eventuuid);
   1583                         if (eventuuid == PVMFSocketNodeEventTypeUUID)
   1584                         {
   1585                             HandleSocketNodeErrors(srcErrCode);
   1586                         }
   1587                         else if (eventuuid == PVMFRTSPClientEngineNodeEventTypeUUID)
   1588                         {
   1589                             HandleRTSPNodeErrors(srcErrCode);
   1590                         }
   1591                         else if (eventuuid == PVMFStreamingManagerNodeEventTypeUUID)
   1592                         {
   1593                             HandleStreamingManagerNodeErrors(srcErrCode);
   1594                         }
   1595                         else if (eventuuid == PVMFJitterBufferNodeEventTypeUUID)
   1596                         {
   1597                             HandleJitterBufferNodeErrors(srcErrCode);
   1598                         }
   1599                         else if (eventuuid == PVMFMediaLayerNodeEventTypeUUID)
   1600                         {
   1601                             HandleMediaLayerNodeErrors(srcErrCode);
   1602                         }
   1603                         else if (eventuuid == PVProtocolEngineNodeErrorEventTypesUUID)
   1604                         {
   1605                             HandleProtocolEngineNodeErrors(srcErrCode);
   1606                         }
   1607 
   1608                     }
   1609                 }
   1610             }
   1611         }
   1612     }
   1613 }
   1614 
   1615 
   1616 void pvplayer_async_test_cpmdlapassthru::HandleErrorEvent(const PVAsyncErrorEvent& aEvent)
   1617 {
   1618     switch (aEvent.GetEventType())
   1619     {
   1620         case PVMFErrResourceConfiguration:
   1621             // Just log the error
   1622             PVPATB_TEST_IS_TRUE(false);
   1623             break;
   1624 
   1625         case PVMFErrResource:
   1626             // Just log the error
   1627             PVPATB_TEST_IS_TRUE(false);
   1628             break;
   1629 
   1630         case PVMFErrCorrupt:
   1631             // Just log the error
   1632             PVPATB_TEST_IS_TRUE(false);
   1633             break;
   1634 
   1635         case PVMFErrProcessing:
   1636             // Just log the error
   1637             PVPATB_TEST_IS_TRUE(false);
   1638             break;
   1639 
   1640         default:
   1641             // Unknown error and just log the error
   1642             PVPATB_TEST_IS_TRUE(false);
   1643             break;
   1644     }
   1645 
   1646     PVInterface* iface = (PVInterface*)(aEvent.GetEventExtensionInterface());
   1647     if (iface != NULL)
   1648     {
   1649         PVUuid infomsguuid = PVMFErrorInfoMessageInterfaceUUID;
   1650         PVMFErrorInfoMessageInterface* infomsgiface = NULL;
   1651         if (iface->queryInterface(infomsguuid, (PVInterface*&)infomsgiface) == true)
   1652         {
   1653             PVUuid engerruuid;
   1654             int32 errCodeEng;
   1655             infomsgiface->GetCodeUUID(errCodeEng, engerruuid);
   1656 
   1657             if (engerruuid == PVPlayerErrorInfoEventTypesUUID)
   1658             {
   1659                 PVMFErrorInfoMessageInterface* sourceNodeErrorIF =
   1660                     infomsgiface->GetNextMessage();
   1661 
   1662                 if (sourceNodeErrorIF != NULL)
   1663                 {
   1664                     PVUuid eventuuid;
   1665                     int32 srcErrCode;
   1666                     sourceNodeErrorIF->GetCodeUUID(srcErrCode, eventuuid);
   1667                     if (eventuuid == PVMFSocketNodeEventTypeUUID)
   1668                     {
   1669                         HandleSocketNodeErrors(srcErrCode);
   1670                     }
   1671                     else if (eventuuid == PVMFRTSPClientEngineNodeEventTypeUUID)
   1672                     {
   1673                         HandleRTSPNodeErrors(srcErrCode);
   1674                     }
   1675                     else if (eventuuid == PVMFStreamingManagerNodeEventTypeUUID)
   1676                     {
   1677                         HandleStreamingManagerNodeErrors(srcErrCode);
   1678                     }
   1679                     else if (eventuuid == PVMFJitterBufferNodeEventTypeUUID)
   1680                     {
   1681                         HandleJitterBufferNodeErrors(srcErrCode);
   1682                     }
   1683                     else if (eventuuid == PVMFMediaLayerNodeEventTypeUUID)
   1684                     {
   1685                         HandleMediaLayerNodeErrors(srcErrCode);
   1686                     }
   1687                     else if (eventuuid == PVProtocolEngineNodeErrorEventTypesUUID)
   1688                     {
   1689                         HandleProtocolEngineNodeErrors(srcErrCode);
   1690                     }
   1691                 }
   1692             }
   1693         }
   1694     }
   1695 
   1696     // Wait for engine to handle the error
   1697     Cancel();
   1698 }
   1699 
   1700 void pvplayer_async_test_cpmdlapassthru::HandleSocketNodeErrors(int32 aErr)
   1701 {
   1702     if (aErr == PVMFSocketNodeErrorSocketServerCreateError)
   1703     {
   1704         fprintf(iTestMsgOutputFile, "PVMFSocketNodeErrorSocketServerCreateError\n");
   1705     }
   1706     else if (aErr == PVMFSocketNodeErrorSocketServConnectError)
   1707     {
   1708         fprintf(iTestMsgOutputFile, "PVMFSocketNodeErrorSocketServConnectError\n");
   1709     }
   1710     else if (aErr == PVMFSocketNodeErrorUDPSocketRecvError)
   1711     {
   1712         fprintf(iTestMsgOutputFile, "PVMFSocketNodeErrorUDPSocketRecvError\n");
   1713     }
   1714     else if (aErr == PVMFSocketNodeErrorUDPSocketSendError)
   1715     {
   1716         fprintf(iTestMsgOutputFile, "PVMFSocketNodeErrorUDPSocketSendError\n");
   1717     }
   1718     else if (aErr == PVMFSocketNodeErrorSocketFailure)
   1719     {
   1720         fprintf(iTestMsgOutputFile, "PVMFSocketNodeErrorSocketFailure\n");
   1721     }
   1722     else if (aErr == PVMFSocketNodeErrorSocketTimeOut)
   1723     {
   1724         fprintf(iTestMsgOutputFile, "PVMFSocketNodeErrorSocketTimeOut\n");
   1725     }
   1726     else if (aErr == PVMFSocketNodeErrorInvalidPortTag)
   1727     {
   1728         fprintf(iTestMsgOutputFile, "PVMFSocketNodeErrorInvalidPortTag\n");
   1729     }
   1730     else
   1731     {
   1732         fprintf(iTestMsgOutputFile, "PVMFSocketNode- Unknown Error Code\n");
   1733     }
   1734 
   1735 }
   1736 
   1737 void pvplayer_async_test_cpmdlapassthru::HandleRTSPNodeErrors(int32 aErr)
   1738 {
   1739     if (aErr == PVMFRTSPClientEngineNodeErrorSocketServerError)
   1740     {
   1741         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorSocketServerError\n");
   1742     }
   1743     else if (aErr == PVMFRTSPClientEngineNodeErrorDNSLookUpError)
   1744     {
   1745         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorDNSLookUpError\n");
   1746     }
   1747     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPSocketCreateError)
   1748     {
   1749         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPSocketCreateError\n");
   1750     }
   1751     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPSocketConnectError)
   1752     {
   1753         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPSocketConnectError\n");
   1754     }
   1755     else if (aErr == PVMFRTSPClientEngineNodeErrorSocketSendError)
   1756     {
   1757         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorSocketSendError\n");
   1758     }
   1759     else if (aErr == PVMFRTSPClientEngineNodeErrorSocketRecvError)
   1760     {
   1761         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorSocketRecvError\n");
   1762     }
   1763     else if (aErr == PVMFRTSPClientEngineNodeErrorSocketError)
   1764     {
   1765         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorSocketError\n");
   1766     }
   1767     else if (aErr == PVMFRTSPClientEngineNodeErrorOutOfMemory)
   1768     {
   1769         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorOutOfMemory\n");
   1770     }
   1771     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPRequestTooBig)
   1772     {
   1773         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPRequestTooBig\n");
   1774     }
   1775     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPParserError)
   1776     {
   1777         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPParserError\n");
   1778     }
   1779     else if (aErr == PVMFRTSPClientEngineNodeErrorUnknownRTSPMessage)
   1780     {
   1781         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorUnknownRTSPMessage\n");
   1782     }
   1783     else if (aErr == PVMFRTSPClientEngineNodeErrorIncorrectRTSPMessageType)
   1784     {
   1785         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorIncorrectRTSPMessageType\n");
   1786     }
   1787     else if (aErr == PVMFRTSPClientEngineNodeErrorMalformedRTSPMessage)
   1788     {
   1789         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorMalformedRTSPMessage\n");
   1790     }
   1791     else if (aErr == PVMFRTSPClientEngineNodeErrorMissingSeqNumInServerResponse)
   1792     {
   1793         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorMissingSeqNumInServerResponse\n");
   1794     }
   1795     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPRequestResponseMismatch)
   1796     {
   1797         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPRequestResponseMismatch\n");
   1798     }
   1799     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPComposeDescribeRequestError)
   1800     {
   1801         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPComposeDescribeRequestError\n");
   1802     }
   1803     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPComposeSetupRequestError)
   1804     {
   1805         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPComposeSetupRequestError\n");
   1806     }
   1807     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPComposePlayRequestError)
   1808     {
   1809         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPComposePlayRequestError\n");
   1810     }
   1811     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPComposePauseRequestError)
   1812     {
   1813         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPComposePauseRequestError\n");
   1814     }
   1815     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPComposeStopRequestError)
   1816     {
   1817         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPComposeStopRequestError\n");
   1818     }
   1819     //"400"      ; Bad Request
   1820     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPErrorCode400)
   1821     {
   1822         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPErrorCode400\n");
   1823     }
   1824     //"401"      ; Unauthorized
   1825     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPErrorCode401)
   1826     {
   1827         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPErrorCode401\n");
   1828     }
   1829     //"402"      ; Payment Required
   1830     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPErrorCode402)
   1831     {
   1832         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPErrorCode402\n");
   1833     }
   1834     //"403"      ; Forbidden
   1835     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPErrorCode403)
   1836     {
   1837         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPErrorCode403\n");
   1838     }
   1839     //"404"      ; Not Found
   1840     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPErrorCode404)
   1841     {
   1842         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPErrorCode404\n");
   1843     }
   1844     //"405"      ; Method Not Allowed
   1845     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPErrorCode405)
   1846     {
   1847         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPErrorCode405\n");
   1848     }
   1849     //"406"      ; Not Acceptable
   1850     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPErrorCode406)
   1851     {
   1852         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPErrorCode406\n");
   1853     }
   1854     //"407"      ; Proxy Authentication Required
   1855     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPErrorCode407)
   1856     {
   1857         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPErrorCode407\n");
   1858     }
   1859     //"408"      ; Request Time-out
   1860     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPErrorCode408)
   1861     {
   1862         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPErrorCode408\n");
   1863     }
   1864     //"410"      ; Gone
   1865     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPErrorCode410)
   1866     {
   1867         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPErrorCode410\n");
   1868     }
   1869     //"411"      ; Length Required
   1870     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPErrorCode411)
   1871     {
   1872         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPErrorCode411\n");
   1873     }
   1874     //"412"      ; Precondition Failed
   1875     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPErrorCode412)
   1876     {
   1877         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPErrorCode412\n");
   1878     }
   1879     //"413"      ; Request Entity Too Large
   1880     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPErrorCode413)
   1881     {
   1882         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPErrorCode413\n");
   1883     }
   1884     //"414"      ; Request-URI Too Large
   1885     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPErrorCode414)
   1886     {
   1887         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPErrorCode414\n");
   1888     }
   1889     //"415"      ; Unsupported Media Type
   1890     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPErrorCode415)
   1891     {
   1892         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPErrorCode415\n");
   1893     }
   1894     //"451"      ; Parameter Not Understood
   1895     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPErrorCode451)
   1896     {
   1897         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPErrorCode451\n");
   1898     }
   1899     //"452"      ; Conference Not Found
   1900     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPErrorCode452)
   1901     {
   1902         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPErrorCode452\n");
   1903     }
   1904     //"453"      ; Not Enough Bandwidth
   1905     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPErrorCode453)
   1906     {
   1907         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPErrorCode453\n");
   1908     }
   1909     //"454"      ; Session Not Found
   1910     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPErrorCode454)
   1911     {
   1912         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPErrorCode454\n");
   1913     }
   1914     //"455"      ; Method Not Valid in This State
   1915     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPErrorCode455)
   1916     {
   1917         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPErrorCode455\n");
   1918     }
   1919     //"456"      ; Header Field Not Valid for Resource
   1920     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPErrorCode456)
   1921     {
   1922         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPErrorCode456\n");
   1923     }
   1924     //"457"      ; Invalid Range
   1925     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPErrorCode457)
   1926     {
   1927         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPErrorCode457\n");
   1928     }
   1929     //"458"      ; Parameter Is Read-Only
   1930     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPErrorCode458)
   1931     {
   1932         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPErrorCode458\n");
   1933     }
   1934     //"459"      ; Aggregate operation not allowed
   1935     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPErrorCode459)
   1936     {
   1937         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPErrorCode459\n");
   1938     }
   1939     //"460"      ; Only aggregate operation allowed
   1940     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPErrorCode460)
   1941     {
   1942         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPErrorCode460\n");
   1943     }
   1944     //"461"      ; Unsupported transport
   1945     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPErrorCode461)
   1946     {
   1947         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPErrorCode461\n");
   1948     }
   1949     //"462"      ; Destination unreachable
   1950     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPErrorCode462)
   1951     {
   1952         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPErrorCode462\n");
   1953     }
   1954     //"500"      ; Internal Server Error
   1955     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPErrorCode500)
   1956     {
   1957         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPErrorCode500\n");
   1958     }
   1959     //"501"      ; Not Implemented
   1960     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPErrorCode501)
   1961     {
   1962         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPErrorCode501\n");
   1963     }
   1964     //"502"      ; Bad Gateway
   1965     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPErrorCode502)
   1966     {
   1967         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPErrorCode502\n");
   1968     }
   1969     //"503"      ; Service Unavailable
   1970     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPErrorCode503)
   1971     {
   1972         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPErrorCode503\n");
   1973     }
   1974     //"504"      ; Gateway Time-out
   1975     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPErrorCode504)
   1976     {
   1977         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPErrorCode504\n");
   1978     }
   1979     //"505"      ; RTSP Version not supported
   1980     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPErrorCode505)
   1981     {
   1982         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPErrorCode505\n");
   1983     }
   1984     //"551"      ; Option not supported
   1985     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPErrorCode551)
   1986     {
   1987         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPErrorCode551\n");
   1988     }
   1989     // Unknown
   1990     else if (aErr == PVMFRTSPClientEngineNodeErrorRTSPCodeUnknown)
   1991     {
   1992         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNodeErrorRTSPCodeUnknown\n");
   1993     }
   1994     else
   1995     {
   1996         fprintf(iTestMsgOutputFile, "PVMFRTSPClientEngineNode - Unknown Error Code\n");
   1997     }
   1998 }
   1999 void pvplayer_async_test_cpmdlapassthru::HandleStreamingManagerNodeErrors(int32 aErr)
   2000 {
   2001     if (aErr == PVMFStreamingManagerNodeErrorInvalidRequestPortTag)
   2002     {
   2003         fprintf(iTestMsgOutputFile, "PVMFStreamingManagerNodeErrorInvalidRequestPortTag\n");
   2004     }
   2005     else if (aErr == PVMFStreamingManagerNodeErrorInvalidPort)
   2006     {
   2007         fprintf(iTestMsgOutputFile, "PVMFStreamingManagerNodeErrorInvalidPort\n");
   2008     }
   2009     else if (aErr == PVMFStreamingManagerNodeErrorParseSDPFailed)
   2010     {
   2011         fprintf(iTestMsgOutputFile, "PVMFStreamingManagerNodeErrorParseSDPFailed\n");
   2012     }
   2013     else if (aErr == PVMFStreamingManagerNodeGraphConnectFailed)
   2014     {
   2015         fprintf(iTestMsgOutputFile, "PVMFStreamingManagerNodeGraphConnectFailed\n");
   2016     }
   2017     else if (aErr == PVMFStreamingManagerNodeGraphDisconnectFailed)
   2018     {
   2019         fprintf(iTestMsgOutputFile, "PVMFStreamingManagerNodeGraphDisconnectFailed\n");
   2020     }
   2021     else
   2022     {
   2023         fprintf(iTestMsgOutputFile, "PVMFStreamingManagerNode - Unknown Error Code\n");
   2024     }
   2025 }
   2026 
   2027 void pvplayer_async_test_cpmdlapassthru::HandleJitterBufferNodeErrors(int32 aErr)
   2028 {
   2029     if (aErr == PVMFJitterBufferNodeRemoteInactivityTimerExpired)
   2030     {
   2031         fprintf(iTestMsgOutputFile, "PVMFJitterBufferNodeRemoteInactivityTimerExpired\n");
   2032     }
   2033     else if (aErr == PVMFJitterBufferNodeRTCPRRGenerationFailed)
   2034     {
   2035         fprintf(iTestMsgOutputFile, "PVMFJitterBufferNodeRTCPRRGenerationFailed\n");
   2036     }
   2037     else if (aErr == PVMFJitterBufferNodeUnableToRegisterIncomingPacket)
   2038     {
   2039         fprintf(iTestMsgOutputFile, "PVMFJitterBufferNodeUnableToRegisterIncomingPacket\n");
   2040     }
   2041     else if (aErr == PVMFJitterBufferNodeInputDataPacketHeaderParserError)
   2042     {
   2043         fprintf(iTestMsgOutputFile, "PVMFJitterBufferNodeInputDataPacketHeaderParserError\n");
   2044     }
   2045     else if (aErr == PVMFJitterBufferNodeRTCPSRProcFailed)
   2046     {
   2047         fprintf(iTestMsgOutputFile, "PVMFJitterBufferNodeRTCPSRProcFailed\n");
   2048     }
   2049     else
   2050     {
   2051         fprintf(iTestMsgOutputFile, "PVMFJitterBufferNode - Unknown Error Code\n");
   2052     }
   2053 }
   2054 
   2055 void pvplayer_async_test_cpmdlapassthru::HandleMediaLayerNodeErrors(int32 aErr)
   2056 {
   2057     if (aErr == PVMFMediaLayerNodePayloadParserError)
   2058     {
   2059         fprintf(iTestMsgOutputFile, "PVMFMediaLayerNodePayloadParserError\n");
   2060     }
   2061     else
   2062     {
   2063         fprintf(iTestMsgOutputFile, "PVMFMediaLayerNode - Unknown Error Code\n");
   2064     }
   2065 
   2066 }
   2067 
   2068 void pvplayer_async_test_cpmdlapassthru::HandleProtocolEngineNodeErrors(int32 aErr)
   2069 {
   2070     // The HTTP status errors are propagated up from the Protocol Engine node and
   2071     // are enumerated in pvmf_protocol_engine_node_events.h. The raw value of the error
   2072     // code can be calculated as an offset from aErr - PVProtocolEngineNodeErrorEventStart.
   2073     if ((aErr >= PVProtocolEngineNodeErrorHTTPErrorCode400) &&
   2074             (aErr <= PVProtocolEngineNodeErrorHTTPCode4xxUnknown))
   2075     {
   2076         fprintf(iTestMsgOutputFile, "PVProtocolEngineNodeError4xx HTTP Status Code %d\n",
   2077                 aErr - PVProtocolEngineNodeErrorEventStart);
   2078     }
   2079     else if ((aErr >= PVProtocolEngineNodeErrorHTTPErrorCode500) &&
   2080              (aErr < PVProtocolEngineNodeErrorHTTPCode5xxUnknownStart))
   2081     {
   2082         fprintf(iTestMsgOutputFile, "PVProtocolEngineNodeError5xx HTTP Status Code %d\n",
   2083                 aErr - PVProtocolEngineNodeErrorEventStart);
   2084     }
   2085     else if ((aErr >= PVProtocolEngineNodeErrorHTTPRedirectCodeStart) &&
   2086              (aErr <= PVProtocolEngineNodeErrorHTTPRedirectCodeEnd))
   2087     {
   2088         fprintf(iTestMsgOutputFile, "   ERROR IN REDIRECT: PVProtocolEngineNodeError3xx HTTP Status Code %d\n",
   2089                 aErr - PVProtocolEngineNodeErrorEventStart);
   2090     }
   2091     else if (aErr < PVProtocolEngineNodeErrorNotHTTPErrorStart || aErr > PVProtocolEngineNodeErrorNotHTTPErrorEnd)
   2092     {
   2093         fprintf(iTestMsgOutputFile, "   ERROR: PVProtocolEngineNodeError HTTP Unknown Status Code %d\n",
   2094                 aErr - PVProtocolEngineNodeErrorEventStart);
   2095     }
   2096     else
   2097     {
   2098         fprintf(iTestMsgOutputFile, "PVProtocolEngineNodeError General Error %d\n", aErr);
   2099     }
   2100 }
   2101 
   2102 void pvplayer_async_test_cpmdlapassthru::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent)
   2103 {
   2104     if (aEvent.GetEventType() == PVMFInfoErrorHandlingStart)
   2105     {
   2106         fprintf(iTestMsgOutputFile, "PVMFInfoErrorHandlingStart...\n");
   2107     }
   2108     if (aEvent.GetEventType() == PVMFInfoErrorHandlingComplete)
   2109     {
   2110         fprintf(iTestMsgOutputFile, "PVMFInfoErrorHandlingComplete...\n");
   2111         iState = STATE_CLEANUPANDCOMPLETE;
   2112         RunIfNotReady();
   2113     }
   2114 
   2115     switch (aEvent.GetEventType())
   2116     {
   2117         case PVMFInfoSourceFormatNotSupported:
   2118         {
   2119             // source rollover...
   2120             fprintf(iTestMsgOutputFile, "###PVMFInfoSourceFormatNotSupported...\n");
   2121             PVInterface* iface = (PVInterface*)(aEvent.GetEventExtensionInterface());
   2122             if (iface != NULL)
   2123             {
   2124                 PVUuid infomsguuid = PVMFErrorInfoMessageInterfaceUUID;
   2125                 PVMFErrorInfoMessageInterface* infomsgiface = NULL;
   2126                 if (iface->queryInterface(infomsguuid, (PVInterface*&)infomsgiface) == true)
   2127                 {
   2128                     int32 infocode;
   2129                     PVUuid infouuid;
   2130                     infomsgiface->GetCodeUUID(infocode, infouuid);
   2131                     if ((infouuid == PVPlayerErrorInfoEventTypesUUID) &&
   2132                             (infocode == PVPlayerInfoAttemptingSourceRollOver))
   2133                     {
   2134                         uint8* localBuf = aEvent.GetLocalBuffer();
   2135                         if (localBuf != NULL)
   2136                         {
   2137                             PVMFFormatType srcFormat = PVMF_MIME_FORMAT_UNKNOWN;
   2138                             oscl_memcpy(&srcFormat, &localBuf[4], sizeof(uint32));
   2139                             fprintf(iTestMsgOutputFile, "###Attempting Source RollOver - NewSrcFormat=%s\n", srcFormat.getMIMEStrPtr());
   2140                             //The clip type needs a rollover, store the actual clip type
   2141                             iFileType = srcFormat;
   2142                         }
   2143                     }
   2144                 }
   2145             }
   2146         }
   2147         break;
   2148 
   2149         case PVMFInfoBufferingStart:
   2150         {
   2151             // Preroll buffer has started filling.
   2152             fprintf(iTestMsgOutputFile, "###PVMFInfoBufferingStart...\n");
   2153         }
   2154         break;
   2155 
   2156         case PVMFInfoBufferingComplete:
   2157             fprintf(iTestMsgOutputFile, "   PVMFInfoBufferingComplete\n");
   2158             iNumBufferingComplete++;
   2159             // Only one Buffering Complete should be received
   2160             if (iNumBufferingComplete == 1)
   2161             {
   2162                 if (iState == STATE_WAIT_FOR_BUFFCOMPLETE)
   2163                 {
   2164                     Cancel();
   2165                     RunIfNotReady();
   2166                 }
   2167             }
   2168             break;
   2169             // Check for stop time reached event
   2170         case PVMFInfoEndOfData:
   2171         {
   2172             fprintf(iTestMsgOutputFile, "   PVMFInfoEndOfData\n");
   2173             PVInterface* iface = (PVInterface*)(aEvent.GetEventExtensionInterface());
   2174             if (iface == NULL)
   2175             {
   2176                 return;
   2177             }
   2178             PVUuid infomsguuid = PVMFErrorInfoMessageInterfaceUUID;
   2179             PVMFErrorInfoMessageInterface* infomsgiface = NULL;
   2180             if (iface->queryInterface(infomsguuid, (PVInterface*&)infomsgiface) == true)
   2181             {
   2182                 int32 infocode;
   2183                 PVUuid infouuid;
   2184                 infomsgiface->GetCodeUUID(infocode, infouuid);
   2185                 if ((infouuid == PVPlayerErrorInfoEventTypesUUID) && (infocode == PVPlayerInfoEndOfClipReached))
   2186                 {
   2187                     iState = STATE_STOP;
   2188                     Cancel();
   2189                     RunIfNotReady();
   2190                 }
   2191             }
   2192         }
   2193         break;
   2194 
   2195         case PVMFInfoBufferingStatus:
   2196         {
   2197             if ((iFileType == PVMF_MIME_DATA_SOURCE_PVX_FILE) || (iFileType == PVMF_MIME_DATA_SOURCE_HTTP_URL))
   2198             {
   2199                 if (aEvent.GetLocalBuffer()[0] == 0
   2200                         || aEvent.GetLocalBuffer()[0] == 100)
   2201                 {
   2202                     fprintf(iTestMsgOutputFile, "   PVMFInfoBufferingStatus %d\n", aEvent.GetLocalBuffer()[0]);
   2203                 }
   2204                 else
   2205                 {
   2206                     fprintf(iTestMsgOutputFile, ".%d.", aEvent.GetLocalBuffer()[0]);
   2207                 }
   2208             }
   2209             else
   2210             {
   2211                 uint8* localBuf = aEvent.GetLocalBuffer();
   2212                 if (localBuf != NULL)
   2213                 {
   2214                     uint32 bufPercent = 0;
   2215                     oscl_memcpy(&bufPercent, &localBuf[4], sizeof(uint32));
   2216                     fprintf(iTestMsgOutputFile, "###PVMFInfoBufferingStatus - BufferedPercent=%d\n", bufPercent);
   2217                 }
   2218             }
   2219         }
   2220         break;
   2221 
   2222         case PVMFInfoPositionStatus:
   2223         {
   2224             PVInterface* iface = (PVInterface*)(aEvent.GetEventExtensionInterface());
   2225             if (iface == NULL)
   2226             {
   2227                 return;
   2228             }
   2229             PVUuid infomsguuid = PVMFErrorInfoMessageInterfaceUUID;
   2230             PVMFErrorInfoMessageInterface* infomsgiface = NULL;
   2231             if (iface->queryInterface(infomsguuid, (PVInterface*&)infomsgiface) == true)
   2232             {
   2233                 int32 infocode;
   2234                 PVUuid infouuid;
   2235                 infomsgiface->GetCodeUUID(infocode, infouuid);
   2236                 if ((infouuid == PVPlayerErrorInfoEventTypesUUID) && (infocode == PVPlayerInfoPlaybackPositionStatus))
   2237                 {
   2238                     PVPPlaybackPosition aPos1;
   2239                     uint32 aPos2;
   2240 
   2241                     aPos1.iPosUnit = PVPPBPOSUNIT_MILLISEC;
   2242                     iPlayer->GetCurrentPositionSync(aPos1);
   2243 
   2244                     uint8* localbuf = aEvent.GetLocalBuffer();
   2245                     if (aEvent.GetLocalBufferSize() == 8 && localbuf[0] == 1)
   2246                     {
   2247                         oscl_memcpy(&aPos2, &localbuf[4], sizeof(uint32));
   2248                     }
   2249                     else
   2250                     {
   2251                         aPos2 = 0;
   2252                     }
   2253                     fprintf(iTestMsgOutputFile, "Position:%d\n", aPos2);
   2254                 }
   2255             }
   2256         }
   2257         break;
   2258         case PVMFInfoPlayListClipTransition:
   2259         {
   2260             PVExclusivePtr aPtr;
   2261             aEvent.GetEventData(aPtr);
   2262             PVMFRTSPClientEngineNodePlaylistInfoType *myType = (PVMFRTSPClientEngineNodePlaylistInfoType*)(aPtr);
   2263             fprintf(iTestMsgOutputFile, "###PVMFInfoPlayListClipTransition:\n<%s, %d, %d.%03d>;npt=%d.%03d\n", myType->iPlaylistUrlPtr
   2264                     , myType->iPlaylistIndex
   2265                     , myType->iPlaylistOffsetSec
   2266                     , myType->iPlaylistOffsetMillsec
   2267                     , myType->iPlaylistNPTSec
   2268                     , myType->iPlaylistNPTMillsec);
   2269         }
   2270         break;
   2271         case PVMFInfoDataReady:
   2272             fprintf(iTestMsgOutputFile, "   PVMFInfoDataReady\n");
   2273 
   2274             iNumDataReady++;
   2275             //special handling for very first data ready event.
   2276             if (iNumDataReady == 1)
   2277             {
   2278                 if (iState == STATE_WAIT_FOR_DATAREADY)
   2279                 {
   2280                     Cancel();
   2281                     RunIfNotReady();
   2282                 }
   2283                 //for download-then-play test, we should not get data ready
   2284                 //until download is complete
   2285                 if (iDownloadThenPlay)
   2286                 {
   2287                     if (iNumBufferingComplete == 0)
   2288                         PVPATB_TEST_IS_TRUE(false);
   2289                 }
   2290                 //for download-only test, we should not get data ready at all.
   2291                 if (iDownloadOnly)
   2292                 {
   2293                     PVPATB_TEST_IS_TRUE(false);
   2294                 }
   2295             }
   2296             break;
   2297         case PVMFInfoUnderflow:
   2298             fprintf(iTestMsgOutputFile, "   PVMFInfoUnderflow\n");
   2299             break;
   2300         case PVMFInfoContentLength:
   2301         {
   2302             PVExclusivePtr eventData;
   2303             aEvent.GetEventData(eventData);
   2304             uint32 contentSize = (uint32)(eventData);
   2305             fprintf(iTestMsgOutputFile, "   PVMFInfoContentLength = %d\n", contentSize);
   2306         }
   2307         break;
   2308         case PVMFInfoContentTruncated:
   2309         {
   2310             fprintf(iTestMsgOutputFile, "   PVMFInfoContentTruncated!\n");
   2311         }
   2312         break;
   2313 
   2314         case PVMFInfoContentType:
   2315         {
   2316             PVExclusivePtr eventData;
   2317             aEvent.GetEventData(eventData);
   2318             char *constentType = (char *)(eventData);
   2319             fprintf(iTestMsgOutputFile, "   PVMFInfoContentType   = %s\n", constentType);
   2320         }
   2321         break;
   2322     }
   2323 }
   2324 
   2325 void pvplayer_async_test_cpmdlapassthru::PrintMetadataInfo()
   2326 {
   2327     uint32 i = 0;
   2328     fprintf(iTestMsgOutputFile, "Metadata key list (count=%d):\n", iMetadataKeyList.size());
   2329     for (i = 0; i < iMetadataKeyList.size(); ++i)
   2330     {
   2331         fprintf(iTestMsgOutputFile, "Key %d: %s\n", (i + 1), iMetadataKeyList[i].get_cstr());
   2332     }
   2333 
   2334     fprintf(iTestMsgOutputFile, "\nMetadata value list (count=%d):\n", iMetadataValueList.size());
   2335     for (i = 0; i < iMetadataValueList.size(); ++i)
   2336     {
   2337         fprintf(iTestMsgOutputFile, "Value %d:\n", (i + 1));
   2338         fprintf(iTestMsgOutputFile, "   Key string: %s\n", iMetadataValueList[i].key);
   2339 
   2340         switch (GetValTypeFromKeyString(iMetadataValueList[i].key))
   2341         {
   2342             case PVMI_KVPVALTYPE_CHARPTR:
   2343                 fprintf(iTestMsgOutputFile, "   Value:%s\n", iMetadataValueList[i].value.pChar_value);
   2344                 break;
   2345 
   2346             case PVMI_KVPVALTYPE_WCHARPTR:
   2347             {
   2348                 // Assume string is in UCS-2 encoding so convert to UTF-8
   2349                 char tmpstr[65];
   2350                 oscl_UnicodeToUTF8(iMetadataValueList[i].value.pWChar_value,
   2351                                    oscl_strlen(iMetadataValueList[i].value.pWChar_value), tmpstr, 65);
   2352                 tmpstr[64] = '\0';
   2353                 fprintf(iTestMsgOutputFile, "   Value(in UTF-8, first 64 chars):%s\n", tmpstr);
   2354             }
   2355             break;
   2356 
   2357             case PVMI_KVPVALTYPE_UINT32:
   2358                 fprintf(iTestMsgOutputFile, "   Value:%d\n", iMetadataValueList[i].value.uint32_value);
   2359                 break;
   2360 
   2361             case PVMI_KVPVALTYPE_INT32:
   2362                 fprintf(iTestMsgOutputFile, "   Value:%d\n", iMetadataValueList[i].value.int32_value);
   2363                 break;
   2364 
   2365             case PVMI_KVPVALTYPE_UINT8:
   2366                 fprintf(iTestMsgOutputFile, "   Value:%d\n", iMetadataValueList[i].value.uint8_value);
   2367                 break;
   2368 
   2369             case PVMI_KVPVALTYPE_FLOAT:
   2370                 fprintf(iTestMsgOutputFile, "   Value:%f\n", iMetadataValueList[i].value.float_value);
   2371                 break;
   2372 
   2373             case PVMI_KVPVALTYPE_DOUBLE:
   2374                 fprintf(iTestMsgOutputFile, "   Value:%f\n", iMetadataValueList[i].value.double_value);
   2375                 break;
   2376 
   2377             case PVMI_KVPVALTYPE_BOOL:
   2378                 if (iMetadataValueList[i].value.bool_value)
   2379                 {
   2380                     fprintf(iTestMsgOutputFile, "   Value:true(1)\n");
   2381                 }
   2382                 else
   2383                 {
   2384                     fprintf(iTestMsgOutputFile, "   Value:false(0)\n");
   2385                 }
   2386                 break;
   2387 
   2388             default:
   2389                 fprintf(iTestMsgOutputFile, "   Value: UNKNOWN VALUE TYPE\n");
   2390                 break;
   2391         }
   2392 
   2393         fprintf(iTestMsgOutputFile, "   Length:%d  Capacity:%d\n", iMetadataValueList[i].length, iMetadataValueList[i].capacity);
   2394 
   2395         if ((oscl_strstr(iMetadataValueList[i].key, "duration")) && iSessionDuration == 0)
   2396         {
   2397             iSessionDuration = iMetadataValueList[i].value.uint32_value;
   2398 
   2399             // Check the timescale. If not available, assume millisecond (1000)
   2400             const char *retTSstr;
   2401             retTSstr = oscl_strstr(iMetadataValueList[i].key, "timescale=");
   2402             uint32 retTSstrLen = 0;
   2403             uint32 tsstrlen = oscl_strlen(_STRLIT_CHAR("timescale="));
   2404             if (retTSstr != NULL)
   2405             {
   2406                 retTSstrLen = oscl_strlen(retTSstr);
   2407                 if (retTSstrLen > tsstrlen)
   2408                 {
   2409                     uint32 timescale = 0;
   2410                     PV_atoi((char*)(retTSstr + tsstrlen), 'd', (retTSstrLen - tsstrlen), timescale);
   2411                     if (timescale > 0 && timescale != 1000)
   2412                     {
   2413                         // Convert to milliseconds
   2414                         MediaClockConverter mcc(timescale);
   2415                         mcc.update_clock(iSessionDuration);
   2416                         iSessionDuration = mcc.get_converted_ts(1000);
   2417                     }
   2418                 }
   2419             }
   2420         }
   2421         if (oscl_strcmp((char*)(iMetadataValueList[i].key),
   2422                         _STRLIT_CHAR("duration;valtype=char*")) == 0)
   2423         {
   2424             if (iPlayListURL == false)
   2425             {
   2426                 oLiveSession = true;
   2427             }
   2428         }
   2429     }
   2430 
   2431     fprintf(iTestMsgOutputFile, "\n\n");
   2432 }
   2433 
   2434