OpenVidu / openvidu-tutorials

OpenVidu tutorials to get started
http://openvidu.io/tutorials
Apache License 2.0
228 stars 255 forks source link

openvidu-ipcameras fails in version 2.21.0 #173

Closed mochr closed 2 years ago

mochr commented 2 years ago

I have tested the openvidu-ipcameras tutorial with version 2.20.0 of the development container (openvidu/openvidu-server-kms:2.20.0) and version 2.20.0 of the tutorial code. The only modifications I did was to change the IP_CAMERAS list in App.java to contain an IP cameras in my LAN. For version 2.20.0 this works, and the video is displayed in the browser. For version 2.21.0 of the development container and tutorial code the tutorial web page is stuck after starting a loader.

For version 2.20.0, the dashboard log of the server is as follows:

KMS event [IceGatheringDone] -> endpoint: con_PsZenKgLdp_str_IPC_XAMS_ipc_IPCAM_rtsp_CSYK_192_168_1_64_Streaming_Channels_101 (subscriber) | timestamp: 1649756059774

KMS event [UriEndpointStateChangedEvent]: -> endpoint: str_IPC_XAMS_ipc_IPCAM_rtsp_CSYK_192_168_1_64_Streaming_Channels_101 (publisher) | state: START | timestamp: 1649756059777

KMS event [IceComponentStateChange]: -> endpoint: con_PsZenKgLdp_str_IPC_XAMS_ipc_IPCAM_rtsp_CSYK_192_168_1_64_Streaming_Channels_101 (subscriber) | state: CONNECTING | componentId: 1 | streamId: 1 | timestamp: 1649756060707

KMS event [IceComponentStateChange]: -> endpoint: con_PsZenKgLdp_str_IPC_XAMS_ipc_IPCAM_rtsp_CSYK_192_168_1_64_Streaming_Channels_101 (subscriber) | state: CONNECTED | componentId: 1 | streamId: 1 | timestamp: 1649756060765

KMS event [IceComponentStateChange]: -> endpoint: con_PsZenKgLdp_str_IPC_XAMS_ipc_IPCAM_rtsp_CSYK_192_168_1_64_Streaming_Channels_101 (subscriber) | state: CONNECTED | componentId: 1 | streamId: 1 | timestamp: 1649756060858

KMS event [IceComponentStateChange]: -> endpoint: con_PsZenKgLdp_str_IPC_XAMS_ipc_IPCAM_rtsp_CSYK_192_168_1_64_Streaming_Channels_101 (subscriber) | state: READY | componentId: 1 | streamId: 1 | timestamp: 1649756060765

KMS event [IceComponentStateChange]: -> endpoint: con_PsZenKgLdp_str_IPC_XAMS_ipc_IPCAM_rtsp_CSYK_192_168_1_64_Streaming_Channels_101 (subscriber) | state: READY | componentId: 1 | streamId: 1 | timestamp: 1649756060864

KMS event [NewCandidatePairSelected]: -> endpoint: con_PsZenKgLdp_str_IPC_XAMS_ipc_IPCAM_rtsp_CSYK_192_168_1_64_Streaming_Channels_101 (subscriber) | local: candidate:4 1 UDP 1847591167 163.34.96.32 59936 typ prflx raddr 172.23.0.2 rport 30683 | remote: candidate:2556107979 1 UDP 2113937151 163.34.96.32 58834 typ host | timestamp: 1649756060765

KMS event [ConnectionStateChanged]: -> endpoint: con_PsZenKgLdp_str_IPC_XAMS_ipc_IPCAM_rtsp_CSYK_192_168_1_64_Streaming_Channels_101 (subscriber) | oldState: DISCONNECTED | newState: CONNECTED | timestamp: 1649756062774

KMS event [MediaFlowOutStateChange] -> endpoint: str_IPC_XAMS_ipc_IPCAM_rtsp_CSYK_192_168_1_64_Streaming_Channels_101 (publisher) | state: FLOWING | pad: default | mediaType: VIDEO | timestamp: 1649756065008

