[vlc-devel] [PATCH 1/1] opus: handle RTP depayloading (fixes #11938)

Tristan Matthews le.businessman at gmail.com
Sun Jan 11 18:40:12 CET 2015


On Sun, Jan 11, 2015 at 11:25 AM, Ross Finlayson <finlayson at live555.com> wrote:
>
> On Jan 11, 2015, at 6:24 AM, Rémi Denis-Courmont <remi at remlab.net> wrote:
>
> Le 2015-01-10 01:55, Tristan Matthews a écrit :
>
> If no header is given, deduce it from the decoder format.
>
>
> There is always a clock rate in RTP. You get it in the SDP rtpmap line.
>
>
> Note that this is already done in line 857 of "live555.cpp", where you do
> (for audio tracks):
> tk->fmt.audio.i_rate = sub->rtpTimestampFrequency();
> to set the *default* audio sampling frequency.  So you shouldn't need to do
> this again.

It wasn't being done twice, only in the case that it was set to 0,
which apparently can't happen so this case will be dropped.

>
> In any case, however, note the Opus RTP payload format document:
> https://tools.ietf.org/html/draft-ietf-payload-rtp-opus-06
>
> In particular:
> 1/ For Opus, the RTP clock rate is always 48000 Hz
> 2/ HOWEVER, the sampling frequency of the Opus audio that's contained within
> the RTP packet can be 8000 Hz, 12000 Hz, 16000 Hz, 24000 Hz, or 48000 Hz;
> see "Table 1".  This, not the RTP clock rate, is what you care about for
> VLC.  (Only the LIVE555 library should really care about the RTP clock
> rate.)
>
> Note also, in section 4.2:
>
>    The Opus encoder can output encoded frames representing 2.5, 5, 10,
>    20, 40, or 60 ms of speech or audio data.  Further, an arbitrary
>    number of frames can be combined into a packet, up to a maximum
>    packet duration representing 120 ms of speech or audio data.  The
>    grouping of one or more Opus frames into a single Opus packet is
>    defined in Section 3 of [RFC6716].  An RTP payload MUST contain
>    exactly one Opus packet as defined by that document.
>
> Note that section 3.1 of RFC 6716
> https://tools.ietf.org/html/rfc6716#section-3
> describes how to deduce the sampling frequency and number of frames from the
> first byte of each "Opus packet" - i.e., the data that's contained in each
> Opus RTP packet.  I hope, however, that you already do this elsewhere in
> VLC, in its generic code for decoding Opus audio.  You should not have to be
> doing this (looking at the first byte of payload data to deduce sampling
> frequency, etc.) in the "live555.cpp" module, as that code should be
> specifically for RTSP/RTP-related stuff.

Thanks for the info, I also tested the patch for sample rates of 8000,
12000, 16000, 24000 and 48000 and had no issues (with both our libopus
decoder and the libavcodec opus decoder).

Best,
Tristan



More information about the vlc-devel mailing list