PVOID ProducerClientBasicTest::staticCreateProducerClientRoutine()

in tst/ProducerClientBasicTest.cpp [44:145]


PVOID ProducerClientBasicTest::staticCreateProducerClientRoutine(PVOID arg)
{
    UINT64 index = (UINT64) arg;
    StreamInfo streamInfo;
    TrackInfo trackInfo;
    STATUS retStatus;
    ProducerClientBasicTest* pTest = (ProducerClientBasicTest*) gProducerClientTestBase;
    PAuthCallbacks pAuthCallbacks;
    DeviceInfo deviceInfo;

    MEMSET(&streamInfo, 0x00, SIZEOF(StreamInfo));
    MEMSET(&trackInfo, 0x00, SIZEOF(TrackInfo));
    MEMSET(&deviceInfo, 0x00, SIZEOF(DeviceInfo));

    deviceInfo.version = DEVICE_INFO_CURRENT_VERSION;
    STRCPY(deviceInfo.name, TEST_DEVICE_INFO_NAME);
    STRCPY(deviceInfo.clientId, TEST_CLIENT_ID);
    deviceInfo.streamCount = 1;
    deviceInfo.tagCount = 0;
    deviceInfo.tags = NULL;
    deviceInfo.storageInfo.version = STORAGE_INFO_CURRENT_VERSION;
    deviceInfo.storageInfo.storageType = DEVICE_STORAGE_TYPE_IN_MEM;
    deviceInfo.storageInfo.spillRatio = 0;
    deviceInfo.storageInfo.storageSize = MIN_STORAGE_ALLOCATION_SIZE;
    deviceInfo.storageInfo.rootDirectory[0] = '\0';
    deviceInfo.clientInfo.version = CLIENT_INFO_CURRENT_VERSION;
    deviceInfo.clientInfo.stopStreamTimeout = 0;
    deviceInfo.clientInfo.createStreamTimeout = 0;
    deviceInfo.clientInfo.createClientTimeout = 0;
    deviceInfo.clientInfo.offlineBufferAvailabilityTimeout = 0;
    deviceInfo.clientInfo.loggerLogLevel = GET_LOGGER_LOG_LEVEL();
    deviceInfo.clientInfo.logMetric = TRUE;

    EXPECT_EQ(STATUS_SUCCESS, createAbstractDefaultCallbacksProvider(TEST_DEFAULT_CHAIN_COUNT,
            API_CALL_CACHE_TYPE_NONE,
            TEST_CACHING_ENDPOINT_PERIOD,
            pTest->mRegion,
            TEST_CONTROL_PLANE_URI,
            pTest->mCaCertPath,
            NULL,
            TEST_USER_AGENT,
            &pTest->mClientCallbacks[index]));

    EXPECT_EQ(STATUS_SUCCESS, createStaticAuthCallbacks(pTest->mClientCallbacks[index],
            pTest->mAccessKey,
            pTest->mSecretKey,
            pTest->mSessionToken,
            MAX_UINT64,
            &pAuthCallbacks));

    // Create the producer client
    EXPECT_EQ(STATUS_SUCCESS, createKinesisVideoClientSync(&deviceInfo,
            pTest->mClientCallbacks[index],
            &pTest->mClients[index]));

    trackInfo.version = TRACK_INFO_CURRENT_VERSION;
    trackInfo.trackId = DEFAULT_VIDEO_TRACK_ID;
    trackInfo.codecPrivateData = NULL;
    trackInfo.codecPrivateDataSize = 0;
    STRCPY(trackInfo.codecId, MKV_H264_AVC_CODEC_ID);
    STRCPY(trackInfo.trackName, (PCHAR) "kinesis_video");
    trackInfo.trackType = MKV_TRACK_INFO_TYPE_VIDEO;
    trackInfo.trackCustomData.trackVideoConfig.videoHeight = 1080;
    trackInfo.trackCustomData.trackVideoConfig.videoWidth = 1920;

    streamInfo.version = STORAGE_INFO_CURRENT_VERSION;
    streamInfo.kmsKeyId[0] = '\0';
    streamInfo.retention = 2 * HUNDREDS_OF_NANOS_IN_AN_HOUR;
    streamInfo.streamCaps.streamingType = STREAMING_TYPE_REALTIME;
    streamInfo.tagCount = 0;
    streamInfo.tags = NULL;
    STRCPY(streamInfo.streamCaps.contentType, MKV_H264_CONTENT_TYPE);
    streamInfo.streamCaps.fragmentAcks = TRUE;
    streamInfo.streamCaps.nalAdaptationFlags = NAL_ADAPTATION_FLAG_NONE;
    streamInfo.streamCaps.segmentUuid = NULL;
    streamInfo.streamCaps.absoluteFragmentTimes = TRUE;
    streamInfo.streamCaps.keyFrameFragmentation = TRUE;
    streamInfo.streamCaps.adaptive = TRUE;
    streamInfo.streamCaps.frameTimecodes = TRUE;
    streamInfo.streamCaps.recalculateMetrics = TRUE;
    streamInfo.streamCaps.recoverOnError = TRUE;
    streamInfo.streamCaps.avgBandwidthBps = 10 * 1024;
    streamInfo.streamCaps.bufferDuration = 20 * HUNDREDS_OF_NANOS_IN_A_SECOND;
    streamInfo.streamCaps.replayDuration = 10 * HUNDREDS_OF_NANOS_IN_A_SECOND;
    streamInfo.streamCaps.fragmentDuration = 2 * HUNDREDS_OF_NANOS_IN_A_SECOND;
    streamInfo.streamCaps.connectionStalenessDuration = 20 * HUNDREDS_OF_NANOS_IN_A_SECOND;
    streamInfo.streamCaps.maxLatency = TEST_MAX_STREAM_LATENCY;
    streamInfo.streamCaps.timecodeScale = 1 * HUNDREDS_OF_NANOS_IN_A_MILLISECOND;
    streamInfo.streamCaps.frameRate = 25;
    streamInfo.streamCaps.trackInfoCount = 1;
    streamInfo.streamCaps.trackInfoList = &trackInfo;
    streamInfo.streamCaps.frameOrderingMode = FRAME_ORDER_MODE_PASS_THROUGH;
    SPRINTF(streamInfo.name, "ScaryTestStream_%u", (UINT32) index);
	
    EXPECT_EQ(STATUS_SUCCESS, retStatus = createKinesisVideoStreamSync(pTest->mClients[index], &streamInfo, &pTest->mStreams[index]));

    if (++pTest->mActiveStreamCount == TEST_STREAM_COUNT) {
        CVAR_SIGNAL(pTest->mStreamsCreated);
    }

    return (PVOID) (UINT64) retStatus;
}