awslabs / amazon-kinesis-video-streams-producer-c

https://awslabs.github.io/amazon-kinesis-video-streams-producer-c/group__PublicMemberFunctions.html
Apache License 2.0
54 stars 72 forks source link

[QUESTION] 2 ~ 3 second delay in uploading video #155

Closed henryChmn closed 3 years ago

henryChmn commented 3 years ago

We want to uploading frames to KVS stream immediately, currently the process have 2~3 seconds delay before frame are pushed to KVS when using sample code, Are there any possible to reduce the stream setup time before uploading? The goal is to reduce the latency and can immediately uploading frames to KVS stream.

By reference below, how can we have a single stream crated at the boot of the device and if have network down situation, is there any thing we need to do for recovery?
https://github.com/awslabs/amazon-kinesis-video-streams-producer-c/issues/54 Have a single stream crated at the boot of the device. As you get frames submit them directly into the KVS stream.

MushMal commented 3 years ago

Your question is not well formed. If you mean an intra-frame delay then the latency might be related to the network latency, though we have a known latency in curl easy interface that might add a few hundred milliseconds on unpause.

However, if you are asking about stream creation time then your application can create a stream object and keep it in the ready state without pushing any frames. As soon as there is the first frame pushed the state machine will have PutMedia call and will start pushing data.

henryChmn commented 3 years ago

We are asking about stream creation time. If we create a stream object and keep it in the ready state and waiting to put first frame, in the mean while we have network disconnect. Do we need recreate a stream object after network recovers or it without problem to put first frames? And how long we can keep it?

MushMal commented 3 years ago

There is no connection open during ready state so no bearing on networking

henryChmn commented 3 years ago

So I just stay in sample code L285 to waiting first frame incoming? https://github.com/awslabs/amazon-kinesis-video-streams-producer-c/blob/ee4eb03429f03737d9245e54f4d2fb13b08eaf80/samples/KvsAacAudioVideoStreamingSample.c#L284-L286

MushMal commented 3 years ago

We are not exposed to your application. The samples are designed to demonstrate continuous streaming.

However, the general idea is this

The lifecycle of the main objects as well as auxiliary objects like credential providers is demonstrated in the sample code.

Please resolve this issue if you have no further questions regarding it. Feel free to cut new issues with different subject.

jonescx commented 3 years ago

@MushMal in the loop and put frames step, how can we know the frame is uploaded successfully or fail? Is there a callback for application to know the uploading feedback? Thanks.

MushMal commented 3 years ago

Frames are being put into the buffer only by the thread that calls out frame. The buffer is emptied by the network thread. The granularity of the backend ack is per fragment so only entire fragments are acked. You can check for the acks and the timestamps in the acks - no acks are given at the frame granularity.

jonescx commented 3 years ago

@MushMal Could you show us the function of sample code where we can check the acks and the timestamps in the acks? Thanks.

MushMal commented 3 years ago

Check the fragment ack callback. All of the public’s are documented in the public header files. https://github.com/awslabs/amazon-kinesis-video-streams-pic/blob/master/src/client/include/com/amazonaws/kinesis/video/client/Include.h#L1945

The c producer has the same callback in encapsulated in the stream callbacks

disa6302 commented 3 years ago

Closing the issue assuming question is answered.