Kurento / bugtracker

[ARCHIVED] Contents migrated to monorepo: https://github.com/Kurento/kurento
46 stars 10 forks source link

One way audio on webrtcendpoint #635

Open szcom opened 2 years ago

szcom commented 2 years ago

Prerequisites

These are MANDATORY, otherwise the issue will be automatically closed.

Issue description

WebRTCEndpoint (offerer) fails to handle incoming RTP audio stream when answer SDP does not include a=ssrc attribute. Result in audio is one way - offerer to answerer. Audio from answerer is dropped.

This sequence of events leads to the issue.

  1. webrtcendpoint.generateOffer
    v=0
    o=- 3875948703 3875948703 IN IP4 0.0.0.0
    s=Kurento Media Server
    c=IN IP4 0.0.0.0
    t=0 0
    a=group:BUNDLE audio0
    m=audio 1 RTP/SAVPF 96 0
    a=setup:actpass
    a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
    a=rtpmap:96 opus/48000/2
    a=rtcp:9 IN IP4 0.0.0.0
    a=rtcp-mux
    a=sendrecv
    a=mid:audio0
    a=ssrc:1753807169 cname:user760579686@host-334cc830
    a=ice-ufrag:YSGY
    a=ice-pwd:aafQId9sQ90XrwZjFIfp0H
    a=fingerprint:sha-256 B4:DA:B0:47:CD:4E:A9:39:43:D9:4C:DC:3D:86:BB:8F:99:FE:55:48:A4:09:21:7B:C3:1E:E7:C3:AA:CB:D1:BB
  2. webrtcendpoint.gatherCandidates
  3. when candidates are collected send offer
  4. webrtcendpoint.processAnswer():
    v=0
    o=- 19452 81007 IN IP4 43.111.111.84
    s=SBC call
    c=IN IP4 43.111.111.121
    t=0 0
    m=audio 39574 RTP/SAVPF 0
    a=wg2-h:UC1FYXJseS1NZWRpYTogc2VuZHJlY3Y=
    a=mid:audio0
    a=rtpmap:0 PCMU/8000
    a=sendrecv
    a=rtcp:39575
    a=setup:active
    a=fingerprint:sha-256 9B:E2:15:D7:CC:11:AF:08:68:D3:FA:A6:18:65:48:2B:DD:5D:9E:9C:81:BC:EB:84:53:A5:39:2E:59:A3:BA:54
    a=ptime:20
    a=ice-ufrag:QPi7Apej
    a=ice-pwd:wiRbeQ7C0OOohyz7oaot2J4gci
    a=candidate:kL8Ev9korzYjNxog 1 UDP 2130706431 43.111.111.121 39574 typ host
    a=candidate:kL8Ev9korzYjNxog 2 UDP 2130706430 43.111.111.121 39575 typ host
    a=rtcp-mux

When audio stream from answerer comes following printout appears in KMS logs:

0:01:47.728442100     1 0x7f7f640502d0 ERROR      kmsbasertpsession kmsbasertpsession.c:375:rtp_ssrc_demux_new_ssrc_pad:<kmswebrtcsession1> Remote SSRC 3272874663 doesn't match any SDP media; DATA WILL BE DROPPED
0:01:47.728463200     1 0x7f7f640502d0 WARN         basertpendpoint kmsbasertpendpoint.c:923:kms_base_rtp_endpoint_request_rtp_sink:<kmswebrtcendpoint1> Discarding all RTP from unknown media: '(NULL)'
0:01:47.728626100     1 0x7f7f640502d0 WARN         basertpendpoint kmsbasertpendpoint.c:993:kms_base_rtp_endpoint_request_rtcp_sink:<kmswebrtcendpoint1> Discarding all RTCP from unknown media: '(NULL)'

ICE and DTLS connected fine but in absence of the a=ssrc attribute in answer SDP KMS fails to build a functioning RTP source pad.

Context

I am trying to get WebRTCEndpoint to talk another WebRTC peer as an offerer but getting one way audio from KMS to external endpoint. RTP sent by external endpoint is dropped by WebRTCEndpoint.

