当在android和ios之间调用时,使用surfaceviewrender显示远程视频跟踪时,我遇到了一个问题(android和ios也可以工作)安卓系统上的远程视频视图几秒钟后会冻结,但音频仍能正常工作(iOS没问题)。可能是ios的h264编解码器造成的问题,但是我遵循最新的代码来解码和编码,所以我仍然停留在这里。以下是我的代码:创建: PeerConnectionFactory.initialize( PeerConnectionFactory.InitializationOptions.builder(activity.getApplicationContext()) .setEnableInternalTracer(true) .setEnableVideoHwAcceleration(true, true) .createInitializationOptions());解码和编码 private void tryingToCreatePeerConnectionFactory(EglBase eglBase) { final PeerConnectionFactory.Options options = new PeerConnectionFactory.Options(); final DefaultVideoEncoderFactory encoderFactory = new DefaultVideoEncoderFactory(eglBase.getEglBaseContext(), true, true); final DefaultVideoDecoderFactory decoderFactory = new DefaultVideoDecoderFactory(eglBase.getEglBaseContext()); peerConnectionFactory = PeerConnectionFactory.builder().setOptions(options). setVideoDecoderFactory(decoderFactory). setVideoEncoderFactory(encoderFactory). createPeerConnectionFactory(); }SDP内容v=0o=- 3807425029370800822 2 IN IP4 127.0.0.1s=-t=0 0a=group:BUNDLE audio videoa=msid-semantic: WMS ARDAMSm=audio 9 UDP/TLS/RTP/SAVPF 111 103 9 102 0 8 105 13 110 113 126c=IN IP4 0.0.0.0a=rtcp:9 IN IP4 0.0.0.0a=ice-ufrag:pTq5a=ice-pwd:EVfiXQOe4/G/01ezOXYv1fzBa=ice-options:trickle renominationa=fingerprint:sha-256 A3:D1:0B:D4:9F:A9:ED:C5:D2:94:04:F3:91:07:6F:FD:68:71:4C:7B:CA:87:3F:AB:34:B5:F3:7E:82:0B:42:77a=setup:activea=mid:audioa=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-levela=sendrecva=rtcp-muxa=rtpmap:111 opus/48000/2a=rtcp-fb:111 transport-cca=fmtp:111 minptime=10;useinbandfec=1a=rtpmap:103 ISAC/16000a=rtpmap:9 G722/8000a=rtpmap:102 ILBC/8000a=rtpmap:0 PCMU/8000a=rtpmap:8 PCMA/8000a=rtpmap:105 CN/16000a=rtpmap:13 CN/8000a=rtpmap:110 telephone-event/48000a=rtpmap:113 telephone-event/16000a=rtpmap:126 telephone-event/8000a=ssrc:3210082304 cname:PPyVOHEaYgrfSyKMa=ssrc:3210082304 msid:ARDAMS ARDAMSa0a=ssrc:3210082304 mslabel:ARDAMSa=ssrc:3210082304 label:ARDAMSa0m=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 127c=IN IP4 0.0.0.0a=rtcp:9 IN IP4 0.0.0.0a=ice-ufrag:pTq5a=ice-pwd:EVfiXQOe4/G/01ezOXYv1fzBa=ice-options:trickle renominationa=fingerprint:sha-256 A3:D1:0B:D4:9F:A9:ED:C5:D2:94:04:F3:91:07:6F:FD:68:71:4C:7B:CA:87:3F:AB:34:B5:F3:7E:82:0B:42:77a=setup:activea=mid:videoa=extmap:2 urn:ietf:params:rtp-hdrext:toffseta=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-timea=extmap:4 urn:3gpp:video-orientationa=extmap:5 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01a=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/playout-delaya=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-content-typea=extmap:8 http://www.webrtc.org/experiments/rtp-hdrext/video-timinga=sendrecva=rtcp-muxa=rtcp-rsizea=rtpmap:96 H264/90000a=rtcp-fb:96 goog-remba=rtcp-fb:96 transport-cca=rtcp-fb:96 ccm fira=rtcp-fb:96 nacka=rtcp-fb:96 nack plia=fmtp:96 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=640c1fa=rtpmap:97 rtx/90000a=fmtp:97 apt=96a=rtpmap:98 H264/90000a=rtcp-fb:98 goog-remba=rtcp-fb:98 transport-cca=rtcp-fb:98 ccm fira=rtcp-fb:98 nacka=rtcp-fb:98 nack plia=fmtp:98 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01fa=rtpmap:99 rtx/90000a=fmtp:99 apt=98a=rtpmap:100 red/90000a=rtpmap:101 rtx/90000a=fmtp:101 apt=100a=rtpmap:127 ulpfec/90000a=ssrc-group:FID 2423939598 98025098a=ssrc:2423939598 cname:PPyVOHEaYgrfSyKMa=ssrc:2423939598 msid:ARDAMS ARDAMSv0a=ssrc:2423939598 mslabel:ARDAMSa=ssrc:2423939598 label:ARDAMSv0a=ssrc:98025098 cname:PPyVOHEaYgrfSyKMa=ssrc:98025098 msid:ARDAMS ARDAMSv0a=ssrc:98025098 mslabel:ARDAMSa=ssrc:98025098 label:ARDAMSv0更新我们找到了这个问题的原因,因为一个未知的原因,在android端接收到的数据变低,再也不会上升,这就是为什么视频会被冻结以下是视频被冻结时收到的日期值getBytesInInterval= 6091但我不知道为什么有人对我的问题有什么建议吗?如有任何回复,将不胜感激。 (adsbygoogle = window.adsbygoogle || []).push({}); 最佳答案 更新我已经找到解决这个问题的办法了,伙计。根本原因在于ios的大小,每个视频编解码器(decode/encode)的分辨率应该缩小,定格帧的情况将消失。请更新iOS端的此代码static let videoResolutionsStaticValues = [ "640x480", "960x540", "1280x720" ]static let videoCodecsStaticValues = [ "H264", "VP8", "VP9" ] (adsbygoogle = window.adsbygoogle || []).push({}); 08-06 11:18