[vlc-devel] Opus RTP raw audio decoder plugin patch

Ilkka Ollakka ileoo at videolan.org
Sun Dec 1 11:00:24 CET 2013


On Fri, Nov 29, 2013 at 07:11:02PM +0800, Yupeng Chang wrote:
> Hi Ilkka,

Hi,

> Thanks for your advice.

> I did a little dig on the opus.c decoder, and I found the only thing this
> decoder needs, to decode Opus raw data, is an OggOpus header.
> And there is a function opus_write_header in opus_header.c, which can make
> one OggOpus header for me, so I just added one header to make it work.

I would prefer this change to be other way around, so you change
decoding function so it takes raw opus in and packetizer strips ogg
header if present. Would be much cleaner for future in mind.

It wouldn't be as small change, but I would prefer it that way.

> Please help to review again.
> Thanks very much!

> Yupeng Chang
> Nov-29-2013


> On 28 November 2013 20:48, Ilkka Ollakka <ileoo at videolan.org> wrote:


> > Hi,

> > Thanks for the new patch.

> > Why not use multistream api (OggOpus uses it) ? I don't have clear idea
> > how they differ (than that basic decoder seems to output S16N and
> > multistream can output FL32). Maybe someone more into Opus can clarify
> > this?

> > On Thu, Nov 28, 2013 at 08:24:11PM +0800, Yupeng Chang wrote:
> > > From 49da1c8c17b763cf71ee65e1b9f925ccc4e7b79f Mon Sep 17 00:00:00 2001
> > > From: Yupeng Chang <ypchang at ambarella.com>
> > > Date: Thu, 28 Nov 2013 20:19:17 +0800
> > > Subject: [PATCH 2/2] codec: Add Opus raw decoding.

> > > +    written = opus_decode(p_sys->p_raw_dec,
> > > +                          data, size,
> > > +                          (opus_int16*)p_aout_buffer->p_buffer,
> > > +                          buf_size / nb_channels, 0) * nb_channels * 2;
> > > +
> > > +    p_aout_buffer->i_nb_samples = nb_samples;
> > > +    p_aout_buffer->i_pts = date_Get( &p_sys->end_date );
> > > +    p_aout_buffer->i_length = written;

> > I think it would be clearer if you would do the multiplication when you
> > set i_lenght, not directly to opus_decode return value.

> > --
> > Ilkka Ollakka
> > Everybody is somebody else's weirdo.
> >                 -- Dykstra

> > _______________________________________________
> > vlc-devel mailing list
> > To unsubscribe or modify your subscription options:
> > https://mailman.videolan.org/listinfo/vlc-devel



> From f1c2ceb4f443551efff6714e055a55e3e2b502de Mon Sep 17 00:00:00 2001
> From: Yupeng Chang <ypchang at gmail.com>
> Date: Thu, 28 Nov 2013 20:19:03 +0800
> Subject: [PATCH 1/2] access: Enable Opus RTP.

> ---
>  modules/access/live555.cpp | 10 ++++++++++
>  1 file changed, 10 insertions(+)

> diff --git a/modules/access/live555.cpp b/modules/access/live555.cpp
> index 824cdf2..84dcba8 100644
> --- a/modules/access/live555.cpp
> +++ b/modules/access/live555.cpp
> @@ -980,6 +980,16 @@ static int SessionsSetup( demux_t *p_demux )
>                      else
>                          msg_Warn( p_demux,"Missing or unsupported vorbis header." );
>                  }
> +                else if( !strcmp( sub->codecName(), "OPUS") )
> +                {
> +                    tk->fmt.i_codec = VLC_CODEC_OPUS;
> +                    if( sub->rtpTimestampFrequency() )
> +                        tk->fmt.audio.i_rate = sub->rtpTimestampFrequency();
> +                    {
> +                        msg_Warn( p_demux, "Using 48kHz as default sample rate." );
> +                        tk->fmt.audio.i_rate = 48000;
> +                    }
> +                }
>              }
>              else if( !strcmp( sub->mediumName(), "video" ) )
>              {
-- 
Ilkka Ollakka
The good thing about standards is that there are so many to choose from.
		-- Andrew S. Tanenbaum
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20131201/728aaa90/attachment.sig>


More information about the vlc-devel mailing list