KMS event [MediaFlowInStateChange] -> endpoint: con_PsZenKgLdp_str_IPC_XAMS_ipc_IPCAM_rtsp_CSYK_192_168_1_64_Streaming_Channels_101 (subscriber) | state: FLOWING | pad: default | mediaType: VIDEO | timestamp: 1649756065100

KMS event [MediaStateChangedEvent]: -> endpoint: con_PsZenKgLdp_str_IPC_XAMS_ipc_IPCAM_rtsp_CSYK_192_168_1_64_Streaming_Channels_101 (subscriber) | oldState: DISCONNECTED | newState: CONNECTED | timestamp: 1649756065206

For version 2.21.0, the dashboard log of the server is as follows:

KMS event [IceGatheringDone] -> endpoint: con_HKKsIHCOzF_str_IPC_Nvs6_ipc_IPCAM_rtsp_VH3F_192_168_1_64_Streaming_Channels_101 (subscriber) | timestamp: 1649757831622

KMS event [UriEndpointStateChangedEvent]: -> endpoint: str_IPC_Nvs6_ipc_IPCAM_rtsp_VH3F_192_168_1_64_Streaming_Channels_101 (publisher) | state: START | timestamp: 1649757831646

KMS event [MediaTranscodingStateChange]: -> endpoint: str_IPC_Nvs6_ipc_IPCAM_rtsp_VH3F_192_168_1_64_Streaming_Channels_101 (publisher) | state: NOT_TRANSCODING | mediaType: VIDEO | binName: kmsplayerendpoint0_kmsagnosticbin2-2 | timestamp: 1649757837600

KMS event [MediaFlowOutStateChange] -> endpoint: str_IPC_Nvs6_ipc_IPCAM_rtsp_VH3F_192_168_1_64_Streaming_Channels_101 (publisher) | state: FLOWING | pad: default | mediaType: VIDEO | timestamp: 1649757837602

In version 2.21.0 I get multiple errors in the console:

OpenViduLogger.ts:264 ERROR:Request to onIceCandidate for connection ipc_IPCAM_rtsp_VH3F_192_168_1_64_Streaming_Channels_101 gone wrong. There is no publisher endpoint available. Code: 408 in Request: method:onIceCandidate params:{"endpointName":"ipc_IPCAM_rtsp_VH3F_192_168_1_64_Streaming_Channels_101","candidate":"candidate:2556107979 1 udp 2113937151 e2d96cdc-a0e0-4b20-a7e8-c5b6ae7de0e2.local 53748 typ host generation 0 ufrag Zwnt network-cost 999","sdpMid":"0","sdpMLineIndex":0} request:undefined

OpenViduLogger.ts:264 Error sending ICE candidate: {"code":408,"message":"Request to onIceCandidate for connection ipc_IPCAM_rtsp_VH3F_192_168_1_64_Streaming_Channels_101 gone wrong. There is no publisher endpoint available. Code: 408","sessionId":"caq5e3uqobsk85ot8q7s7spqrj","requestTime":1649757832352}

OpenViduLogger.ts:243 Event 'exception' triggered by 'Session' ExceptionEvent {hasBeenPrevented: false, cancelable: false, target: Session, type: 'exception', name: 'ICE_CANDIDATE_ERROR', …}

?credentials=PASSWORD:91 ExceptionEvent {hasBeenPrevented: false, cancelable: false, target: Session, type: 'exception', name: 'ICE_CANDIDATE_ERROR', …}

OpenViduLogger.ts:222 IceConnectionState of RTCPeerConnection a776e8b2-f281-417e-a29a-eb2a94376909 (str_IPC_Nvs6_ipc_IPCAM_rtsp_VH3F_192_168_1_64_Streaming_Channels_101) change to "checking"
OpenViduLogger.ts:264 ERROR:Request to onIceCandidate for connection ipc_IPCAM_rtsp_VH3F_192_168_1_64_Streaming_Channels_101 gone wrong. There is no publisher endpoint available. Code: 408 in Request: method:onIceCandidate params:{"endpointName":"ipc_IPCAM_rtsp_VH3F_192_168_1_64_Streaming_Channels_101","candidate":"candidate:2556107979 1 udp 2113937151 e2d96cdc-a0e0-4b20-a7e8-c5b6ae7de0e2.local 53750 typ host generation 0 ufrag Zwnt network-cost 999","sdpMid":"1","sdpMLineIndex":1} request:undefined

