Closed weichihl closed 2 years ago
KVS requires cluster's timestamp should larger than previous timestamp.
If we have these frames in stream buffer:
video frame, type=cluster, absolute timestamp = 100, delta timestamp = 0 ...... audio frame, type=simple block, absolute timestamp = 200, delta timestamp = 100 audio frame, type=simple block, absolute timestamp = 220, delta timestamp = 120
Now we want to add a video frame, type=cluster, absolute timestamp = 200, current solution would insert it into stream buffer as:
video frame 1, type=cluster, absolute timestamp = 100, delta timestamp = 0 ...... audio frame 8, type=simple block, absolute timestamp = 200, delta timestamp = 100 video frame 2, type=cluster, absolute timestamp = 200, delta timestamp = 0 audio frame 9, type=simple block, absolute timestamp = 220, delta timestamp = 120
There will be 2 issues in this orders. KVS would return 4004 error if we send these frames out.
The first issues is that timestamp of audio frame 8 is the same as video frame 2. In this case, we should send video frame 2 first, not audio frame 8.
The second issue is that delta timestamp of audio 9 should be adjusted according to video frame 2.
This fix would make the stream buffer as:
video frame 1, type=cluster, absolute timestamp = 100, delta timestamp = 0 ...... video frame 2, type=cluster, absolute timestamp = 200, delta timestamp = 0 audio frame 8, type=simple block, absolute timestamp = 200, delta timestamp = 0 audio frame 9, type=simple block, absolute timestamp = 220, delta timestamp = 20
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
KVS requires cluster's timestamp should larger than previous timestamp.
If we have these frames in stream buffer:
Now we want to add a video frame, type=cluster, absolute timestamp = 200, current solution would insert it into stream buffer as:
There will be 2 issues in this orders. KVS would return 4004 error if we send these frames out.
The first issues is that timestamp of audio frame 8 is the same as video frame 2. In this case, we should send video frame 2 first, not audio frame 8.
The second issue is that delta timestamp of audio 9 should be adjusted according to video frame 2.
This fix would make the stream buffer as:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.