如何使用Kurento修改录制音频的答案SDP?

时间:2015-07-15 18:27:25

标签: webrtc sdp kurento

我可以使用Kurento Media Server录制视频+音频。我在录制纯音频流方面遇到问题。从How to use kurento-media-server for audio only stream?了解必须修改SDP的答案。

目前,我只将 MediaStream 添加到 PeerConnection 的音轨中。在发送回SDP之前在服务器端,我修改它。我试过删除

  1. 以下任何内容(包括)m=video
  2. 以下任何内容(包括)a=mid:video
  3. 在这两种情况下,浏览器端 PeerConnection#signalingState 都保留在have-local-offer中。

    在媒体流开始流动的答案SDP中应该更改什么,Kurento会开始录制仅音频流?

    以下是来自 WebRtcEndpoint #processoffer 的原始答案SDP(从中删除):

    v=0
    o=- 7750769884654864002 0 IN IP4 0.0.0.0
    s=Kurento Media Server
    c=IN IP4 0.0.0.0
    t=0 0
    a=group:BUNDLE audio video
    m=audio 40192 RTP/SAVPF 111 0
    c=IN IP4 10.0.2.15
    a=rtpmap:111 opus/48000/2
    a=rtpmap:0 PCMU/8000
    a=sendrecv
    a=rtcp:40192 IN IP4 10.0.2.15
    a=rtcp-mux
    a=ssrc:4125152746 cname:user2534372120@host-b735c5b0
    a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
    a=mid:audio
    a=ice-ufrag:SEV7
    a=ice-pwd:BQyTSM0hvTJeqykFZovuBS
    a=fingerprint:sha-256 E4:A1:25:2C:53:60:28:F5:C1:94:C6:32:E0:13:81:06:A6:66:77:00:52:C2:D9:93:AF:E4:A0:B3:4D:5C:9C:C3
    a=candidate:1 1 UDP 2013266431 10.0.2.15 40192 typ host
    a=candidate:2 1 UDP 2013266431 192.168.33.10 44816 typ host
    m=video 40192 RTP/SAVPF 100
    c=IN IP4 10.0.2.15
    b=AS:500
    a=rtpmap:100 VP8/90000
    a=sendonly
    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:40192 IN IP4 10.0.2.15
    a=rtcp-mux
    a=ssrc:1769273725 cname:user2534372120@host-b735c5b0
    a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
    a=mid:video
    a=ice-ufrag:SEV7
    a=ice-pwd:BQyTSM0hvTJeqykFZovuBS
    a=fingerprint:sha-256 E4:A1:25:2C:53:60:28:F5:C1:94:C6:32:E0:13:81:06:A6:66:77:00:52:C2:D9:93:AF:E4:A0:B3:4D:5C:9C:C3
    a=candidate:1 1 UDP 2013266431 10.0.2.15 40192 typ host
    a=candidate:2 1 UDP 2013266431 192.168.33.10 44816 typ host
    

    编辑:

    根据kurento google小组的建议后,似乎无需修改SDP。至少和Kurento 6一样。 我只使用音频工作(使用来自浏览器的仅音频MediaStream以及来自浏览器的音频+视频MediaStream)。为此(Ruby中的示例代码):

    1. 在RecorderEndpoint构建器RecorderEndpoint::Builder.new(@pipeline, location).withMediaProfile(org.kurento.client.MediaProfileSpecType::WEBM_AUDIO_ONLY).build()中指定 MediaProfileSpecType
    2. 连接录像机端点时指定 MediaType (@ source是 WebRtcEndpoint ): @source.connect(@recorder, org.kurento.client.MediaType::AUDIO)

2 个答案:

答案 0 :(得分:2)

这里你有不同的选择。我假设您有webrtcEprecoderEp

  • 从客户端发送音频和视频,但只录制视频:您将同时发送两者,但必须指示录制器仅存储音频

    RecorderEndpoint recoderEp = new RecorderEndpoint.Builder(pipeline, "URI_HERE").withMediaProfile(MediaProfileSpecType.WEBM_AUDIO_ONLY).build();
    webrtcEp.connect(recorderEp, MediaProfile.AUDIO);
    
  • 仅发送音频:将video选项的getUserMedia属性设置为false应仅发送音频。如果没有,则表示webrtc端点在媒体服务器中的协商存在错误。我们有类似的情况,但只发送视频,它正在工作。如果没有,请报告,以便我们解决。

编辑#1:在任何情况下,指定要记录的媒体类型或两个端点将通过connect方法进行交换总是很方便,因此第一个项目符号中所写的内容适用两者都有。

编辑#2创建录像机时,您肯定需要指定MediaProfileSpecType

答案 1 :(得分:1)

您可以将视频流的端口设置为零。这应该表明在会话期间拒绝或禁止流进一步使用。

m =视频0 RTP / SAVPF 100

相关问题