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

Ross Finlayson finlayson at live555.com
Sun Jan 11 17:25:13 CET 2015


> 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.

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] <https://tools.ietf.org/html/rfc6716#section-3>.  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.


Ross Finlayson
Live Networks, Inc.
http://www.live555.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20150111/de401160/attachment.html>


More information about the vlc-devel mailing list