c++ - webrtc 视频编码器通过 sdp 同步

标签 c++ video webrtc sdp

我有一个使用 h264/90000 媒体作为视频流的 webrtc 应用程序。
我的报价 sdp 是

`type: offer, sdp: v=0
o=- 6487162123143986811 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE audio video data
a=msid-semantic: WMS
m=audio 9 UDP/TLS/RTP/SAVPF 111 103 104 9 0 8 106 105 13 110 112 113 126
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=ice-ufrag:6END
a=ice-pwd:qh8ZHjSd/8EiNkVnrfm0etc6
a=ice-options:trickle
a=fingerprint:sha-256 7D:A0:DD:31:74:EC:CC:29:71:EB:02:75:81:0A:98:48:50:31:A3:FF:2E:1E:16:04:12:AF:61:E8:1E:38:10:F2
a=setup:actpass
a=mid:audio
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=recvonly
a=rtcp-mux
a=rtpmap:111 opus/48000/2
a=fmtp:111 stereo=1;sprop-stereo=1;cbr=0
a=rtcp-fb:111 transport-cc
a=fmtp:111 minptime=10;useinbandfec=1
a=rtpmap:103 ISAC/16000
a=rtpmap:104 ISAC/32000
a=rtpmap:9 G722/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:106 CN/32000
a=rtpmap:105 CN/16000
a=rtpmap:13 CN/8000
a=rtpmap:110 telephone-event/48000
a=rtpmap:112 telephone-event/32000
a=rtpmap:113 telephone-event/16000
a=rtpmap:126 telephone-event/8000
m=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 102 124 127 123 125 107 108
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=ice-ufrag:6END
a=ice-pwd:qh8ZHjSd/8EiNkVnrfm0etc6
a=ice-options:trickle
a=fingerprint:sha-256 7D:A0:DD:31:74:EC:CC:29:71:EB:02:75:81:0A:98:48:50:31:A3:FF:2E:1E:16:04:12:AF:61:E8:1E:38:10:F2
a=setup:actpass
a=mid:video
a=extmap:2 urn:ietf:params:rtp-hdrext:toffset
a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:4 urn:3gpp:video-orientation
a=extmap:5 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
a=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type
a=extmap:8 http://www.webrtc.org/experiments/rtp-hdrext/video-timing
a=recvonly
a=rtcp-mux
a=rtcp-rsize
a=rtpmap:96 VP8/90000
a=rtcp-fb:96 ccm fir
a=rtcp-fb:96 nack
a=rtcp-fb:96 nack pli
a=rtcp-fb:96 goog-remb
a=rtcp-fb:96 transport-cc
a=rtpmap:97 rtx/90000
a=fmtp:97 apt=96
a=rtpmap:98 VP9/90000
a=rtcp-fb:98 ccm fir
a=rtcp-fb:98 nack
a=rtcp-fb:98 nack pli
a=rtcp-fb:98 goog-remb
a=rtcp-fb:98 transport-cc
a=rtpmap:99 rtx/90000
a=fmtp:99 apt=98
a=rtpmap:100 H264/90000
a=rtcp-fb:100 ccm fir
a=rtcp-fb:100 nack
a=rtcp-fb:100 nack pli
a=rtcp-fb:100 goog-remb
a=rtcp-fb:100 transport-cc
a=fmtp:100 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=64001f
a=rtpmap:101 rtx/90000
a=fmtp:101 apt=100
a=rtpmap:102 H264/90000
a=rtcp-fb:102 ccm fir
a=rtcp-fb:102 nack
a=rtcp-fb:102 nack pli
a=rtcp-fb:102 goog-remb
a=rtcp-fb:102 transport-cc
a=fmtp:102 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f
a=rtpmap:124 rtx/90000
a=fmtp:124 apt=102
a=rtpmap:127 H264/90000
a=rtcp-fb:127 ccm fir
a=rtcp-fb:127 nack
a=rtcp-fb:127 nack pli
a=rtcp-fb:127 goog-remb
a=rtcp-fb:127 transport-cc
a=fmtp:127 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f
a=rtpmap:123 rtx/90000
a=fmtp:123 apt=127
a=rtpmap:125 red/90000
a=rtpmap:107 rtx/90000
a=fmtp:107 apt=125
a=rtpmap:108 ulpfec/90000
m=application 9 DTLS/SCTP 5000
c=IN IP4 0.0.0.0
a=ice-ufrag:6END
a=ice-pwd:qh8ZHjSd/8EiNkVnrfm0etc6
a=ice-options:trickle
a=fingerprint:sha-256 7D:A0:DD:31:74:EC:CC:29:71:EB:02:75:81:0A:98:48:50:31:A3:FF:2E:1E:16:04:12:AF:61:E8:1E:38:10:F2
a=setup:actpass
a=mid:data
a=sctpmap:5000 webrtc-datachannel 1024`

H264/90000 有 3 个入口。
a=rtpmap:100 H264/90000、a=rtpmap:102 H264/90000 和 a=rtpmap:127 H264/90000

在服务器端,在将此 sdp 设置为 remotedescription 之前,我已经更新了
m=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 102 124 127 123 125 107 108
m=video 9 UDP/TLS/RTP/SAVPF 100 96 97 98 99 101 102 124 127 123 125 107 108
确保它使用 a=rtpmap:100 H264/90000视频媒体入口。我总是使用 h264/90000 a=rtpmap:100 H264/90000 的第一个条目作为视频媒体。

这段代码运行良好。但是现在,我的视频元素中出现了粉红色的屏幕

创建答案后,我从服务器端的本地描述中得到的是m=video 9 UDP/TLS/RTP/SAVPF 102 96 97 124 125 107 108它表明 102(a=rtpmap:102 H264/90000) 用于视频媒体。
它在浏览器中完全显示一个粉红色的屏幕。此外,音频和数据 channel 仍然可以正常工作。

请帮助我了解如何知道 h264/90000 的哪个条目将用于服务器的本地描述。

最佳答案

它对我有用。

如果编码器(您要使用的)在 sdp 中有不同的值,则它的所有值必须比其他值具有更高的偏好,即 H264/90000 有三个值,m=video 必须喜欢

m=video 9 UDP/TLS/RTP/SAVPF 100 102 127 96 97 98 99 101 124 123 125 107 108

一个问题没有解决,那就是为什么 H264/90000 有三个不同的值。

关于c++ - webrtc 视频编码器通过 sdp 同步,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48380938/

相关文章:

webrtc - 回退到 TURN 的预期连接百分比可能是多少?

c++ - 尝试访问指向 vector 中对象的指针时出现无效访问错误

video - FFMPEG : Cut specific parts of a video, 并将它们合并到一个文件中

php - 直接上载Zend PHP:如何禁用对正在上载的视频的评论?

无法播放 Libavcodec (ffmpeg) 编码示例的视频输出

webrtc - 编辑本地流

c++ - 为什么priority_queue pop函数不删除栈顶元素?

c++ - .h 文件是否被编译器或 "just"命名约定区别对待?

c++ - 是否可以更改从 GetTickCount() 返回的刻度计数值?

javascript - 如何向数千人传输 Twilio 视频室?