[vlc-commits] [Git][videolan/vlc][master] codec: opus: ensure stream mapping is initialized

Tristan Matthews (@tmatth) gitlab at videolan.org
Wed Oct 8 15:47:18 UTC 2025



Tristan Matthews pushed to branch master at VideoLAN / VLC


Commits:
adcf4aff by Tristan Matthews at 2025-10-08T15:30:47+00:00
codec: opus: ensure stream mapping is initialized

Fixes CID 1665534

- - - - -


1 changed file:

- modules/codec/opus.c


Changes:

=====================================
modules/codec/opus.c
=====================================
@@ -376,9 +376,19 @@ static int ProcessHeaders( decoder_t *p_dec )
     {
         OpusHeader header;
         opus_header_init(&header);
+
         opus_prepare_header( p_dec->fmt_in->audio.i_channels ? p_dec->fmt_in->audio.i_channels : 2,
                              p_dec->fmt_in->audio.i_rate ? p_dec->fmt_in->audio.i_rate : 48000,
                              &header );
+
+        /* This is the only case where opus_write_header will try to read header.stream_map */
+        if( header.channel_mapping == 1 )
+        {
+            /* default mapping */
+            static const unsigned char map[8] = { 0, 1, 2, 3, 4, 5, 6, 7 };
+            memcpy(header.stream_map, map, sizeof(map));
+        }
+
         int ret = opus_write_header( &p_alloc, &i_extra, &header,
                                      opus_get_version_string() );
         opus_header_clean(&header);



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

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


VideoLAN code repository instance


More information about the vlc-commits mailing list