[vlc-commits] [Git][videolan/vlc][3.0.x] live555: fill in Opus extradata

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Tue Nov 16 08:54:07 UTC 2021



Hugo Beauzée-Luyssen pushed to branch 3.0.x at VideoLAN / VLC


Commits:
e69264f8 by Tristan Matthews at 2021-11-16T08:31:54+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}

(cherry picked from commit c73d61a5f541a4b2566da2968c725b62ccac96cc)

- - - - -


2 changed files:

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


Changes:

=====================================
modules/access/Makefile.am
=====================================
@@ -316,7 +316,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
=====================================
@@ -62,6 +62,7 @@
 
 extern "C" {
 #include "../access/mms/asf.h"  /* Who said ugly ? */
+#include "../codec/opus_header.h"  /* Who said uglier ? */
 #include "live555_dtsgen.h"
 }
 
@@ -1032,7 +1033,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/e69264f8edd9e01ebb5f66cbb11cc1849e4082e3

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




More information about the vlc-commits mailing list