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