Skip to content
Snippets Groups Projects
Commit 0ff86bf8 authored by Ilkka Ollakka's avatar Ilkka Ollakka Committed by Jean-Baptiste Kempf
Browse files

avcodec/audio: make channel mapping array 0 terminated

Also change pi_channels_src to be only AOUT_CHAN_MAX instead of same
size as mapping array.
parent 496f0f2a
No related branches found
No related tags found
1 merge request!3872avcodec: use ch_layout on audio decoder
Pipeline #360473 passed with stage
in 23 minutes and 48 seconds
...@@ -585,6 +585,7 @@ static const uint64_t pi_channels_map[][2] = ...@@ -585,6 +585,7 @@ static const uint64_t pi_channels_map[][2] =
{ AV_CH_TOP_BACK_RIGHT, 0 }, { AV_CH_TOP_BACK_RIGHT, 0 },
{ AV_CH_STEREO_LEFT, 0 }, { AV_CH_STEREO_LEFT, 0 },
{ AV_CH_STEREO_RIGHT, 0 }, { AV_CH_STEREO_RIGHT, 0 },
{ 0, 0 },
}; };
static void SetupOutputFormat( decoder_t *p_dec, bool b_trust ) static void SetupOutputFormat( decoder_t *p_dec, bool b_trust )
...@@ -617,8 +618,7 @@ static void SetupOutputFormat( decoder_t *p_dec, bool b_trust ) ...@@ -617,8 +618,7 @@ static void SetupOutputFormat( decoder_t *p_dec, bool b_trust )
} }
#endif #endif
const unsigned i_order_max = sizeof(pi_channels_map)/sizeof(*pi_channels_map); uint32_t pi_order_src[AOUT_CHAN_MAX] = { 0 };
uint32_t pi_order_src[i_order_max];
int i_channels_src = 0; int i_channels_src = 0;
#if LIBAVCODEC_VERSION_CHECK(59, 24, 100) #if LIBAVCODEC_VERSION_CHECK(59, 24, 100)
...@@ -633,7 +633,7 @@ static void SetupOutputFormat( decoder_t *p_dec, bool b_trust ) ...@@ -633,7 +633,7 @@ static void SetupOutputFormat( decoder_t *p_dec, bool b_trust )
if( channel_layout_mask ) if( channel_layout_mask )
{ {
for( unsigned i = 0; i < i_order_max for( unsigned i = 0; pi_channels_map[i][0]
&& i_channels_src < channel_count; i++ ) && i_channels_src < channel_count; i++ )
{ {
if( channel_layout_mask & pi_channels_map[i][0] ) if( channel_layout_mask & pi_channels_map[i][0] )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment