[vlc-commits] [Git][videolan/vlc][master] live555: fill in Opus extradata

Tristan Matthews (@tmatth) gitlab at videolan.org
Tue Nov 2 15:24:27 UTC 2021



Tristan Matthews pushed to branch master at VideoLAN / VLC


Commits:
c73d61a5 by Tristan Matthews at 2021-11-02T15:09:49+00:00
live555: fill in Opus extradata

This does not make the live555 module dependent on libopus, just the helper
functions in opus_header.{c,h}

- - - - -


2 changed files:

- modules/access/Makefile.am
- modules/access/live555.cpp


Changes:

=====================================
modules/access/Makefile.am
=====================================
@@ -332,7 +332,7 @@ libhttp_plugin_la_LIBADD = $(SOCKET_LIBS)
 access_LTLIBRARIES += libhttp_plugin.la
 
 liblive555_plugin_la_SOURCES = access/live555.cpp access/mms/asf.c access/mms/buffer.c \
-                               access/live555_dtsgen.h
+                               access/live555_dtsgen.h codec/opus_header.c codec/opus_header.h
 liblive555_plugin_la_CXXFLAGS = $(AM_CXXFLAGS) $(CXXFLAGS_live555)
 liblive555_plugin_la_LIBADD = $(LIBS_live555) $(SOCKET_LIBS)
 liblive555_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(accessdir)' \


=====================================
modules/access/live555.cpp
=====================================
@@ -63,6 +63,7 @@
 
 extern "C" {
 #include "../access/mms/asf.h"  /* Who said ugly ? */
+#include "../codec/opus_header.h"  /* Who said uglier ? */
 #include "live555_dtsgen.h"
 }
 
@@ -1036,7 +1037,17 @@ static int SessionsSetup( demux_t *p_demux )
                 }
                 else if( !strcmp( sub->codecName(), "OPUS" ) )
                 {
+                    int i_extra;
+                    unsigned char *p_extra;
                     tk->fmt.i_codec = VLC_CODEC_OPUS;
+                    OpusHeader header;
+                    // "The RTP clock rate in "a=rtpmap" MUST be 48000 and the number of channels MUST be 2."
+                    // See: https://datatracker.ietf.org/doc/html/draft-ietf-payload-rtp-opus-11#section-7
+                    opus_prepare_header( 2, 48000, &header );
+                    if( opus_write_header( &p_extra, &i_extra, &header, NULL ) )
+                        return VLC_ENOMEM;
+                    tk->fmt.i_extra = i_extra;
+                    tk->fmt.p_extra = p_extra;
                 }
             }
             else if( !strcmp( sub->mediumName(), "video" ) )



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/c73d61a5f541a4b2566da2968c725b62ccac96cc

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/c73d61a5f541a4b2566da2968c725b62ccac96cc
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list