Worth mentioning I don't see the same problem when KMS answers WebRTC SDP.

How to reproduce?

I think issue should be reproducible by creating 2 pipelines with a player and WebRTCEndpoint in each.

  1. Pipeline1: PlayerEndpoint->WebrtcEndpoint, make sure only PCMU codec is enabled in KMS config
  2. Pipeline2: PlayerEndpoint->WebrtcEndpoint
  3. Pipeline1.WebrtcEndpoint.generateOffer(audio only); Pipeline1.WebrtcEndpoint.gatherCandidates()
  4. Send offer from Pipeline1.WebrtcEndpoint.getLocalSessionDescriptor()
  5. Pipeline2.WebrtcEndpoint.processOffer() and gatherCandidates(), when candidates collected - send the answer from getLocalSessionDescriptor()
  6. remove (or replace a=ssrc with a=xxxx) a=ssrc.*\r\n line from the answer SDP and invoke Pipeline1.WebrtcEndpoint.processAnswer()
  7. When ICE pair is selected - start players
  8. Observe KMS log output with ERROR Remote SSRC doesn't match any SDP media; DATA WILL BE DROPPED

Expected & current behavior

KMS should correctly connect RTP source even though SDP does not have a=ssrc: parameter

(Optional) Possible solution

Info about your environment

KMS latest docker running on OSX

echo $GST_DEBUG
2,Kurento*:4,kms*:4,sdp*:4,webrtc*:4,*rtpendpoint:4,rtp*handler:4,rtpsynchronizer:4,agnosticbin:4,Kurento*:5,KurentoWebSocket*:4,kmssdpsession:5,sdp*:5,basesdpendpoint:5,webrtcendpoint:5,kmswebrtcsession:5,kmsiceniceagent:5
docker run -it --env GST_DEBUG="$GST_DEBUG,kmsbasertpsession:7,rtcpdemux:7" --name kms -p 8888:8888 kurento/kurento-media-server:latest

No STUN/TURN servers. Peer endpoint is on public internet. Local pipeline has WebRTCEndpoint connected to the peer.

About Kurento Media Server

About your Application Server

About end-user clients

N/A

Run these commands

cat /etc/lsb-release

DISTRIB_ID=Ubuntu DISTRIB_RELEASE=16.04 DISTRIB_CODENAME=xenial DISTRIB_DESCRIPTION="Ubuntu 16.04.7 LTS"

kurento-media-server --version

Kurento Media Server version: 6.18.0 Found modules: 'chroma' version 6.18.0 'core' version 6.18.0 'crowddetector' version 6.18.0 'elements' version 6.18.0 'filters' version 6.18.0 'markerdetector' version 6.18.0 'platedetector' version 6.18.0 'pointerdetector' version 6.18.0

dpkg -l | grep -Pi 'kurento|kms-|gst.*1.5|nice'

