Commit 6cdddeeb authored by Rafaël Carré's avatar Rafaël Carré

Fix decoding for aac streams with ADTS config set to 0 channels

Assuming stereo is fairly safe and still better than not decoding anything.
This is what gstreamer does, and mplayer might do the same thing.
parent 57fe6b36
......@@ -330,6 +330,8 @@ static int ADTSSyncInfo( decoder_t * p_dec, const uint8_t * p_buf,
*pi_sample_rate = pi_sample_rates[i_sample_rate_idx];
//private_bit = (p_buf[2] >> 1) & 0x01;
*pi_channels = ((p_buf[2] & 0x01) << 2) | ((p_buf[3] >> 6) & 0x03);
if (*pi_channels == 0) /* workaround broken streams */
*pi_channels = 2;
//original_copy = (p_buf[3] >> 5) & 0x01;
//home = (p_buf[3] >> 4) & 0x01;
......@@ -341,7 +343,7 @@ static int ADTSSyncInfo( decoder_t * p_dec, const uint8_t * p_buf,
//uint16_t buffer_fullness = ((p_buf[5] & 0x1f) << 6) | (p_buf[6] >> 2);
unsigned short i_raw_blocks_in_frame = p_buf[6] & 0x03;
if( !*pi_sample_rate || !*pi_channels || !i_frame_size )
if( !*pi_sample_rate || !i_frame_size )
{
msg_Warn( p_dec, "Invalid ADTS header" );
return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment