amazon-kinesis-video-streams-webrtc-sdk-c icon indicating copy to clipboard operation
amazon-kinesis-video-streams-webrtc-sdk-c copied to clipboard

[BUG] Audio Recieved Delay Getting Bigger.

Open liquanqing opened this issue 1 year ago • 3 comments

In webRTC to play audio , i found that The Voice playback delay is getting bigger and bigger. I test this in PC to WebSite, PC's audio to WebSite is Normal, and WebSite's audio to PC's has big delay after a moment. I print the log and found that, real timestamp is 10ms, but print times go 20ms. so i think this is why delay delay is getting bigger. This is my print format : DLOGI("[%" PRIu64 "]Audio Frame received. TrackId: %" PRIu64 ", Size: %u, Flags %u",pFrame->presentationTs, pFrame->trackId, pFrame->size, pFrame->flags);

how can i solved this?

** Logging **

2024-09-11 08:48:38.171 INFO sampleSenderBandwidthEstimationHandler(): Adjustment made: average packet loss = 0.00%, timediff: 10317856 ms 2024-09-11 08:48:38.172 INFO sampleSenderBandwidthEstimationHandler(): Suggested video bitrate 0 kbps, suggested audio bitrate: 0 bps, sent: 38001 bytes 173 packets received: 38001 bytes 173 packets in 994 msec 2024-09-11 08:48:38.173 VERBOSE rtcpReportsCallback(): sender report 9040 16900839410226619125 327049 : 474 packets 103534 bytes 2024-09-11 08:48:38.174 INFO sampleAudioFrameHandler(): [34614539130000]Audio Frame received. TrackId: 80671792, Size: 84, Flags 2514072763 2024-09-11 08:48:38.193 INFO sampleAudioFrameHandler(): [34614548730000]Audio Frame received. TrackId: 80671792, Size: 81, Flags 2514072763 2024-09-11 08:48:38.213 INFO sampleAudioFrameHandler(): [34614558330000]Audio Frame received. TrackId: 80671792, Size: 80, Flags 2514072763 2024-09-11 08:48:38.233 INFO sampleAudioFrameHandler(): [34614567930000]Audio Frame received. TrackId: 80671792, Size: 82, Flags 2514072763 2024-09-11 08:48:38.254 INFO sampleAudioFrameHandler(): [34614577530000]Audio Frame received. TrackId: 80671792, Size: 74, Flags 2514072763 2024-09-11 08:48:38.274 INFO sampleAudioFrameHandler(): [34614587130000]Audio Frame received. TrackId: 80671792, Size: 72, Flags 2514072763 2024-09-11 08:48:38.294 INFO sampleAudioFrameHandler(): [34614596730000]Audio Frame received. TrackId: 80671792, Size: 77, Flags 2514072763 2024-09-11 08:48:38.313 INFO sampleAudioFrameHandler(): [34614606330000]Audio Frame received. TrackId: 80671792, Size: 80, Flags 2514072763 2024-09-11 08:48:38.333 INFO sampleAudioFrameHandler(): [34614615930000]Audio Frame received. TrackId: 80671792, Size: 77, Flags 2514072763 2024-09-11 08:48:38.350 VERBOSE rtcpReportsCallback(): sender report 19264 16900839410985904059 183007 : 156 packets 26520 bytes 2024-09-11 08:48:38.355 INFO sampleAudioFrameHandler(): [34614625530000]Audio Frame received. TrackId: 80671792, Size: 81, Flags 2514072763 2024-09-11 08:48:38.375 INFO sampleAudioFrameHandler(): [34614635130000]Audio Frame received. TrackId: 80671792, Size: 87, Flags 2514072763 2024-09-11 08:48:38.395 INFO sampleAudioFrameHandler(): [34614644730000]Audio Frame received. TrackId: 80671792, Size: 96, Flags 2514072763 2024-09-11 08:48:38.415 INFO sampleAudioFrameHandler(): [34614654330000]Audio Frame received. TrackId: 80671792, Size: 88, Flags 2514072763

liquanqing avatar Sep 11 '24 09:09 liquanqing

image Different time interval for audio Frame received. Frame presentationTs has 10ms. But Log print Time has 20ms.

liquanqing avatar Sep 11 '24 09:09 liquanqing

i found that there has packet loss, the audio delay will increase, but can not recover after the packet loss decrease. and i modify the DEFAULT_ROLLING_BUFFER_DURATION_IN_SECONDS and JITTER_BUFFER_HASH_TABLE_BUCKET_COUNT to less of bigger but could not help except restart Peer connection. DEFAULT_ROLLING_BUFFER_DURATION_IN_SECONDS is 1.

liquanqing avatar Sep 12 '24 05:09 liquanqing

I think I have encountered this issue as well, when using alaw audio. If I set the audio frame duration to 10ms there will be a small delay but the audio with be in sync but sped up. When I have it set to 20 the delay will keep getting bigger but it will sound correct.

abelREK avatar Jan 25 '25 02:01 abelREK

This is a very old issue. We encourage you to check if this is still an issue in the latest release and if you find that this is still a problem, please feel free to open a new one.

github-actions[bot] avatar Jul 25 '25 00:07 github-actions[bot]