I'm in a corporate network on a PC that might have some restrictions on networking that I'm not aware of. I also tried to turn off the internet connection, but then both version 2.20.0 and 2.21.0 failed. Is it not possible to use OpenVidu without an internet connection?

Our use case is to stream video from several IP cameras to a user interface in a browser, all in the same LAN.

Is it possible to force the OpenVidu server to only use local STUN, or disable STUN? Does the development container include a STUN server?

micaelgallego commented 2 years ago

@j1elo can you take a look to this issue please?

j1elo commented 2 years ago

Hi @mochr I've been able to verify your issue, that

In version 2.21.0 I get multiple errors in the console:

OpenViduLogger.ts:264 ERROR:Request to onIceCandidate for connection ipc_IPCAM_rtsp_VH3F_192_168_1_64_Streaming_Channels_101 gone wrong. There is no publisher endpoint available. Code: 408 in Request: method:onIceCandidate params:{"endpointName":"ipc_IPCAM_rtsp_VH3F_192_168_1_64_Streaming_Channels_101","candidate":"candidate:2556107979 1 udp 2113937151 e2d96cdc-a0e0-4b20-a7e8-c5b6ae7de0e2.local 53748 typ host generation 0 ufrag Zwnt network-cost 999","sdpMid":"0","sdpMLineIndex":0} request:undefined

OpenViduLogger.ts:264 Error sending ICE candidate: {"code":408,"message":"Request to onIceCandidate for connection ipc_IPCAM_rtsp_VH3F_192_168_1_64_Streaming_Channels_101 gone wrong. There is no publisher endpoint available. Code: 408","sessionId":"caq5e3uqobsk85ot8q7s7spqrj","requestTime":1649757832352}

OpenViduLogger.ts:243 Event 'exception' triggered by 'Session' ExceptionEvent {hasBeenPrevented: false, cancelable: false, target: Session, type: 'exception', name: 'ICE_CANDIDATE_ERROR', …}

?credentials=PASSWORD:91 ExceptionEvent {hasBeenPrevented: false, cancelable: false, target: Session, type: 'exception', name: 'ICE_CANDIDATE_ERROR', …}

OpenViduLogger.ts:222 IceConnectionState of RTCPeerConnection a776e8b2-f281-417e-a29a-eb2a94376909 (str_IPC_Nvs6_ipc_IPCAM_rtsp_VH3F_192_168_1_64_Streaming_Channels_101) change to "checking"
OpenViduLogger.ts:264 ERROR:Request to onIceCandidate for connection ipc_IPCAM_rtsp_VH3F_192_168_1_64_Streaming_Channels_101 gone wrong. There is no publisher endpoint available. Code: 408 in Request: method:onIceCandidate params:{"endpointName":"ipc_IPCAM_rtsp_VH3F_192_168_1_64_Streaming_Channels_101","candidate":"candidate:2556107979 1 udp 2113937151 e2d96cdc-a0e0-4b20-a7e8-c5b6ae7de0e2.local 53750 typ host generation 0 ufrag Zwnt network-cost 999","sdpMid":"1","sdpMLineIndex":1} request:undefined

However, the RTSP stream plays back fine for me, even despite the above errors in the console. I'm using a test RTSP stream generated by VLC with a command such as this:

VLC_RTP="sdp=rtsp://0.0.0.0:8554/video.sdp"
vlc -I dummy -vvv --repeat video.mp4 --sout "#rtp{$VLC_RTP}"

So besides the errors, there is probably something additional in your scenario, that is causing playback issues.

Regardless, I've also confirmed with the latest nightly build that this issue is fixed already in the development branch. So for your case, I'd recommend to stay on the v2.20 and wait until v2.22 is released.

j1elo commented 2 years ago

Fixed by https://github.com/OpenVidu/openvidu/commit/87f2613860995e9e13bb8379e87ac7f0b48d387c

j1elo commented 2 years ago

Even though this issue is closed, please feel free to add here any additional logs from the media server, as it might uncover the actual issue you had been facing to play your RTSP stream. Maybe it was a decoding issue or something like that...