sipsorcery-org / sipsorcery

A WebRTC, SIP and VoIP library for C# and .NET. Designed for real-time communications apps.
https://sipsorcery-org.github.io/sipsorcery
Other
1.43k stars 432 forks source link

Problem receiving VP8 frames from Android/Samsung with either FFmpeg or native VP8 #1016

Closed pjacobs-eu closed 8 months ago

pjacobs-eu commented 11 months ago

Hello,

We're trying to do some CV processing using "P2P calls" with SipSorcery. Great library, thanks again. During our tests, we noticed that on some mobile devices (Android, Samsung) the overall decoding of video packets does not work correctly, neither with FFmpeg or with the .Encoders native VP8 library.

We are using the latest versions of all libraries. The .Encoders implementation does not really produce verbose error messages per frame, the FFmpeg version however, does:

info: sipsorcery[0] ICE RTP channel connected after 325ms udp:[::]:57182 (host)->udp:xx.xx.xx.xx:46661 (srflx). ICE connection state changed to connected. info: sipsorcery[0] ICE connected to remote end point xx.xx.xx.xx:46661. dbug: sipsorcery[0] Starting DLS handshake with role active. dbug: sipsorcery[0] RTCPeerConnection DoDtlsHandshake started. dbug: sipsorcery[0] DTLS commencing handshake as client. dbug: sipsorcery[0] RTCPeerConnection DTLS handshake result True, is handshake complete True. dbug: sipsorcery[0] RTCPeerConnection remote certificate fingerprint matched expected value of xxxxxfor sha-256. dbug: sipsorcery[0] Set remote track (video - index=0) SSRC to 2813945153. dbug: sipsorcery[0] Video depacketisation codec set to VP8 for SSRC 2813945153. dbug: SIPSorceryMedia.FFmpeg.FFmpegVideoEncoder[0] [InitialiseDecoder] CodecId:[AV_CODEC_ID_VP8 [vp8 @ 0000025f84d29380] Header size larger than data provided warn: SIPSorceryMedia.FFmpeg.FFmpegVideoEndPoint[0] Decode of video sample failed, width 0, height 0. [vp8 @ 0000025f84d29380] Unknown profile 4 [vp8 @ 0000025f84d29380] Header size larger than data provided warn: SIPSorceryMedia.FFmpeg.FFmpegVideoEndPoint[0] Decode of video sample failed, width 0, height 0. [vp8 @ 0000025f84d29380] Unknown profile 4 [vp8 @ 0000025f84d29380] Header size larger than data provided warn: SIPSorceryMedia.FFmpeg.FFmpegVideoEndPoint[0] Decode of video sample failed, width 0, height 0. [vp8 @ 0000025f84d29380] Unknown profile 5 [vp8 @ 0000025f84d29380] Header size larger than data provided warn: SIPSorceryMedia.FFmpeg.FFmpegVideoEndPoint[0] Decode of video sample failed, width 0, height 0. [vp8 @ 0000025f84d29380] Unknown profile 5 [vp8 @ 0000025f84d29380] Header size larger than data provided warn: SIPSorceryMedia.FFmpeg.FFmpegVideoEndPoint[0] Decode of video sample failed, width 0, height 0. [vp8 @ 0000025f84d29380] Unknown profile 6 [vp8 @ 0000025f84d29380] Header size larger than data provided warn: SIPSorceryMedia.FFmpeg.FFmpegVideoEndPoint[0] Decode of video sample failed, width 0, height 0. [vp8 @ 0000025f84d29380] Unknown profile 6 [vp8 @ 0000025f84d29380] Header size larger than data provided warn: SIPSorceryMedia.FFmpeg.FFmpegVideoEndPoint[0] Decode of video sample failed, width 0, height 0. [vp8 @ 0000025f84d29380] Unknown profile 7 [vp8 @ 0000025f84d29380] Header size larger than data provided warn: SIPSorceryMedia.FFmpeg.FFmpegVideoEndPoint[0] Decode of video sample failed, width 0, height 0. [vp8 @ 0000025f84d29380] Unknown profile 7 [vp8 @ 0000025f84d29380] Header size larger than data provided warn: SIPSorceryMedia.FFmpeg.FFmpegVideoEndPoint[0] Decode of video sample failed, width 0, height 0. [vp8 @ 0000025f84d29380] Header size larger than data provided warn: SIPSorceryMedia.FFmpeg.FFmpegVideoEndPoint[0] Decode of video sample failed, width 0, height 0. [vp8 @ 0000025f84d29380] Header size larger than data provided warn: SIPSorceryMedia.FFmpeg.FFmpegVideoEndPoint[0] Decode of video sample failed, width 0, height 0. [vp8 @ 0000025f84d29380] Header size larger than data provided warn: SIPSorceryMedia.FFmpeg.FFmpegVideoEndPoint[0] Decode of video sample failed, width 0, height 0. [vp8 @ 0000025f84d29380] Header size larger than data provided warn: SIPSorceryMedia.FFmpeg.FFmpegVideoEndPoint[0] Decode of video sample failed, width 0, height 0. [vp8 @ 0000025f84d29380] Header size larger than data provided warn: SIPSorceryMedia.FFmpeg.FFmpegVideoEndPoint[0] Decode of video sample failed, width 0, height 0. [vp8 @ 0000025f84d29380] Header size larger than data provided warn: SIPSorceryMedia.FFmpeg.FFmpegVideoEndPoint[0] Decode of video sample failed, width 0, height 0. [vp8 @ 0000025f84d29380] Header size larger than data provided warn: SIPSorceryMedia.FFmpeg.FFmpegVideoEndPoint[0] Decode of video sample failed, width 0, height 0. [vp8 @ 0000025f84d29380] Header size larger than data provided warn: SIPSorceryMedia.FFmpeg.FFmpegVideoEndPoint[0] Decode of video sample failed, width 0, height 0. [vp8 @ 0000025f84d29380] Unknown profile 4 [vp8 @ 0000025f84d29380] Header size larger than data provided warn: SIPSorceryMedia.FFmpeg.FFmpegVideoEndPoint[0] Decode of video sample failed, width 0, height 0. [vp8 @ 0000025f84d29380] Unknown profile 4 [vp8 @ 0000025f84d29380] Header size larger than data provided warn: SIPSorceryMedia.FFmpeg.FFmpegVideoEndPoint[0] Decode of video sample failed, width 0, height 0. [vp8 @ 0000025f84d29380] Unknown profile 5 [vp8 @ 0000025f84d29380] Header size larger than data provided warn: SIPSorceryMedia.FFmpeg.FFmpegVideoEndPoint[0] Decode of video sample failed, width 0, height 0. [vp8 @ 0000025f84d29380] Unknown profile 5 [vp8 @ 0000025f84d29380] Header size larger than data provided warn: SIPSorceryMedia.FFmpeg.FFmpegVideoEndPoint[0] Decode of video sample failed, width 0, height 0. [vp8 @ 0000025f84d29380] Unknown profile 6 [vp8 @ 0000025f84d29380] Header size larger than data provided warn: SIPSorceryMedia.FFmpeg.FFmpegVideoEndPoint[0] Decode of video sample failed, width 0, height 0. [vp8 @ 0000025f84d29380] Unknown profile 6 [vp8 @ 0000025f84d29380] Header size larger than data provided warn: SIPSorceryMedia.FFmpeg.FFmpegVideoEndPoint[0] Decode of video sample failed, width 0, height 0. [vp8 @ 0000025f84d29380] Unknown profile 7 [vp8 @ 0000025f84d29380] Header size larger than data provided warn: SIPSorceryMedia.FFmpeg.FFmpegVideoEndPoint[0] Decode of video sample failed, width 0, height 0. [vp8 @ 0000025f84d29380] Unknown profile 7 [vp8 @ 0000025f84d29380] Header size larger than data provided warn: SIPSorceryMedia.FFmpeg.FFmpegVideoEndPoint[0] Decode of video sample failed, width 0, height 0. [vp8 @ 0000025f84d29380] Header size larger than data provided warn: SIPSorceryMedia.FFmpeg.FFmpegVideoEndPoint[0] Decode of video sample failed, width 0, height 0. [vp8 @ 0000025f84d29380] Header size larger than data provided warn: SIPSorceryMedia.FFmpeg.FFmpegVideoEndPoint[0] Decode of video sample failed, width 0, height 0. [vp8 @ 0000025f84d29380] Header size larger than data provided warn: SIPSorceryMedia.FFmpeg.FFmpegVideoEndPoint[0] Decode of video sample failed, width 0, height 0. [vp8 @ 0000025f84d29380] Header size larger than data provided

The sdp lines are as follows:

Client (js on Chrome, latest, Samsung S21 Ultra): v=0 o=- 542806558168496950 2 IN IP4 127.0.0.1 s=- t=0 0 a=group:BUNDLE 0 a=extmap-allow-mixed a=msid-semantic: WMS c8fbd0bd-ce02-482d-b882-f55d746a8888 m=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99 112 113 106 107 108 109 100 101 116 117 118 c=IN IP4 0.0.0.0 a=ice-ufrag:RpwG a=ice-pwd:Vvt/8ZvtfbhfSjNVf0AKRbZf a=fingerprint:sha-256 AF:58:78:33:AA:93:D5:5D:CB:A1:94:D2:F6:1E:5B:8C:6D:D6:0A:37:59:5A:52:AA:AC:0B:FE:AE:86:65:4F:8A a=setup:actpass a=mid:0 a=rtpmap:96 VP8/90000 a=rtpmap:97 rtx/90000 a=fmtp:97 apt=96 a=rtpmap:98 VP9/90000 a=fmtp:98 profile-id=0 a=rtpmap:99 rtx/90000 a=fmtp:99 apt=98 a=rtpmap:112 H264/90000 a=fmtp:112 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f a=rtpmap:113 rtx/90000 a=fmtp:113 apt=112 a=rtpmap:106 H264/90000 a=fmtp:106 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=4d001f a=rtpmap:107 rtx/90000 a=fmtp:107 apt=106 a=rtpmap:108 H264/90000 a=fmtp:108 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=64001f a=rtpmap:109 rtx/90000 a=fmtp:109 apt=108 a=rtpmap:100 VP9/90000 a=fmtp:100 profile-id=2 a=rtpmap:101 rtx/90000 a=fmtp:101 apt=100 a=rtpmap:116 red/90000 a=rtpmap:117 rtx/90000 a=fmtp:117 apt=116 a=rtpmap:118 ulpfec/90000 a=extmap:1 urn:ietf:params:rtp-hdrext:toffset a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time a=extmap:3 urn:3gpp:video-orientation a=extmap:4 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01 a=extmap:5 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay a=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type a=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-timing a=extmap:8 http://www.webrtc.org/experiments/rtp-hdrext/color-space a=extmap:9 urn:ietf:params:rtp-hdrext:sdes:mid a=extmap:10 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id a=extmap:11 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id a=rtcp:9 IN IP4 0.0.0.0 a=ice-options:trickle a=msid:c8fbd0bd-ce02-482d-b882-f55d746a8888 3dd5b106-29f4-4031-a3fa-c36626e8a395 a=rtcp-mux a=rtcp-rsize a=rtcp-fb:96 goog-remb a=rtcp-fb:96 transport-cc a=rtcp-fb:96 ccm fir a=rtcp-fb:96 nack a=rtcp-fb:96 nack pli a=rtcp-fb:98 goog-remb a=rtcp-fb:98 transport-cc a=rtcp-fb:98 ccm fir a=rtcp-fb:98 nack a=rtcp-fb:98 nack pli a=rtcp-fb:112 goog-remb a=rtcp-fb:112 transport-cc a=rtcp-fb:112 ccm fir a=rtcp-fb:112 nack a=rtcp-fb:112 nack pli a=rtcp-fb:106 goog-remb a=rtcp-fb:106 transport-cc a=rtcp-fb:106 ccm fir a=rtcp-fb:106 nack a=rtcp-fb:106 nack pli a=rtcp-fb:108 goog-remb a=rtcp-fb:108 transport-cc a=rtcp-fb:108 ccm fir a=rtcp-fb:108 nack a=rtcp-fb:108 nack pli a=rtcp-fb:100 goog-remb a=rtcp-fb:100 transport-cc a=rtcp-fb:100 ccm fir a=rtcp-fb:100 nack a=rtcp-fb:100 nack pli a=sendrecv a=ssrc-group:FID 2813945153 2545631160 a=ssrc:2813945153 cname:7GT1HSiQ46gqkfDu a=ssrc:2545631160 cname:7GT1HSiQ46gqkfDu

Server (SipSorcery, FFmpeg): v=0 o=- 87273 0 IN IP4 127.0.0.1 s=sipsorcery t=0 0 a=group:BUNDLE 0 m=video 9 UDP/TLS/RTP/SAVP 96 100 c=IN IP4 0.0.0.0 a=ice-ufrag:PGHB a=ice-pwd:OJYOANETWEAPDRZFYKKPRXRV a=fingerprint:sha-256 8A:26:F7:AF:43:F2:8C:C1:D5:AF:7A:BE:93:24:07:CB:38:FD:BC:9D:E7:AE:B4:6F:92:E3:C8:C2:1C:FC:F4:3E a=setup:active a=candidate:2855488198 1 udp 2113937663 xx.xx.xx.xx 57182 typ host generation 0 a=candidate:1983265321 1 udp 2113937663 xx.xx.xx.xx 57182 typ host generation 0 a=candidate:4003462342 1 udp 2113937663 xx.xx.xx.xx 57182 typ host generation 0 a=ice-options:ice2,trickle a=mid:0 a=rtpmap:96 VP8/90000 a=rtpmap:100 H264/90000 a=rtcp-mux a=rtcp:9 IN IP4 0.0.0.0 a=recvonly a=ssrc:1509194125 cname:538de6c9-b30b-4070-9425-649481806d34

This issue does not occur with any Desktop Chrome/Firefox browser, nor with iOS devices.

Any clue? Thanks in advance, Phil

pjacobs-eu commented 11 months ago

Also, these are the logs when using the .Encoders package:

warn: SIPSorceryMedia.Encoders.Codecs.Vp8Codec[0] VP8 decode attempt failed, Bitstream not supported by this decoder.

Same result on a OnePlus 7 Pro.

keremcadirci commented 8 months ago

1041 may solve your problem

pjacobs-eu commented 8 months ago

Confirmed, #1041 fixes the issue! Thanks @keremcadirci !