Search code examples
androidvlclibvlc

Provide description in SDP format for RTP stream


I'm using LibVLC library 2.1.12 to render an RTP stream to my Android device.

I'm using the following SDP description to request RTP/AV packets to be delivered to the given IP address and port (192.168.0.33, port: 65446)

v=0
o=- 1537446049254 1537446050285 IN IP4 192.168.0.33
s=-
c=IN IP4 192.168.0.33
t=0 0
a=recvonly
m=video 65446 RTP/AVP 97
a=rtpmap:97 H264/90000
a=fmtp:97 profile-level-id=42e01e;packetization-mode=1

On my server (android), I can see the incoming RTP packets.

Code below:

private void preparePlayer(ParcelFileDescriptor pfd, VideoStream stream) {
    Media media = new Media(videoView.getVlc(), Uri.parse("rtp://@:" + stream.getLocalPort()));
    media.addOption(":network-caching=5000");
    media.addOption(":clock-jitter=0");
    media.addOption(":clock-synchro=0");
    media.addOption(":codec=all");
    media.addOption(":sout-rtp-description=" + stream.getReceiver().getSessionDescription());
}

When I try to provde LibVLC with the stream, I receive the following information in my logs:

core input: `rtp://@:65446' successfully opened
rtp demux: unspecified payload format (type 97)
rtp demux: A valid SDP is needed to parse this RTP stream.
core demux: SDP required
core demux: A description in SDP format is required to receive the RTP 
stream. Note that rtp:// URIs cannot work with dynamic RTP payload 
format (97).
rtp demux: added RTP source (58a1ef57)
rtp demux: unknown payload (97)
  1. How can I provide the description in SDP format to LibVLC (on Android)?
  2. Is there another way that I can provide the raw stream packets to the LibVLC VideoView?

Solution

  • --sout-rtp-sdp=<string>

    More info at https://wiki.videolan.org/VLC_command-line_help/

    I'm using LibVLC library 2.1.12

    Which wrapper are you using? I strongly advise you to upgrade to libvlc 3+