[vlc-commits] Fix decoding for aac streams with ADTS config set to 0 channels
Rafaël Carré
git at videolan.org
Thu Apr 18 02:19:22 CEST 2013
vlc | branch: master | Rafaël Carré <funman at videolan.org> | Thu Apr 18 02:17:56 2013 +0200| [6cdddeeb1d1aa433f4e88c04e241445e17938bd8] | committer: 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.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6cdddeeb1d1aa433f4e88c04e241445e17938bd8
---
modules/packetizer/mpeg4audio.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/modules/packetizer/mpeg4audio.c b/modules/packetizer/mpeg4audio.c
index 41f3216..7d77c28 100644
--- a/modules/packetizer/mpeg4audio.c
+++ b/modules/packetizer/mpeg4audio.c
@@ -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;
More information about the vlc-commits
mailing list