使用Kinesis WebRTC C SDK从Kinesis流中获取帧数据

问题描述

我目前正在使用Kinesis webRTC JS SDK将数据从前端(网络摄像头)流式传输到Kinesis Signaling Channel,并且我想在后端使用此数据,为此,我尝试使用Kinesis webRTC C的示例代码SDK kvsWebrtcclientViewer 。我需要使用查看器中的数据并将其存储到图像中或将其发送到 Rekognition

VOID sampleFrameHandler(UINT64 customData,PFrame pFrame)
{
UNUSED_ParaM(customData);
STATUS retStatus = STATUS_SUCCESS;
 DLOGV("Frame received. TrackId: %" PRIu64 ",Size: %u,Flags %u",pFrame->trackId,pFrame->size,pFrame->flags);
printf("\n Frame received. TrackId: %" PRIu64 ",pFrame->flags);

    FILE  *fp;
    fp =fopen("../outputimages/image2.jpg","w");
    fwrite(&pFrame->frameData,1,sizeof(pFrame->frameData),fp);

PSampleStreamingSession pSampleStreamingSession = (PSampleStreamingSession) customData;
if (pSampleStreamingSession->firstFrame) {
    pSampleStreamingSession->firstFrame = FALSE;
    pSampleStreamingSession->startUpLatency = (GETTIME() - pSampleStreamingSession->offerReceiveTime) / HUNDREDS_OF_NANOS_IN_A_MILLISECOND;
    printf("Start up latency from offer to first frame: %" PRIu64 "ms\n",pSampleStreamingSession->startUpLatency);
}

    retStatus = writeFile("../outputimages/image.h264",TRUE,pFrame->frameData,(UINT64)pFrame->size);
    printf("Trying to write file");
    if (retStatus != STATUS_SUCCESS) {
    printf("[KVS Master] readFile(): operation returned status code: 0x%08x \n",retStatus);
}
}

代码段来自kinesis webRTC C SDK的示例代码。将pFrame iamge / byte数据写入jpg或png图像的正确方法是什么?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)