ii gir1.2-gst-plugins-base-1.5 1.8.1-1kurento2.16.04 amd64 Description: GObject introspection data for the GStreamer Plugins Base library ii gir1.2-gstreamer-1.5 1.8.1-1kurento2.16.04 amd64 Description: GObject introspection data for the GStreamer library ii gir1.2-nice-0.1:amd64 0.1.18-0kurento2.16.04 amd64 ICE library (GObject introspection) ii gstreamer1.5-libav:amd64 1.8.1-1kurento1.16.04 amd64 libav plugin for GStreamer ii gstreamer1.5-nice:amd64 0.1.18-0kurento2.16.04 amd64 ICE library (GStreamer 1.5 plugin) ii gstreamer1.5-plugins-bad:amd64 1.8.1-1kurento5.16.04 amd64 GStreamer plugins from the "bad" set ii gstreamer1.5-plugins-base:amd64 1.8.1-1kurento2.16.04 amd64 GStreamer plugins from the "base" set ii gstreamer1.5-plugins-good:amd64 1.8.1-1kurento5.16.04 amd64 GStreamer plugins from the "good" set ii gstreamer1.5-plugins-ugly:amd64 1.8.1-1kurento1.16.04 amd64 GStreamer plugins from the "ugly" set ii gstreamer1.5-pulseaudio:amd64 1.8.1-1kurento5.16.04 amd64 GStreamer plugin for PulseAudio ii kms-chroma 6.18.0-0kurento1.16.04 amd64 Kurento Chroma filter ii kms-cmake-utils 6.18.0-0kurento1.16.04 all Kurento CMake utils ii kms-core 6.18.0-0kurento1.16.04 amd64 Kurento Core module ii kms-core-dev 6.18.0-0kurento1.16.04 amd64 Kurento Core module ii kms-crowddetector 6.18.0-0kurento1.16.04 amd64 Kurento Crowd Detector filter ii kms-elements 6.18.0-0kurento1.16.04 amd64 Kurento Elements module ii kms-elements-dev 6.18.0-0kurento1.16.04 amd64 Kurento Elements module ii kms-filters 6.18.0-0kurento1.16.04 amd64 Kurento Filters module ii kms-filters-dev 6.18.0-0kurento1.16.04 amd64 Kurento Filters module ii kms-jsonrpc 6.18.0-0kurento1.16.04 amd64 Kurento JSON-RPC library ii kms-jsonrpc-dev 6.18.0-0kurento1.16.04 amd64 Kurento JSON-RPC library ii kms-markerdetector 6.18.0-0kurento1.16.04 amd64 Kurento Augmented Reality marker detector ii kms-platedetector 6.18.0-0kurento1.16.04 amd64 Kurento Plate Detector filter ii kms-pointerdetector 6.18.0-0kurento1.16.04 amd64 Kurento Pointer Detector filter ii kmsjsoncpp 1.6.3-1kurento1.16.04 amd64 Kurento jsoncpp library ii kmsjsoncpp-dev 1.6.3-1kurento1.16.04 amd64 Kurento jsonrpc library ii kurento-media-server 6.18.0-0kurento1.16.04 amd64 Kurento Media Server ii kurento-media-server-dev 6.18.0-0kurento1.16.04 amd64 Kurento Media Server ii kurento-module-creator 6.18.0-0kurento1.16.04 all Kurento Module Creator ii libgstreamer-plugins-bad1.5-0:amd64 1.8.1-1kurento5.16.04 amd64 GStreamer development files for libraries from the "bad" set ii libgstreamer-plugins-base1.5-0:amd64 1.8.1-1kurento2.16.04 amd64 GStreamer libraries from the "base" set ii libgstreamer-plugins-base1.5-dev 1.8.1-1kurento2.16.04 amd64 GStreamer development files for libraries from the "base" set ii libgstreamer1.5-0:amd64 1.8.1-1kurento2.16.04 amd64 Core GStreamer libraries and elements ii libgstreamer1.5-dev 1.8.1-1kurento2.16.04 amd64 GStreamer core development files ii libnice-dev 0.1.18-0kurento2.16.04 amd64 ICE library (development files) ii libnice10:amd64 0.1.18-0kurento2.16.04 amd64 ICE library (shared library) ii libsrtp0:amd64 1.6.0-0kurento1.16.04 amd64 Secure RTP (SRTP) and UST Reference Implementations - shared library ii libusrsctp 0.9.2-1kurento1.16.04 amd64 sctp-refimpl library ii openh264 1.5.0-0kurento1.16.04 amd64 H.264 Video Codec provided by Cisco Systems, Inc. ii openh264-gst-plugins-bad-1.5:amd64 1.8.1-1kurento5.16.04 amd64 GStreamer plugins from openh264 ii openwebrtc-gst-plugins 0.10.0-1kurento1.16.04 amd64 OpenWebRTC specific GStreamer plugins ii openwebrtc-gst-plugins-dev 0.10.0-1kurento1.16.04 amd64 OpenWebRTC specific GStreamer plugins

github-actions[bot] commented 2 years ago

Hello @szcom! :wave: we're sorry you found a bug... so first of all, thank you very much for reporting it.

To know about progress, check in Triage. All issues are considered Backlog Candidates until work priorities align and the issue is selected for development. It will then become part of our official Backlog.