awslabs / amazon-kinesis-video-streams-webrtc-sdk-c

Amazon Kinesis Video Streams Webrtc SDK is for developers to install and customize realtime communication between devices and enable secure streaming of video, audio to Kinesis Video Streams.
https://awslabs.github.io/amazon-kinesis-video-streams-webrtc-sdk-c/group__PublicMemberFunctions.html
Apache License 2.0
1.04k stars 317 forks source link

[Bug]: Sample session is closed on master side after viewer disconnection #2057

Open skndi opened 2 months ago

skndi commented 2 months ago

Please confirm you have already done the following

Describe the bug

When a viewer disconnection is detected the stream is closed immediately instead of waiting for a reconnection.

Expected Behavior

The session should not be destructed before ICE_CONNECTION_STATE_FAILED is reached.

Current Behavior

https://gist.github.com/skndi/95bb6a5548905fecd0de9ea7745e0742

The behavior seems to come from this line https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-c/blob/8248241cec28b651839d91f77a706f4fd028dbeb/samples/Common.c#L84 I think the session should be marked for termination only if the new state is RTC_PEER_CONNECTION_STATE_FAILED or RTC_PEER_CONNECTION_STATE_FAILED.

Reproduction Steps

  1. Start a session between master/viewer
  2. Prevent the viewer from sending heartbeat messages, e.g. stop internet connection on viewer side
  3. Observe the session is closed immediately when disconnection is sensed

WebRTC C SDK version being used

1.10.2

Compiler and Version used

gcc 10.2

Operating System and version

Embedded Linux

Platform being used

Ambarella CV2 chip, aarch64